mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
Add conditional
This commit is contained in:
parent
0285cf4939
commit
e7e1898c66
@ -86,12 +86,14 @@ statement = -- handleError $
|
||||
<|> mk Break Statement.Break
|
||||
<|> mk Next Statement.Continue
|
||||
<|> for
|
||||
-- <|> assignment'
|
||||
<|> class'
|
||||
<|> method
|
||||
<|> identifier
|
||||
<|> literal
|
||||
<|> scopeResolution
|
||||
<|> conditional
|
||||
-- <|> assignment'
|
||||
-- TODO: rescue
|
||||
where mk s construct = makeTerm <$> symbol s <*> children ((construct .) . fromMaybe <$> emptyTerm <*> optional (symbol ArgumentList *> children statement))
|
||||
|
||||
statements :: Assignment
|
||||
@ -198,6 +200,9 @@ for = makeTerm <$> symbol For <*> children (Statement.ForEach <$> identifier <*>
|
||||
-- <|> makeTerm <$> symbol AnonLAngleLAngleEqual <*> (Expression.LShift var <$> expression)
|
||||
-- <|> makeTerm <$> symbol AnonCaretEqual <*> (Expression.BXOr var <$> expression)))
|
||||
|
||||
conditional :: Assignment
|
||||
conditional = makeTerm <$> symbol Conditional <*> children (Statement.If <$> statement <*> statement <*> statement)
|
||||
|
||||
emptyStatement :: Assignment
|
||||
emptyStatement = makeTerm <$> symbol EmptyStatement <*> (Syntax.Empty <$> (Just <$> source))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user