1
1
mirror of https://github.com/github/semantic.git synced 2025-01-01 19:55:34 +03:00

Delimit expressions with the else clause.

This commit is contained in:
Rob Rix 2017-08-08 14:19:25 -04:00
parent 7e7cc130d1
commit 26bf05bd30

View File

@ -216,7 +216,7 @@ withStatement = symbol WithStatement >>= \ loc -> children (mk loc <$> some with
<|> ((,) <$> expression <*> emptyTerm)
forStatement :: Assignment
forStatement = symbol ForStatement >>= \ loc -> children (make loc <$> (makeTerm <$> symbol Variables <*> children (many expression)) <*> expressionList <*> expressions <*> optional (makeTerm <$> symbol ElseClause <*> children (many expression)))
forStatement = symbol ForStatement >>= \ loc -> children (make loc <$> (makeTerm <$> symbol Variables <*> children (many expression)) <*> expressionList <*> (makeTerm <$> location <*> manyTill expression (void (symbol ElseClause) <|> eof)) <*> optional (makeTerm <$> symbol ElseClause <*> children (many expression)))
where
make loc binding subject body forElseClause = case forElseClause of
Nothing -> makeTerm loc (Statement.ForEach binding subject body)