From 6404756744b9230da6d755b456c6922c1693301a Mon Sep 17 00:00:00 2001 From: André Aparício Date: Thu, 12 Jul 2012 22:30:48 +0100 Subject: Parser&Walker: Escape '[' and ']' --- bashast/bashast.g | 4 +++- bashast/libbashWalker.g | 2 ++ scripts/command_execution.bash | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bashast/bashast.g b/bashast/bashast.g index 3ce2c8e..61c7e57 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -786,7 +786,7 @@ ns_string_part |OTHER|EQUALS|PCT|PCTPCT|PLUS|MINUS|DOT|DOTDOT|COLON |TILDE|LSQUARE|RSQUARE|CARET|POUND|COMMA|EXPORT|LOCAL|DECLARE|AT // Escaped characters - |ESC_RPAREN|ESC_LPAREN|ESC_DOLLAR|ESC_GT|ESC_LT|ESC_TICK|ESC_DQUOTE + |ESC_RPAREN|ESC_LPAREN|ESC_RSQUARE|ESC_LSQUARE|ESC_DOLLAR|ESC_GT|ESC_LT|ESC_TICK|ESC_DQUOTE // The following is for filename expansion |TIMES|QMARK; @@ -1160,6 +1160,8 @@ LOGICOR : '||'; CONTINUE_LINE : (ESC EOL)+{$channel=HIDDEN;}; ESC_RPAREN : ESC RPAREN; ESC_LPAREN : ESC LPAREN; +ESC_RSQUARE : ESC RSQUARE; +ESC_LSQUARE : ESC LSQUARE; ESC_DOLLAR : ESC DOLLAR; ESC_TICK : ESC TICK; COMMAND_SUBSTITUTION_PAREN diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 27377de..9c85f9d 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -462,6 +462,8 @@ options {backtrack = true;} } :ESC_RPAREN { $libbash_value = ")"; } |ESC_LPAREN { $libbash_value = "("; } + |ESC_RSQUARE { $libbash_value = "]"; } + |ESC_LSQUARE { $libbash_value = "["; } |ESC_DOLLAR { $libbash_value = "$"; } |ESC_DQUOTE { $libbash_value = "\""; } |ESC_GT { $libbash_value = ">"; } diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash index 3b275ca..1cc837b 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -96,6 +96,7 @@ eval abc+=\( \"\$@\" \) declare MOZILLA_FIVE_HOME="/usr/share/${PN}" declare foo=23 empty bar=42 echo $MOZILLA_FIVE_HOME $foo $lol $bar +echo \(\)\[\]\$\"\> FILE=scripts/input_output_test echo foo > $FILE -- cgit v1.2.3-65-gdbad