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

Merge branch 'master' into opt-in-anonymous-nodes

This commit is contained in:
Rob Rix 2017-05-03 10:41:36 -04:00 committed by GitHub
commit 56aee672a9

View File

@ -97,9 +97,9 @@ comment :: Assignment (Node Grammar) (Term Syntax Location)
comment = leaf Comment Comment.Comment comment = leaf Comment Comment.Comment
if' :: Assignment (Node Grammar) (Term Syntax Location) if' :: Assignment (Node Grammar) (Term Syntax Location)
if' = go If if' = ifElsif If
<|> symbol IfModifier *> term <*> children (flip Statement.If <$> statement <*> statement <*> (term <*> pure Syntax.Empty)) <|> symbol IfModifier *> term <*> children (flip Statement.If <$> statement <*> statement <*> (term <*> pure Syntax.Empty))
where go s = symbol s *> term <*> children (Statement.If <$> statement <*> (term <*> many statement) <*> optional (go Elsif <|> symbol Else *> term <*> children (many statement))) where ifElsif s = symbol s *> term <*> children (Statement.If <$> statement <*> (term <*> many statement) <*> optional (ifElsif Elsif <|> symbol Else *> term <*> children (many statement)))
unless :: Assignment (Node Grammar) (Term Syntax Location) unless :: Assignment (Node Grammar) (Term Syntax Location)
unless = symbol Unless *> term <*> children (Statement.If <$> (term <*> (Expression.Not <$> statement)) <*> (term <*> many statement) <*> optional (symbol Else *> term <*> children (many statement))) unless = symbol Unless *> term <*> children (Statement.If <$> (term <*> (Expression.Not <$> statement)) <*> (term <*> many statement) <*> optional (symbol Else *> term <*> children (many statement)))