diff options
author | Petteri Räty <petsku@petteriraty.eu> | 2011-06-09 20:11:18 +0300 |
---|---|---|
committer | Petteri Räty <petsku@petteriraty.eu> | 2011-06-10 17:44:07 +0300 |
commit | 51ebf80929749cd1962e3e5b845c4346d41daafb (patch) | |
tree | b3fbd0f78a414e0f204c203c557a59cbb848e71f /bashast/bashast.g | |
parent | Parser: handle appending to arrays (diff) | |
download | libbash-51ebf80929749cd1962e3e5b845c4346d41daafb.tar.gz libbash-51ebf80929749cd1962e3e5b845c4346d41daafb.tar.bz2 libbash-51ebf80929749cd1962e3e5b845c4346d41daafb.zip |
Parser: fix handling ))
Having the special token confused statements like array=($(echo))
where the two parenthesis are part of different constructs.
Diffstat (limited to 'bashast/bashast.g')
-rw-r--r-- | bashast/bashast.g | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g index a8d44d5..269fcfd 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -200,7 +200,7 @@ compound_command | cond_comparison; //Expressions allowed inside a compound command for_expr: FOR BLANK+ name (wspace IN (BLANK+ fname)+)? semiel DO wspace* clist semiel DONE -> ^(FOR name (fname+)? clist) - | FOR BLANK* LLPAREN EOL? (BLANK* init=arithmetic BLANK*|BLANK+)? (SEMIC (BLANK? fcond=arithmetic BLANK*|BLANK+)? SEMIC|DOUBLE_SEMIC) (BLANK* mod=arithmetic)? wspace* RRPAREN semiel DO wspace clist semiel DONE + | FOR BLANK* LLPAREN EOL? (BLANK* init=arithmetic BLANK*|BLANK+)? (SEMIC (BLANK? fcond=arithmetic BLANK*|BLANK+)? SEMIC|DOUBLE_SEMIC) (BLANK* mod=arithmetic)? wspace* RPAREN RPAREN semiel DO wspace clist semiel DONE -> ^(CFOR ^(FOR_INIT $init)? ^(FOR_COND $fcond)? clist ^(FOR_MOD $mod)?) ; sel_expr: SELECT BLANK+ name (wspace IN BLANK+ word)? semiel DO wspace* clist semiel DONE -> ^(SELECT name (word)? clist) @@ -235,7 +235,7 @@ current_shell : LBRACE wspace clist semiel wspace* RBRACE redirect? -> ^(CURRENT_SHELL clist redirect?); //comparison using arithmetic arith_comparison - : LLPAREN wspace? arithmetic wspace? RRPAREN -> ^(COMPOUND_ARITH arithmetic); + : LLPAREN wspace? arithmetic wspace? RPAREN RPAREN -> ^(COMPOUND_ARITH arithmetic); cond_comparison : cond_expr -> ^(COMPOUND_COND cond_expr); //Variables @@ -554,13 +554,13 @@ arithmetics : arithmetic (COMMA! BLANK!* arithmetic)*; //explicit arithmetic in places like array indexes explicit_arithmetic - : (DOLLAR LLPAREN BLANK*)? arithmetics RRPAREN? -> arithmetics + : (DOLLAR LLPAREN BLANK*)? arithmetics (RPAREN RPAREN)? -> arithmetics | (DOLLAR LSQUARE BLANK*)? arithmetics RSQUARE? -> arithmetics; //Arithmetic expansion //the square bracket from is deprecated //http://permalink.gmane.org/gmane.comp.shells.bash.bugs/14479 arithmetic_expansion - : DOLLAR LLPAREN BLANK* arithmetics BLANK* RRPAREN -> ^(ARITHMETIC_EXPRESSION arithmetics) + : DOLLAR LLPAREN BLANK* arithmetics BLANK* RPAREN RPAREN -> ^(ARITHMETIC_EXPRESSION arithmetics) | DOLLAR LSQUARE BLANK* arithmetics BLANK* RSQUARE -> ^(ARITHMETIC_EXPRESSION arithmetics); process_substitution @@ -613,7 +613,6 @@ TIME : 'time'; RPAREN : ')'; LPAREN : '('; LLPAREN : '(('; -RRPAREN : '))'; LSQUARE : '['; RSQUARE : ']'; TICK : '`'; |