1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

flatten expressionList for single element lists

This commit is contained in:
Timothy Clem 2017-07-21 15:00:39 -07:00
parent fed576137d
commit a7df785093

View File

@ -175,6 +175,11 @@ expressionStatement = mk <$> symbol ExpressionStatement <*> children (some expre
where mk _ [child] = child where mk _ [child] = child
mk location children = makeTerm location children mk location children = makeTerm location children
expressionList :: Assignment
expressionList = mk <$> symbol ExpressionList <*> children (some expression)
where mk _ [child] = child
mk location children = makeTerm location children
argument :: Assignment argument :: Assignment
argument = makeTerm <$> symbol ListSplatArgument <*> (Syntax.Identifier <$> source) argument = makeTerm <$> symbol ListSplatArgument <*> (Syntax.Identifier <$> source)
<|> makeTerm <$> symbol DictionarySplatArgument <*> (Syntax.Identifier <$> source) <|> makeTerm <$> symbol DictionarySplatArgument <*> (Syntax.Identifier <$> source)
@ -277,10 +282,6 @@ keyword = makeTerm <$> symbol KeywordIdentifier <*> children (Syntax.Identifier
tuple :: Assignment tuple :: Assignment
tuple = makeTerm <$> symbol Tuple <*> children (Literal.Tuple <$> many expression) tuple = makeTerm <$> symbol Tuple <*> children (Literal.Tuple <$> many expression)
-- TODO: Consider flattening single element lists
expressionList :: Assignment
expressionList = makeTerm <$> symbol ExpressionList <*> children (many expression)
unaryOperator :: Assignment unaryOperator :: Assignment
unaryOperator = symbol UnaryOperator >>= \ location -> arithmetic location <|> bitwise location <|> children ( symbol AnonPlus *> expression ) unaryOperator = symbol UnaryOperator >>= \ location -> arithmetic location <|> bitwise location <|> children ( symbol AnonPlus *> expression )
where where