summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y28
1 files changed, 19 insertions, 9 deletions
diff --git a/parse.y b/parse.y
index 2f530edb761..da36f28d72d 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);
}