From 7195fb871665c8b286c76ae0935372c8f5d8f8bc Mon Sep 17 00:00:00 2001 From: Masamitsu MURASE Date: Sun, 20 Jan 2013 17:05:43 +0900 Subject: Modify handling of NODE_UNDEF to accept multiple arguments. --- src/parse.y | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/parse.y') diff --git a/src/parse.y b/src/parse.y index 403db1cc8..a2864b02c 100644 --- a/src/parse.y +++ b/src/parse.y @@ -570,7 +570,7 @@ new_const(parser_state *p, mrb_sym sym) static node* new_undef(parser_state *p, mrb_sym sym) { - return cons((node*)NODE_UNDEF, nsym(sym)); + return list2((node*)NODE_UNDEF, nsym(sym)); } // (:class class super body) @@ -917,7 +917,7 @@ var_reference(parser_state *p, node *lhs) %type assoc_list assocs assoc undef_list backref for_var %type block_param opt_block_param block_param_def f_opt %type bv_decls opt_bv_decl bvar f_larglist lambda_body -%type brace_block cmd_brace_block do_block lhs none fitem f_bad_arg +%type brace_block cmd_brace_block do_block lhs none f_bad_arg %type mlhs mlhs_list mlhs_post mlhs_basic mlhs_item mlhs_node mlhs_inner %type fsym sym basic_symbol operation operation2 operation3 %type cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg @@ -1485,19 +1485,13 @@ fsym : fname | basic_symbol ; -fitem : fsym - { - $$ = new_sym(p, $1); - } - ; - undef_list : fsym { $$ = new_undef(p, $1); } - | undef_list ',' {p->lstate = EXPR_FNAME;} fitem + | undef_list ',' {p->lstate = EXPR_FNAME;} fsym { - $$ = push($1, (node*)$4); + $$ = push($1, nsym($4)); } ; @@ -5458,8 +5452,15 @@ parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_UNDEF: - printf("NODE_UNDEF %s:\n", - mrb_sym2name(mrb, sym(tree))); + printf("NODE_UNDEF"); + { + node *t = tree; + while (t) { + printf(" %s", mrb_sym2name(mrb, sym(t->car))); + t = t->cdr; + } + } + printf(":\n"); break; case NODE_CLASS: -- cgit v1.2.3