From 39fb7115a568844b3075ff1a6a775c919d428e0e Mon Sep 17 00:00:00 2001 From: Mu Qiao Date: Mon, 26 Mar 2012 16:24:07 +0800 Subject: Parser: allow ';' after local and export --- bashast/bashast.g | 2 +- bashast/gunit/simp_prog.gunit | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index c6d7f34..c836047 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -471,7 +471,7 @@ scope { : ( (LPAREN) => LPAREN { ++$builtin_variable_definition_item::parens; } |(RPAREN) => RPAREN { --$builtin_variable_definition_item::parens; } - |(~EOL) => expansion_base + |(~(EOL|SEMIC)) => expansion_base | {LA(1) == EOL && $builtin_variable_definition_item::parens > 0}? => EOL )+; diff --git a/bashast/gunit/simp_prog.gunit b/bashast/gunit/simp_prog.gunit index e765ab0..e44c1e5 100644 --- a/bashast/gunit/simp_prog.gunit +++ b/bashast/gunit/simp_prog.gunit @@ -36,3 +36,5 @@ hello () { hello quit echo foo" -> (LIST (COMMAND (FUNCTION (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit)))))) (COMMAND (FUNCTION (STRING hello) (CURRENT_SHELL (LIST (COMMAND (STRING echo) (STRING Hello !)))))) (COMMAND (STRING hello)) (COMMAND (STRING quit)) (COMMAND (STRING echo) (STRING foo))) + +"export abc;echo" -> (LIST (COMMAND (STRING export) (STRING abc)) (COMMAND (STRING echo))) -- cgit v1.2.3-65-gdbad