summaryrefslogtreecommitdiffhomepage
path: root/src/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-01-20 14:32:40 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-01-20 14:32:40 -0800
commitcc16bd7c0d70b326ddcf8de8a511116dae9fc30d (patch)
treeaad0bb92b5b983815527db305d2616244d6d71a1 /src/parse.y
parentaaf5f3a0f556626bd401519846cca58d31c99716 (diff)
parentd16659c7a5c532d9313f3e501743f322a0055dc4 (diff)
downloadmruby-cc16bd7c0d70b326ddcf8de8a511116dae9fc30d.tar.gz
mruby-cc16bd7c0d70b326ddcf8de8a511116dae9fc30d.zip
Merge pull request #754 from masamitsu-murase/modify_undef_node
Modify handling of NODE_UNDEF.
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/parse.y b/src/parse.y
index 1cb8741f2..1ca3385f5 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 <nd> assoc_list assocs assoc undef_list backref for_var
%type <nd> block_param opt_block_param block_param_def f_opt
%type <nd> bv_decls opt_bv_decl bvar f_larglist lambda_body
-%type <nd> brace_block cmd_brace_block do_block lhs none fitem f_bad_arg
+%type <nd> brace_block cmd_brace_block do_block lhs none f_bad_arg
%type <nd> mlhs mlhs_list mlhs_post mlhs_basic mlhs_item mlhs_node mlhs_inner
%type <id> fsym sym basic_symbol operation operation2 operation3
%type <id> 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));
}
;
@@ -5462,8 +5456,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: