aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2012-03-26 16:24:07 +0800
committerMu Qiao <qiaomuf@gentoo.org>2012-03-26 16:35:47 +0800
commit39fb7115a568844b3075ff1a6a775c919d428e0e (patch)
tree1236a99bfb4b887c720a63cf5e1d169e748323ba
parentWalker: fix single quoted argument handling (diff)
downloadlibbash-39fb7115a568844b3075ff1a6a775c919d428e0e.tar.gz
libbash-39fb7115a568844b3075ff1a6a775c919d428e0e.tar.bz2
libbash-39fb7115a568844b3075ff1a6a775c919d428e0e.zip
Parser: allow ';' after local and export
-rw-r--r--bashast/bashast.g2
-rw-r--r--bashast/gunit/simp_prog.gunit2
2 files changed, 3 insertions, 1 deletions
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)))