ruby-changes:22950
From: nobu <ko1@a...>
Date: Tue, 13 Mar 2012 22:00:38 +0900 (JST)
Subject: [ruby-changes:22950] nobu:r34999 (trunk): * compile.c (iseq_set_arguments): keyword rest arg without keyword args.
nobu 2012-03-13 22:00:17 +0900 (Tue, 13 Mar 2012) New Revision: 34999 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34999 Log: * compile.c (iseq_set_arguments): keyword rest arg without keyword args. * node.c (dump_node): dump kw_rest_arg too. * parse.y (block_param, f_arg): more kwrest patterns. [ruby-core:42455][Bug #5989] * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. Modified files: trunk/ChangeLog trunk/compile.c trunk/node.c trunk/parse.y trunk/test/ruby/test_syntax.rb trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34998) +++ ChangeLog (revision 34999) @@ -1,3 +1,14 @@ +Tue Mar 13 22:00:14 2012 Nobuyoshi Nakada <nobu@r...> + + * compile.c (iseq_set_arguments): keyword rest arg without keyword args. + + * node.c (dump_node): dump kw_rest_arg too. + + * parse.y (block_param, f_arg): more kwrest patterns. + [ruby-core:42455][Bug #5989] + + * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. + Tue Mar 13 15:17:03 2012 Nobuyoshi Nakada <nobu@r...> * parse.y (block_param, f_args): add rules for the case arguments Index: compile.c =================================================================== --- compile.c (revision 34998) +++ compile.c (revision 34999) @@ -1166,6 +1166,12 @@ } ADD_INSN(optargs, nd_line(args->kw_args), pop); } + else if (args->kw_rest_arg) { + iseq->arg_keyword = get_dyna_var_idx_at_raw(iseq, args->kw_rest_arg->nd_vid); + COMPILE(optargs, "kwarg", args->kw_rest_arg); + iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK; + ADD_INSN(optargs, nd_line(args->kw_rest_arg), pop); + } else { iseq->arg_keyword = -1; } @@ -4992,17 +4998,17 @@ ADD_INSN1(ret, nd_line(node), putobject, ID2SYM(id)); ADD_SEND(ret, nd_line(node), ID2SYM(rb_intern("delete")), INT2FIX(1)); switch (nd_type(node->nd_body)) { - case NODE_LASGN: - idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id); - ADD_INSN1(ret, nd_line(node), setlocal, INT2FIX(idx)); - break; - case NODE_DASGN: - case NODE_DASGN_CURR: - idx = get_dyna_var_idx(iseq, id, &lv, &ls); - ADD_INSN2(ret, nd_line(node), setdynamic, INT2FIX(ls - idx), INT2FIX(lv)); - break; - default: - rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body))); + case NODE_LASGN: + idx = iseq->local_iseq->local_size - get_local_var_idx(iseq, id); + ADD_INSN1(ret, nd_line(node), setlocal, INT2FIX(idx)); + break; + case NODE_DASGN: + case NODE_DASGN_CURR: + idx = get_dyna_var_idx(iseq, id, &lv, &ls); + ADD_INSN2(ret, nd_line(node), setdynamic, INT2FIX(ls - idx), INT2FIX(lv)); + break; + default: + rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body))); } ADD_INSNL(ret, nd_line(node), jump, end_label); ADD_LABEL(ret, default_label); Index: parse.y =================================================================== --- parse.y (revision 34998) +++ parse.y (revision 34999) @@ -373,8 +373,10 @@ static NODE *call_uni_op_gen(struct parser_params*,NODE*,ID); #define call_uni_op(recv,id) call_uni_op_gen(parser, (recv),(id)) -static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,NODE*,ID,ID); -#define new_args(f,o,r,p,k,kr,b) new_args_gen(parser, (f),(o),(r),(p),(k),(kr),(b)) +static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,NODE*); +#define new_args(f,o,r,p,t) new_args_gen(parser, (f),(o),(r),(p),(t)) +static NODE *new_args_tail_gen(struct parser_params*,NODE*,ID,ID); +#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b)) static NODE *negate_lit(NODE*); static NODE *ret_args_gen(struct parser_params*,NODE*); @@ -541,6 +543,19 @@ #define params_new(pars, opts, rest, pars2, kws, kwrest, blk) \ dispatch7(params, (pars), (opts), (rest), (pars2), (kws), (kwrest), (blk)) +static inline VALUE +new_args(VALUE f, VALUE o, VALUE r, VALUE p, NODE *t) +{ + VALUE k = t->u1.value, kr = t->u2.value, b = t->u3.value; + return params_new(f, o, r, p, k, kr, escape_Qundef(b)); +} + +static inline NODE * +new_args_tail(VALUE k, VALUE kr, VALUE b) +{ + return rb_node_newnode(NODE_MEMO, k, kr, b); +} + #define blockvar_new(p,v) dispatch2(block_var, (p), (v)) #define blockvar_add_star(l,a) dispatch2(block_var_add_star, (l), (a)) #define blockvar_add_block(l,a) dispatch2(block_var_add_block, (l), (a)) @@ -556,8 +571,10 @@ #endif /* RIPPER */ #ifndef RIPPER +# define Qnone 0 # define ifndef_ripper(x) (x) #else +# define Qnone Qnil # define ifndef_ripper(x) #endif @@ -693,7 +710,7 @@ %type <node> expr_value arg_value primary_value %type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure %type <node> args call_args opt_call_args -%type <node> paren_args opt_paren_args +%type <node> paren_args opt_paren_args args_tail opt_args_tail block_args_tail opt_block_args_tail %type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs %type <node> command_asgn mrhs superclass block_call block_command %type <node> f_block_optarg f_block_opt @@ -2918,7 +2935,7 @@ 0), node_assign($2, NEW_DVAR(id))); - args = new_args(m, 0, id, 0, 0, 0, 0); + args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0)); } else { if (nd_type($2) == NODE_LASGN || @@ -2927,11 +2944,11 @@ $2->nd_value = NEW_DVAR(id); m->nd_plen = 1; m->nd_next = $2; - args = new_args(m, 0, 0, 0, 0, 0, 0); + args = new_args(m, 0, 0, 0, new_args_tail(0, 0, 0)); } else { m->nd_next = node_assign(NEW_MASGN(NEW_LIST($2), 0), NEW_DVAR(id)); - args = new_args(m, 0, id, 0, 0, 0, 0); + args = new_args(m, 0, id, 0, new_args_tail(0, 0, 0)); } } scope = NEW_NODE(NODE_SCOPE, tbl, $8, args); @@ -3335,359 +3352,98 @@ } ; -block_param : f_arg ',' f_block_optarg ',' f_rest_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + +block_args_tail : f_block_kwarg ',' f_kwrest opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, $7, $8, $9); - /*% - $$ = params_new($1, $3, $5, Qnil, $7, $8, escape_Qundef($9)); - %*/ + $$ = new_args_tail($1, $3, $4); } - | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_block_kwarg opt_f_block_arg + | f_block_kwarg opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, $7, 0, $8); - /*% - $$ = params_new($1, $3, $5, Qnil, $7, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args_tail($1, Qnone, $2); } - | f_arg ',' f_block_optarg ',' f_rest_arg opt_f_block_arg + | f_kwrest opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, 0, 0, $6); - /*% - $$ = params_new($1, $3, $5, Qnil, Qnil, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args_tail(Qnone, $1, $2); } - | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + | f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, $9, $10, $11); - /*% - $$ = params_new($1, $3, $5, $7, $9, $10, escape_Qundef($11)); - %*/ + $$ = new_args_tail(Qnone, Qnone, $1); } - | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg ',' f_block_kwarg opt_f_block_arg + ; + +opt_block_args_tail : ',' block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, $9, 0, $10); - /*% - $$ = params_new($1, $3, $5, $7, $9, Qnil, escape_Qundef($10)); - %*/ + $$ = $2; } - | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg + | /* none */ { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, 0, 0, $8); - /*% - $$ = params_new($1, $3, $5, $7, Qnil, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args_tail(Qnone, Qnone, Qnone); } - | f_arg ',' f_block_optarg ',' f_block_kwarg f_kwrest opt_f_block_arg + ; +block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, 0, $5, $6, $7); - /*% - $$ = params_new($1, $3, Qnil, Qnil, $5, $6, escape_Qundef($7)); - %*/ + $$ = new_args($1, $3, $5, Qnone, $6); } - | f_arg ',' f_block_optarg ',' f_block_kwarg opt_f_block_arg + | f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, 0, $5, 0, $6); - /*% - $$ = params_new($1, $3, Qnil, Qnil, $5, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args($1, $3, $5, $7, $8); } - | f_arg ',' f_block_optarg opt_f_block_arg + | f_arg ',' f_block_optarg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, 0, 0, 0, $4); - /*% - $$ = params_new($1, $3, Qnil, Qnil, Qnil, Qnil, escape_Qundef($4)); - %*/ + $$ = new_args($1, $3, Qnone, Qnone, $4); } - | f_arg ',' f_block_optarg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + | f_arg ',' f_block_optarg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, $5, $7, $8, $9); - /*% - $$ = params_new($1, $3, Qnil, $5, $7, $8, escape_Qundef($9)); - %*/ + $$ = new_args($1, $3, Qnone, $5, $6); } - | f_arg ',' f_block_optarg ',' f_arg ',' f_block_kwarg opt_f_block_arg + | f_arg ',' f_rest_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, $5, $7, 0, $8); - /*% - $$ = params_new($1, $3, Qnil, $5, $7, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args($1, Qnone, $3, Qnone, $4); } - | f_arg ',' f_block_optarg ',' f_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args($1, $3, 0, $5, 0, 0, $6); - /*% - $$ = params_new($1, $3, Qnil, $5, Qnil, Qnil, escape_Qundef($6)); - %*/ - } - | f_arg ',' f_rest_arg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args($1, 0, $3, 0, $5, $6, $7); - /*% - $$ = params_new($1, Qnil, $3, Qnil, $5, $6, escape_Qundef($7)); - %*/ - } - | f_arg ',' f_rest_arg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args($1, 0, $3, 0, $5, 0, $6); - /*% - $$ = params_new($1, Qnil, $3, Qnil, $5, Qnil, escape_Qundef($6)); - %*/ - } - | f_arg ',' f_rest_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args($1, 0, $3, 0, 0, 0, $4); - /*% - $$ = params_new($1, Qnil, $3, Qnil, Qnil, Qnil, escape_Qundef($4)); - %*/ - } | f_arg ',' { + $$ = new_args($1, Qnone, 1, Qnone, new_args_tail(Qnone, Qnone, Qnone)); /*%%%*/ - $$ = new_args($1, 0, 1, 0, 0, 0, 0); /*% - $$ = params_new($1, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil); dispatch1(excessed_comma, $$); %*/ } - | f_arg ',' f_rest_arg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + | f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, $3, $5, $7, $8, $9); - /*% - $$ = params_new($1, Qnil, $3, $5, $7, $8, escape_Qundef($9)); - %*/ + $$ = new_args($1, Qnone, $3, $5, $6); } - | f_arg ',' f_rest_arg ',' f_arg ',' f_block_kwarg opt_f_block_arg + | f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, $3, $5, $7, 0, $8); - /*% - $$ = params_new($1, Qnil, $3, $5, $7, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args($1, Qnone, Qnone, Qnone, $2); } - | f_arg ',' f_rest_arg ',' f_arg opt_f_block_arg + | f_block_optarg ',' f_rest_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, $3, $5, 0, 0, $6); - /*% - $$ = params_new($1, Qnil, $3, $5, Qnil, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args(Qnone, $1, $3, Qnone, $4); } - | f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + | f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, 0, 0, $3, $4, $5); - /*% - $$ = params_new($1, Qnil,Qnil, Qnil, $3, $4, escape_Qundef($5)); - %*/ + $$ = new_args(Qnone, $1, $3, $5, $6); } - | f_arg ',' f_block_kwarg opt_f_block_arg + | f_block_optarg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, 0, 0, $3, 0, $4); - /*% - $$ = params_new($1, Qnil,Qnil, Qnil, $3, Qnil, escape_Qundef($4)); - %*/ + $$ = new_args(Qnone, $1, Qnone, Qnone, $2); } - | f_arg opt_f_block_arg + | f_block_optarg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args($1, 0, 0, 0, 0, 0, $2); - /*% - $$ = params_new($1, Qnil,Qnil, Qnil, Qnil, Qnil, escape_Qundef($2)); - %*/ + $$ = new_args(Qnone, $1, Qnone, $3, $4); } - | f_block_optarg ',' f_rest_arg ',' f_block_kwarg f_kwrest opt_f_block_arg + | f_rest_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args(0, $1, $3, 0, $5, $6, $7); - /*% - $$ = params_new(Qnil, $1, $3, Qnil, $5, $6, escape_Qundef($7)); - %*/ + $$ = new_args(Qnone, Qnone, $1, Qnone, $2); } - | f_block_optarg ',' f_rest_arg ',' f_block_kwarg opt_f_block_arg + | f_rest_arg ',' f_arg opt_block_args_tail { - /*%%%*/ - $$ = new_args(0, $1, $3, 0, $5, 0, $6); - /*% - $$ = params_new(Qnil, $1, $3, Qnil, $5, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args(Qnone, Qnone, $1, $3, $4); } - | f_block_optarg ',' f_rest_arg opt_f_block_arg + | block_args_tail { - /*%%%*/ - $$ = new_args(0, $1, $3, 0, 0, 0, $4); - /*% - $$ = params_new(Qnil, $1, $3, Qnil, Qnil, Qnil, escape_Qundef($4)); - %*/ + $$ = new_args(Qnone, Qnone, Qnone, Qnone, $1); } - | f_block_optarg ',' f_rest_arg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, $3, $5, $7, $8, $9); - /*% - $$ = params_new(Qnil, $1, $3, $5, $7, $8, escape_Qundef($9)); - %*/ - } - | f_block_optarg ',' f_rest_arg ',' f_arg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, $3, $5, $7, 0, $8); - /*% - $$ = params_new(Qnil, $1, $3, $5, $7, Qnil, escape_Qundef($8)); - %*/ - } - | f_block_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, $3, $5, 0, 0, $6); - /*% - $$ = params_new(Qnil, $1, $3, $5, Qnil, Qnil, escape_Qundef($6)); - %*/ - } - | f_block_optarg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, 0, $3, $4, $5); - /*% - $$ = params_new(Qnil, $1, Qnil, Qnil, $3, $4, escape_Qundef($5)); - %*/ - } - | f_block_optarg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, 0, $3, 0, $4); - /*% - $$ = params_new(Qnil, $1, Qnil, Qnil, $3, Qnil, escape_Qundef($4)); - %*/ - } - | f_block_optarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, 0, 0, 0, $2); - /*% - $$ = params_new(Qnil, $1, Qnil, Qnil, Qnil, Qnil, escape_Qundef($2)); - %*/ - } - | f_block_optarg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, $3, $5, $6, $7); - /*% - $$ = params_new(Qnil, $1, Qnil, $3, $5, $6, escape_Qundef($7)); - %*/ - } - | f_block_optarg ',' f_arg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, $3, $5, 0, $6); - /*% - $$ = params_new(Qnil, $1, Qnil, $3, $5, Qnil, escape_Qundef($6)); - %*/ - } - | f_block_optarg ',' f_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, $1, 0, $3, 0, 0, $4); - /*% - $$ = params_new(Qnil, $1, Qnil, $3, Qnil, Qnil, escape_Qundef($4)); - %*/ - } - | f_rest_arg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, 0, $3, $4, $5); - /*% - $$ = params_new(Qnil, Qnil, $1, Qnil, $3, $4, escape_Qundef($5)); - %*/ - } - | f_rest_arg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, 0, $3, 0, $4); - /*% - $$ = params_new(Qnil, Qnil, $1, Qnil, $3, Qnil, escape_Qundef($4)); - %*/ - } - | f_rest_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, 0, 0, 0, $2); - /*% - $$ = params_new(Qnil, Qnil, $1, Qnil, Qnil, Qnil, escape_Qundef($2)); - %*/ - } - | f_rest_arg ',' f_arg ',' f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, $3, $5, $6, $7); - /*% - $$ = params_new(Qnil, Qnil, $1, $3, $5, $6, escape_Qundef($7)); - %*/ - } - | f_rest_arg ',' f_arg ',' f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, $3, $5, 0, $6); - /*% - $$ = params_new(Qnil, Qnil, $1, $3, $5, Qnil, escape_Qundef($6)); - %*/ - } - | f_rest_arg ',' f_arg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, $1, $3, 0, 0, $4); - /*% - $$ = params_new(Qnil, Qnil, $1, $3, Qnil, Qnil, escape_Qundef($4)); - %*/ - } - | f_block_kwarg f_kwrest opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, 0, 0, $1, $2, $3); - /*% - $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1, $2, escape_Qundef($3)); - %*/ - } - | f_block_kwarg opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, 0, 0, $1, 0, $2); - /*% - $$ = params_new(Qnil, Qnil, Qnil, Qnil, $1, Qnil, escape_Qundef($2)); - %*/ - } - | tPOW tIDENTIFIER opt_f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, 0, 0, 0, $2, $3); - /*% - $$ = params_new(Qnil, Qnil, Qnil, Qnil, Qnil, $2, escape_Qundef($3)); - %*/ - } - | f_block_arg - { - /*%%%*/ - $$ = new_args(0, 0, 0, 0, 0, 0, $1); - /*% - $$ = params_new(Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, $1); - %*/ - } ; opt_block_param : none @@ -4674,357 +4430,94 @@ } ; -f_args : f_arg ',' f_optarg ',' f_rest_arg ',' f_kwarg f_kwrest opt_f_block_arg +args_tail : f_kwarg ',' f_kwrest opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, $7, $8, $9); - /*% - $$ = params_new($1, $3, $5, Qnil, $7, $8, escape_Qundef($9)); - %*/ + $$ = new_args_tail($1, $3, $4); } - | f_arg ',' f_optarg ',' f_rest_arg ',' f_kwarg opt_f_block_arg + | f_kwarg opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, $7, 0, $8); - /*% - $$ = params_new($1, $3, $5, Qnil, $7, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args_tail($1, Qnone, $2); } - | f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg + | f_kwrest opt_f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, 0, 0, 0, $6); - /*% - $$ = params_new($1, $3, $5, Qnil, Qnil, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args_tail(Qnone, $1, $2); } - | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg ',' f_kwarg f_kwrest opt_f_block_arg + | f_block_arg { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, $9, $10, $11); - /*% - $$ = params_new($1, $3, $5, $7, $9, $10, escape_Qundef($11)); - %*/ + $$ = new_args_tail(Qnone, Qnone, $1); } - | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg ',' f_kwarg opt_f_block_arg + ; + +opt_args_tail : ',' args_tail { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, $9, 0, $10); - /*% - $$ = params_new($1, $3, $5, $7, $9, Qnil, escape_Qundef($10)); - %*/ + $$ = $2; } - | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg opt_f_block_arg + | /* none */ { - /*%%%*/ - $$ = new_args($1, $3, $5, $7, 0, 0, $8); - /*% - $$ = params_new($1, $3, $5, $7, Qnil, Qnil, escape_Qundef($8)); - %*/ + $$ = new_args_tail(Qnone, Qnone, Qnone); } - | f_arg ',' f_optarg ',' f_kwarg f_kwrest opt_f_block_arg + ; + +f_args : f_arg ',' f_optarg ',' f_rest_arg opt_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, 0, $5, $6, $7); - /*% - $$ = params_new($1, $3, Qnil, Qnil, $5, $6, escape_Qundef($7)); - %*/ + $$ = new_args($1, $3, $5, Qnone, $6); } - | f_arg ',' f_optarg ',' f_kwarg opt_f_block_arg + | f_arg ',' f_optarg ',' f_rest_arg ',' f_arg opt_args_tail { - /*%%%*/ - $$ = new_args($1, $3, 0, 0, $5, 0, $6); - /*% - $$ = params_new($1, $3, Qnil, Qnil, $5, Qnil, escape_Qundef($6)); - %*/ + $$ = new_args($1, $3, $5 (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/