aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2012-03-01 16:30:32 +0800
committerMu Qiao <qiaomuf@gentoo.org>2012-03-01 16:30:32 +0800
commit19f82f9686e67da79b9f265f8baf228223d069b4 (patch)
tree24737721c0c2095b0938bfb3d5632f88156e3831 /bashast/bashast.g
parentParser: allow empty replacement pattern (diff)
downloadlibbash-19f82f9686e67da79b9f265f8baf228223d069b4.tar.gz
libbash-19f82f9686e67da79b9f265f8baf228223d069b4.tar.bz2
libbash-19f82f9686e67da79b9f265f8baf228223d069b4.zip
Parser: Allow EOLs in builtin array definition
Diffstat (limited to 'bashast/bashast.g')
-rw-r--r--bashast/bashast.g13
1 files changed, 12 insertions, 1 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 73249ef..92f4f92 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -461,7 +461,18 @@ array_atom
);
builtin_variable_definition_item
- : ((~EOL) => expansion_base)+;
+scope {
+ int parens;
+}
+@init {
+ $builtin_variable_definition_item::parens = 0;
+}
+ : (
+ (LPAREN) => LPAREN { ++$builtin_variable_definition_item::parens; }
+ |(RPAREN) => RPAREN { --$builtin_variable_definition_item::parens; }
+ |(~EOL) => expansion_base
+ | {LA(1) == EOL && $builtin_variable_definition_item::parens > 0}? => EOL
+ )+;
#ifdef OUTPUT_C
builtin_variable_definitions[bool local]