From a7df78509333d91e3c8b373c08f05b31b8bc186b Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Fri, 21 Jul 2017 15:00:39 -0700 Subject: [PATCH] flatten expressionList for single element lists --- src/Language/Python/Syntax.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index fb8cea5c3..102574d8d 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -175,6 +175,11 @@ expressionStatement = mk <$> symbol ExpressionStatement <*> children (some expre where mk _ [child] = child 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 = makeTerm <$> symbol ListSplatArgument <*> (Syntax.Identifier <$> source) <|> makeTerm <$> symbol DictionarySplatArgument <*> (Syntax.Identifier <$> source) @@ -277,10 +282,6 @@ keyword = makeTerm <$> symbol KeywordIdentifier <*> children (Syntax.Identifier tuple :: Assignment 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 = symbol UnaryOperator >>= \ location -> arithmetic location <|> bitwise location <|> children ( symbol AnonPlus *> expression ) where