瀏覽代碼

Shell: Ignore leading semicolons

This makes things like `foo&; bar` behave as expected.
Such behaviour is actually closer to the grammar defined in Parser.h
anyway :P
AnotherTest 5 年之前
父節點
當前提交
58308748cb
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Shell/Parser.cpp

+ 1 - 1
Shell/Parser.cpp

@@ -144,7 +144,7 @@ RefPtr<AST::Node> Parser::parse_toplevel()
 
 
 RefPtr<AST::Node> Parser::parse_sequence()
 RefPtr<AST::Node> Parser::parse_sequence()
 {
 {
-    consume_while(is_any_of(" \t\n"));
+    consume_while(is_any_of(" \t\n;")); // ignore whitespaces or terminators without effect.
 
 
     auto rule_start = push_start();
     auto rule_start = push_start();
     auto var_decls = parse_variable_decls();
     auto var_decls = parse_variable_decls();