aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-07-12 22:30:48 +0100
committerAndré Aparício <aparicio99@gmail.com>2012-08-03 01:03:41 +0100
commit6404756744b9230da6d755b456c6922c1693301a (patch)
tree795dfe7b24decc0791163c2eff5045434283e48e /bashast
parentParser&Walker: Support redirection (diff)
downloadlibbash-6404756744b9230da6d755b456c6922c1693301a.tar.gz
libbash-6404756744b9230da6d755b456c6922c1693301a.tar.bz2
libbash-6404756744b9230da6d755b456c6922c1693301a.zip
Parser&Walker: Escape '[' and ']'
Diffstat (limited to 'bashast')
-rw-r--r--bashast/bashast.g4
-rw-r--r--bashast/libbashWalker.g2
2 files changed, 5 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 = ">"; }