From 5602cdb716ff205eeb5c77cf0c28f9013a91eda9 Mon Sep 17 00:00:00 2001 From: MR-BH <73834224+MR-BH@users.noreply.github.com> Date: Thu, 18 May 2023 17:30:27 +0800 Subject: [PATCH] Update Python3Parser.g4 fix case like: ``` print(0) print(1) ``` cause error Parse error: { startLine: 2, endLine: 2, startCol: 8, endCol: 13, message: "no viable alternative at input ''" } --- python/python3/Python3Parser.g4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/python3/Python3Parser.g4 b/python/python3/Python3Parser.g4 index e4486de76b..47706dc257 100644 --- a/python/python3/Python3Parser.g4 +++ b/python/python3/Python3Parser.g4 @@ -68,7 +68,7 @@ varargslist: (vfpdef ('=' test)? (',' vfpdef ('=' test)?)* (',' ( vfpdef: name; stmt: simple_stmts | compound_stmt; -simple_stmts: simple_stmt (';' simple_stmt)* ';'? NEWLINE; +simple_stmts: simple_stmt (';' simple_stmt)* ';'? NEWLINE?; simple_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt); expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |