summaryrefslogtreecommitdiff
path: root/Shell/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Shell/Parser.cpp')
-rw-r--r--Shell/Parser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Shell/Parser.cpp b/Shell/Parser.cpp
index c19f2d3664..4a56761f65 100644
--- a/Shell/Parser.cpp
+++ b/Shell/Parser.cpp
@@ -420,19 +420,19 @@ RefPtr<AST::Node> Parser::parse_list_expression()
consume_while(is_whitespace);
auto rule_start = push_start();
+ Vector<RefPtr<AST::Node>> nodes;
- auto expr = parse_expression();
- if (!expr)
- return nullptr;
+ do {
+ auto expr = parse_expression();
+ if (!expr)
+ break;
+ nodes.append(move(expr));
+ } while (!consume_while(is_whitespace).is_empty());
- if (consume_while(is_whitespace).is_empty())
- return expr;
-
- auto list = parse_list_expression();
- if (!list)
- return create<AST::CastToList>(move(expr));
+ if (nodes.is_empty())
+ return nullptr;
- return create<AST::ListConcatenate>(move(expr), move(list)); // Join Element List
+ return create<AST::ListConcatenate>(move(nodes)); // Concatenate List
}
RefPtr<AST::Node> Parser::parse_expression()