* 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
This commit is contained in:
matz 2010-09-30 14:17:31 +00:00
parent 1fcb7a5ee0
commit b602f6516f
2 changed files with 28 additions and 10 deletions

View File

@ -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

33
parse.y
View File

@ -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
{