summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-30 14:17:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-30 14:17:31 +0000
commitb602f6516fd290a1cf4867b5edc299ed3cbc2241 (patch)
tree41886ef659de97762c585ac4da310e5ebdeb368d /parse.y
parent1fcb7a5ee0f346f755735d349a405eeccf81fc40 (diff)
* parse.y (command_asgn): allow command_call to be right hand side
expression of chained assignment. [ruby-dev:42313] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y33
1 files changed, 23 insertions, 10 deletions
diff --git a/parse.y b/parse.y
index e085088731..1c500525ec 100644
--- a/parse.y
+++ b/parse.y
@@ -690,7 +690,7 @@ static void token_info_pop(struct parser_params*, const char *token);
%type <node> args call_args opt_call_args
%type <node> paren_args opt_paren_args
%type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs
-%type <node> mrhs superclass block_call block_command
+%type <node> command_asgn mrhs superclass block_call block_command
%type <node> f_block_optarg f_block_opt
%type <node> f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs
%type <node> assoc_list assocs assoc undef_list backref string_dvar for_var
@@ -1060,15 +1060,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
$$ = dispatch1(END, $3);
%*/
}
- | lhs '=' command_call
- {
- /*%%%*/
- value_expr($3);
- $$ = node_assign($1, $3);
- /*%
- $$ = dispatch2(assign, $1, $3);
- %*/
- }
+ | command_asgn
| mlhs '=' command_call
{
/*%%%*/
@@ -1225,6 +1217,27 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
| expr
;
+command_asgn : lhs '=' command_call
+ {
+ /*%%%*/
+ value_expr($3);
+ $$ = node_assign($1, $3);
+ /*%
+ $$ = dispatch2(assign, $1, $3);
+ %*/
+ }
+ | lhs '=' command_asgn
+ {
+ /*%%%*/
+ value_expr($3);
+ $$ = node_assign($1, $3);
+ /*%
+ $$ = dispatch2(assign, $1, $3);
+ %*/
+ }
+ ;
+
+
expr : command_call
| expr keyword_and expr
{