mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Assign unless modifiers.
This commit is contained in:
parent
25379d71aa
commit
ff6ce916eb
@ -78,6 +78,7 @@ statement = exit Statement.Return Return
|
|||||||
<|> if'
|
<|> if'
|
||||||
<|> ifModifier
|
<|> ifModifier
|
||||||
<|> unless
|
<|> unless
|
||||||
|
<|> unlessModifier
|
||||||
<|> literal
|
<|> literal
|
||||||
where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children statement))
|
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 :: 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)))
|
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 :: Assignment Grammar (Term Syntax ())
|
||||||
literal = term Literal.true <$ symbol Language.Ruby.Syntax.True <* source
|
literal = term Literal.true <$ symbol Language.Ruby.Syntax.True <* source
|
||||||
<|> term Literal.false <$ symbol Language.Ruby.Syntax.False <* source
|
<|> term Literal.false <$ symbol Language.Ruby.Syntax.False <* source
|
||||||
|
Loading…
Reference in New Issue
Block a user