mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix here-doc inside parens and brackets; fix #4796
This commit is contained in:
@@ -1620,7 +1620,7 @@ command_asgn : lhs '=' command_rhs
|
||||
{
|
||||
$$ = 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);
|
||||
}
|
||||
@@ -1849,7 +1849,7 @@ mlhs_node : variable
|
||||
{
|
||||
assignable(p, $1);
|
||||
}
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
| primary_value '[' opt_call_args ']'
|
||||
{
|
||||
$$ = new_call(p, $1, intern("[]",2), $3, '.');
|
||||
}
|
||||
@@ -1888,7 +1888,7 @@ lhs : variable
|
||||
{
|
||||
assignable(p, $1);
|
||||
}
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
| primary_value '[' opt_call_args ']'
|
||||
{
|
||||
$$ = new_call(p, $1, intern("[]",2), $3, '.');
|
||||
}
|
||||
@@ -2028,7 +2028,7 @@ arg : lhs '=' arg_rhs
|
||||
{
|
||||
$$ = 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);
|
||||
}
|
||||
@@ -2226,7 +2226,7 @@ arg_rhs : arg %prec tOP_ASGN
|
||||
}
|
||||
;
|
||||
|
||||
paren_args : '(' opt_call_args rparen
|
||||
paren_args : '(' opt_call_args ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
@@ -2237,18 +2237,18 @@ opt_paren_args : none
|
||||
;
|
||||
|
||||
opt_call_args : none
|
||||
| call_args
|
||||
| args ','
|
||||
| call_args opt_terms
|
||||
| args comma
|
||||
{
|
||||
$$ = cons($1,0);
|
||||
NODE_LINENO($$, $1);
|
||||
}
|
||||
| args comma assocs ','
|
||||
| args comma assocs comma
|
||||
{
|
||||
$$ = cons(push($1, new_kw_hash(p, $3)), 0);
|
||||
NODE_LINENO($$, $1);
|
||||
}
|
||||
| assocs ','
|
||||
| assocs comma
|
||||
{
|
||||
$$ = cons(list1(new_kw_hash(p, $1)), 0);
|
||||
NODE_LINENO($$, $1);
|
||||
@@ -2929,7 +2929,7 @@ method_call : operation paren_args
|
||||
{
|
||||
$$ = new_zsuper(p);
|
||||
}
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
| primary_value '[' opt_call_args ']'
|
||||
{
|
||||
$$ = new_call(p, $1, intern("[]",2), $3, '.');
|
||||
}
|
||||
@@ -3725,11 +3725,8 @@ opt_nl : /* none */
|
||||
rparen : opt_nl ')'
|
||||
;
|
||||
|
||||
rbracket : opt_nl ']'
|
||||
;
|
||||
|
||||
trailer : /* none */
|
||||
| nl
|
||||
| terms
|
||||
| comma
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user