Fix here-doc inside parens and brackets; fix #4796

parent fdc0219d
...@@ -1620,7 +1620,7 @@ command_asgn : lhs '=' command_rhs ...@@ -1620,7 +1620,7 @@ command_asgn : lhs '=' command_rhs
{ {
$$ = new_op_asgn(p, $1, $2, $3); $$ = new_op_asgn(p, $1, $2, $3);
} }
| primary_value '[' opt_call_args rbracket tOP_ASGN command_rhs | primary_value '[' opt_call_args ']' tOP_ASGN command_rhs
{ {
$$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6); $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
} }
...@@ -1849,7 +1849,7 @@ mlhs_node : variable ...@@ -1849,7 +1849,7 @@ mlhs_node : variable
{ {
assignable(p, $1); assignable(p, $1);
} }
| primary_value '[' opt_call_args rbracket | primary_value '[' opt_call_args ']'
{ {
$$ = new_call(p, $1, intern("[]",2), $3, '.'); $$ = new_call(p, $1, intern("[]",2), $3, '.');
} }
...@@ -1888,7 +1888,7 @@ lhs : variable ...@@ -1888,7 +1888,7 @@ lhs : variable
{ {
assignable(p, $1); assignable(p, $1);
} }
| primary_value '[' opt_call_args rbracket | primary_value '[' opt_call_args ']'
{ {
$$ = new_call(p, $1, intern("[]",2), $3, '.'); $$ = new_call(p, $1, intern("[]",2), $3, '.');
} }
...@@ -2028,7 +2028,7 @@ arg : lhs '=' arg_rhs ...@@ -2028,7 +2028,7 @@ arg : lhs '=' arg_rhs
{ {
$$ = new_op_asgn(p, $1, $2, $3); $$ = new_op_asgn(p, $1, $2, $3);
} }
| primary_value '[' opt_call_args rbracket tOP_ASGN arg_rhs | primary_value '[' opt_call_args ']' tOP_ASGN arg_rhs
{ {
$$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6); $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
} }
...@@ -2226,7 +2226,7 @@ arg_rhs : arg %prec tOP_ASGN ...@@ -2226,7 +2226,7 @@ arg_rhs : arg %prec tOP_ASGN
} }
; ;
paren_args : '(' opt_call_args rparen paren_args : '(' opt_call_args ')'
{ {
$$ = $2; $$ = $2;
} }
...@@ -2237,18 +2237,18 @@ opt_paren_args : none ...@@ -2237,18 +2237,18 @@ opt_paren_args : none
; ;
opt_call_args : none opt_call_args : none
| call_args | call_args opt_terms
| args ',' | args comma
{ {
$$ = cons($1,0); $$ = cons($1,0);
NODE_LINENO($$, $1); NODE_LINENO($$, $1);
} }
| args comma assocs ',' | args comma assocs comma
{ {
$$ = cons(push($1, new_kw_hash(p, $3)), 0); $$ = cons(push($1, new_kw_hash(p, $3)), 0);
NODE_LINENO($$, $1); NODE_LINENO($$, $1);
} }
| assocs ',' | assocs comma
{ {
$$ = cons(list1(new_kw_hash(p, $1)), 0); $$ = cons(list1(new_kw_hash(p, $1)), 0);
NODE_LINENO($$, $1); NODE_LINENO($$, $1);
...@@ -2929,7 +2929,7 @@ method_call : operation paren_args ...@@ -2929,7 +2929,7 @@ method_call : operation paren_args
{ {
$$ = new_zsuper(p); $$ = new_zsuper(p);
} }
| primary_value '[' opt_call_args rbracket | primary_value '[' opt_call_args ']'
{ {
$$ = new_call(p, $1, intern("[]",2), $3, '.'); $$ = new_call(p, $1, intern("[]",2), $3, '.');
} }
...@@ -3725,11 +3725,8 @@ opt_nl : /* none */ ...@@ -3725,11 +3725,8 @@ opt_nl : /* none */
rparen : opt_nl ')' rparen : opt_nl ')'
; ;
rbracket : opt_nl ']'
;
trailer : /* none */ trailer : /* none */
| nl | terms
| comma | comma
; ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment