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:
parent
fed576137d
commit
a7df785093
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user