Skip to content

Commit

Permalink
parse.y: fix chained assignments
Browse files Browse the repository at this point in the history
fix syntax errors with chained assignment with op assign.
reported [Bug:12669] in bugs.ruby-lang.org fixed in CRuby 2.4.
  • Loading branch information
nobu committed Aug 13, 2016
1 parent bee34fb commit bdd7e2b
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions mrbgems/mruby-compiler/core/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,25 @@ stmt : keyword_alias fsym {p->lstate = EXPR_FNAME;} fsym
{
$$ = new_masgn(p, $1, $3);
}
| lhs '=' mrhs
{
$$ = new_asgn(p, $1, new_array(p, $3));
}
| mlhs '=' arg_value
{
$$ = new_masgn(p, $1, $3);
}
| mlhs '=' mrhs
{
$$ = new_masgn(p, $1, new_array(p, $3));
}
| expr
;

command_asgn : lhs '=' command_rhs
{
$$ = new_asgn(p, $1, $3);
}
| var_lhs tOP_ASGN command_rhs
{
$$ = new_op_asgn(p, $1, $2, $3);
Expand Down Expand Up @@ -1348,25 +1367,6 @@ stmt : keyword_alias fsym {p->lstate = EXPR_FNAME;} fsym
backref_error(p, $1);
$$ = new_begin(p, 0);
}
| lhs '=' mrhs
{
$$ = new_asgn(p, $1, new_array(p, $3));
}
| mlhs '=' arg_value
{
$$ = new_masgn(p, $1, $3);
}
| mlhs '=' mrhs
{
$$ = new_masgn(p, $1, new_array(p, $3));
}
| expr
;

command_asgn : lhs '=' command_rhs
{
$$ = new_asgn(p, $1, $3);
}
;

command_rhs : command_call %prec tOP_ASGN
Expand Down

0 comments on commit bdd7e2b

Please sign in to comment.