1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00

Elide comments from comprehensions

This commit is contained in:
Rick Winfrey 2017-08-01 17:02:50 -07:00
parent f486f2c41a
commit a2bb8479a3

View File

@ -461,7 +461,7 @@ comprehension = makeTerm <$> symbol GeneratorExpression <*> children (comprehen
<|> makeTerm <$> symbol DictionaryComprehension <*> children (comprehensionDeclaration keyValue)
where
keyValue = makeTerm <$> location <*> (Literal.KeyValue <$> expression <*> expression)
comprehensionDeclaration preceeding = Declaration.Comprehension <$> preceeding <* symbol Variables <*> children (many expression) <*> (flip (foldr makeComprehension) <$> many nestedComprehension <*> expression)
comprehensionDeclaration preceeding = Declaration.Comprehension <$ many comment <*> preceeding <* symbol Variables <*> children (many expression) <*> (flip (foldr makeComprehension) <$> many nestedComprehension <*> expression)
makeComprehension (loc, makeRest) rest = makeTerm loc (makeRest rest)
nestedComprehension = (,) <$> location <*> (Declaration.Comprehension <$> expression <* symbol Variables <*> children (many expression))