From c7d585c7c7e6028f8dcb9a26f0827cfec34c6005 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 5 Dec 2000 09:36:54 +0000 Subject: matz git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index e767ea237..112130631 100644 --- a/parse.y +++ b/parse.y @@ -188,7 +188,7 @@ static void top_local_setup(); %type if_tail opt_else case_body cases rescue exc_list exc_var ensure %type opt_call_args call_args ret_args args when_args %type aref_args opt_block_arg block_arg stmt_rhs -%type mrhs superclass generic_call block_call var_ref +%type mrhs mrhs_basic superclass generic_call block_call var_ref %type f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg %type assoc_list assocs assoc undef_list backref %type block_var opt_block_var brace_block do_block lhs none @@ -407,6 +407,10 @@ stmt : block_call $1->nd_value = $3; $$ = $1; } + | lhs '=' mrhs_basic + { + $$ = node_assign($1, $3); + } | expr expr : mlhs '=' mrhs @@ -1009,17 +1013,17 @@ args : arg $$ = list_append($1, $3); } -mrhs : args +mrhs : arg { - if ($1 && - nd_type($1) == NODE_ARRAY && - $1->nd_next == 0) - { - $$ = $1->nd_head; - } - else { - $$ = $1; - } + value_expr($1); + $$ = $1; + } + | mrhs_basic + +mrhs_basic : args ',' arg + { + value_expr($1); + $$ = list_append($1, $3); } | args ',' tSTAR arg { @@ -1211,7 +1215,7 @@ primary : literal compstmt kEND { - value_expr($2); + value_expr($5); $$ = NEW_FOR($2, $5, $8); fixpos($$, $2); } @@ -1357,11 +1361,11 @@ block_var : lhs opt_block_var : none | '|' /* none */ '|' { - $$ = 0; + $$ = (NODE*)1; } | tOROP { - $$ = 0; + $$ = (NODE*)1; } | '|' block_var '|' { @@ -1390,7 +1394,7 @@ brace_block : '{' compstmt '}' { $$ = NEW_ITER($3, 0, $4); - fixpos($$, $3?$3:$4); + fixpos($$, $4); dyna_pop($2); } | kDO2 @@ -1402,7 +1406,7 @@ brace_block : '{' kEND { $$ = NEW_ITER($3, 0, $4); - fixpos($$, $3?$3:$4); + fixpos($$, $4); dyna_pop($2); } -- cgit