aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-08-07 15:53:36 +0100
committerAndré Aparício <aparicio99@gmail.com>2012-08-09 03:44:42 +0100
commit249c86b76e37e6057d27956337d5e84d61563498 (patch)
tree52a658ffa3370e650778b59899ff8c8e94635f75
parentWalker: Fix appending to an array of size 1 (diff)
downloadlibbash-249c86b76e37e6057d27956337d5e84d61563498.tar.gz
libbash-249c86b76e37e6057d27956337d5e84d61563498.tar.bz2
libbash-249c86b76e37e6057d27956337d5e84d61563498.zip
Parser: Support appending strings with special characters
-rw-r--r--bashast/bashast.g4
-rw-r--r--scripts/var_def.bash2
2 files changed, 4 insertions, 2 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 4438b8c..9fd3fdb 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -431,8 +431,8 @@ variable_definition_atom
-> ^(EQUALS ^(name explicit_arithmetic) string_expr?)
| name EQUALS value? -> ^(EQUALS name value?)
| name PLUS EQUALS array_value -> ^(PLUS_ASSIGN name array_value)
- | name PLUS EQUALS string_expr_part?
- -> ^(EQUALS name ^(STRING ^(VAR_REF name) string_expr_part?));
+ | name PLUS EQUALS string_expr_part*
+ -> ^(EQUALS name ^(STRING ^(VAR_REF name) string_expr_part*));
value
: string_expr
| array_value;
diff --git a/scripts/var_def.bash b/scripts/var_def.bash
index dc47b6c..b3ffca7 100644
--- a/scripts/var_def.bash
+++ b/scripts/var_def.bash
@@ -82,6 +82,8 @@ FOO005=abc
echo $FOO005
FOO005+=def
echo $FOO005
+FOO005+=-foo-bar
+echo $FOO005
function foo() {
local -i foo=1
local -a bar=(1 2 3)