mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
🔥 expr.
This commit is contained in:
parent
c83b75f5b4
commit
1d2c924088
@ -78,8 +78,8 @@ statement = exit Statement.Return Return
|
|||||||
<|> if'
|
<|> if'
|
||||||
<|> ifModifier
|
<|> ifModifier
|
||||||
<|> unless
|
<|> unless
|
||||||
<|> expr
|
<|> literal
|
||||||
where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children expr))
|
where exit construct sym = term . construct <$ symbol sym <*> children (optional (symbol ArgumentList *> children statement))
|
||||||
|
|
||||||
comment :: Assignment Grammar (Term Syntax ())
|
comment :: Assignment Grammar (Term Syntax ())
|
||||||
comment = term . Comment.Comment <$ symbol Comment <*> source
|
comment = term . Comment.Comment <$ symbol Comment <*> source
|
||||||
@ -89,14 +89,11 @@ if' = go If
|
|||||||
where go s = term <$ symbol s <*> children (Statement.If <$> statement <*> (term <$> many statement) <*> (go Elsif <|> term <$ symbol Else <*> children (many statement)))
|
where go s = term <$ symbol s <*> children (Statement.If <$> statement <*> (term <$> many statement) <*> (go Elsif <|> term <$ symbol Else <*> children (many statement)))
|
||||||
|
|
||||||
ifModifier :: Assignment Grammar (Term Syntax ())
|
ifModifier :: Assignment Grammar (Term Syntax ())
|
||||||
ifModifier = term <$ symbol IfModifier <*> children (flip Statement.If <$> statement <*> expr <*> pure (term Syntax.Empty))
|
ifModifier = term <$ symbol IfModifier <*> children (flip Statement.If <$> statement <*> statement <*> pure (term Syntax.Empty))
|
||||||
|
|
||||||
unless :: Assignment Grammar (Term Syntax ())
|
unless :: Assignment Grammar (Term Syntax ())
|
||||||
unless = term <$ symbol Unless <*> children (Statement.If <$> (term . Expression.Not <$> statement) <*> (term <$> many statement) <*> (term <$ symbol Else <*> children (many statement)))
|
unless = term <$ symbol Unless <*> children (Statement.If <$> (term . Expression.Not <$> statement) <*> (term <$> many statement) <*> (term <$ symbol Else <*> children (many statement)))
|
||||||
|
|
||||||
expr :: Assignment Grammar (Term Syntax ())
|
|
||||||
expr = literal
|
|
||||||
|
|
||||||
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