From 6ad90f5ad4961b26287c87c2d34056829c59755d Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 3 Jul 2000 05:46:36 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 2f530edb76..da36f28d72 100644 --- a/parse.y +++ b/parse.y @@ -426,7 +426,6 @@ expr : mlhs '=' mrhs } | '!' command_call { - value_expr($2); $$ = NEW_NOT(cond($2)); } | arg @@ -849,13 +848,25 @@ arg : lhs '=' arg $$ = $1; } -aref_args : opt_call_args +aref_args : none + | args opt_nl { - if ($1 && nd_type($1) == NODE_BLOCK_PASS) { - rb_compile_error("block argument should not be given"); - } $$ = $1; } + | args ',' opt_nl + { + $$ = $1; + } + | args ',' tSTAR arg opt_nl + { + value_expr($4); + $$ = arg_concat($1, $4); + } + | tSTAR arg opt_nl + { + value_expr($2); + $$ = NEW_RESTARGS($2); + } opt_call_args : none | call_args opt_nl @@ -864,10 +875,6 @@ call_args : command_call { $$ = NEW_LIST($1); } - | args ',' - { - $$ = $1; - } | args ',' command_call { $$ = list_append($1, $3); @@ -878,6 +885,7 @@ call_args : command_call } | args ',' tSTAR arg opt_block_arg { + value_expr($4); $$ = arg_concat($1, $4); $$ = arg_blk_pass($$, $5); } @@ -892,6 +900,7 @@ call_args : command_call } | assocs ',' tSTAR arg opt_block_arg { + value_expr($4); $$ = arg_concat(NEW_LIST(NEW_HASH($1)), $4); $$ = arg_blk_pass($$, $5); } @@ -906,6 +915,7 @@ call_args : command_call } | args ',' assocs ',' tSTAR arg opt_block_arg { + value_expr($6); $$ = arg_concat(list_append($1, NEW_HASH($3)), $6); $$ = arg_blk_pass($$, $7); } -- cgit v1.2.3