1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Assign unless modifiers.

This commit is contained in:
Rob Rix 2017-04-19 16:54:03 -04:00
parent 25379d71aa
commit ff6ce916eb

View File

@ -78,6 +78,7 @@ statement = exit Statement.Return Return
<|> if'
<|> ifModifier
<|> unless
<|> unlessModifier
<|> literal
where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children statement))
@ -94,6 +95,9 @@ ifModifier = term <$ symbol IfModifier <*> children (flip Statement.If <$> state
unless :: Assignment Grammar (Term Syntax ())
unless = term <$ symbol Unless <*> children (Statement.If <$> (term . Expression.Not <$> statement) <*> (term <$> many statement) <*> optional (term <$ symbol Else <*> children (many statement)))
unlessModifier :: Assignment Grammar (Term Syntax ())
unlessModifier = term <$ symbol UnlessModifier <*> children (flip Statement.If <$> statement <*> (term . Expression.Not <$> statement) <*> pure (term Syntax.Empty))
literal :: Assignment Grammar (Term Syntax ())
literal = term Literal.true <$ symbol Language.Ruby.Syntax.True <* source
<|> term Literal.false <$ symbol Language.Ruby.Syntax.False <* source