diff options
author | 2012-07-12 22:30:48 +0100 | |
---|---|---|
committer | 2012-08-03 01:03:41 +0100 | |
commit | 6404756744b9230da6d755b456c6922c1693301a (patch) | |
tree | 795dfe7b24decc0791163c2eff5045434283e48e | |
parent | Parser&Walker: Support redirection (diff) | |
download | libbash-6404756744b9230da6d755b456c6922c1693301a.tar.gz libbash-6404756744b9230da6d755b456c6922c1693301a.tar.bz2 libbash-6404756744b9230da6d755b456c6922c1693301a.zip |
Parser&Walker: Escape '[' and ']'
-rw-r--r-- | bashast/bashast.g | 4 | ||||
-rw-r--r-- | bashast/libbashWalker.g | 2 | ||||
-rw-r--r-- | scripts/command_execution.bash | 1 |
3 files changed, 6 insertions, 1 deletions
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 |