diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 33 |
2 files changed, 28 insertions, 10 deletions
@@ -3,6 +3,11 @@ Thu Sep 30 16:11:08 2010 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (rb_w32_getenv): should return NULL if specified name is empty. a patch from Heesob Park at [ruby-core:32650] +Thu Sep 30 15:18:23 2010 Yukihiro Matsumoto <matz@ruby-lang.org> + + * parse.y (command_asgn): allow command_call to be right hand side + expression of chained assignment. [ruby-dev:42313] + Thu Sep 30 10:55:38 2010 NAKAMURA Usaku <usa@ruby-lang.org> * hash.c (ruby_setenv): workaround for old Windows. a patch from @@ -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 { |