ruby-changes:49856
From: nobu <ko1@a...>
Date: Sat, 20 Jan 2018 14:39:11 +0900 (JST)
Subject: [ruby-changes:49856] nobu:r61974 (trunk): dsl.rb: const_missing
nobu 2018-01-20 14:39:01 +0900 (Sat, 20 Jan 2018) New Revision: 61974 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61974 Log: dsl.rb: const_missing * ext/ripper/tools/dsl.rb (DSL.const_missing): define to expand Qnil and Qundef as-is. Modified files: trunk/ext/ripper/tools/dsl.rb trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61973) +++ parse.y (revision 61974) @@ -1472,14 +1472,14 @@ mlhs_basic : mlhs_head https://github.com/ruby/ruby/blob/trunk/parse.y#L1472 /*%%%*/ $$ = NEW_MASGN($1, NODE_SPECIAL_NO_NAME_REST, &@$); /*% %*/ - /*% ripper: mlhs_add_star!($1, "Qnil") %*/ + /*% ripper: mlhs_add_star!($1, Qnil) %*/ } | mlhs_head tSTAR ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN($1, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $4, &@$), &@$); /*% %*/ - /*% ripper: mlhs_add_post!(mlhs_add_star!($1, "Qnil"), $4) %*/ + /*% ripper: mlhs_add_post!(mlhs_add_star!($1, Qnil), $4) %*/ } | tSTAR mlhs_node { @@ -1500,14 +1500,14 @@ mlhs_basic : mlhs_head https://github.com/ruby/ruby/blob/trunk/parse.y#L1500 /*%%%*/ $$ = NEW_MASGN(0, NODE_SPECIAL_NO_NAME_REST, &@$); /*% %*/ - /*% ripper: mlhs_add_star!(mlhs_new!, "Qnil") %*/ + /*% ripper: mlhs_add_star!(mlhs_new!, Qnil) %*/ } | tSTAR ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN(0, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $3, &@$), &@$); /*% %*/ - /*% ripper: mlhs_add_post!(mlhs_add_star!(mlhs_new!, "Qnil"), $3) %*/ + /*% ripper: mlhs_add_post!(mlhs_add_star!(mlhs_new!, Qnil), $3) %*/ } ; @@ -2429,7 +2429,7 @@ primary : literal https://github.com/ruby/ruby/blob/trunk/parse.y#L2429 /*%%%*/ $$ = NEW_CASE2($3, &@$); /*% %*/ - /*% ripper: case!("Qnil", $3) %*/ + /*% ripper: case!(Qnil, $3) %*/ } | k_for for_var keyword_in expr_value_do compstmt @@ -2798,14 +2798,14 @@ f_margs : f_marg_list https://github.com/ruby/ruby/blob/trunk/parse.y#L2798 /*%%%*/ $$ = NEW_MASGN($1, NODE_SPECIAL_NO_NAME_REST, &@$); /*% %*/ - /*% ripper: mlhs_add_star!($1, "Qnil") %*/ + /*% ripper: mlhs_add_star!($1, Qnil) %*/ } | f_marg_list ',' tSTAR ',' f_marg_list { /*%%%*/ $$ = NEW_MASGN($1, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $5, &@$), &@$); /*% %*/ - /*% ripper: mlhs_add_post!(mlhs_add_star!($1, "Qnil"), $5) %*/ + /*% ripper: mlhs_add_post!(mlhs_add_star!($1, Qnil), $5) %*/ } | tSTAR f_norm_arg { @@ -2826,14 +2826,14 @@ f_margs : f_marg_list https://github.com/ruby/ruby/blob/trunk/parse.y#L2826 /*%%%*/ $$ = NEW_MASGN(0, NODE_SPECIAL_NO_NAME_REST, &@$); /*% %*/ - /*% ripper: mlhs_add_star!(mlhs_new!, "Qnil") %*/ + /*% ripper: mlhs_add_star!(mlhs_new!, Qnil) %*/ } | tSTAR ',' f_marg_list { /*%%%*/ $$ = NEW_MASGN(0, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $3, &@$), &@$); /*% %*/ - /*% ripper: mlhs_add_post!(mlhs_add_star!(mlhs_new!, "Qnil"), $3) %*/ + /*% ripper: mlhs_add_post!(mlhs_add_star!(mlhs_new!, Qnil), $3) %*/ } ; @@ -2942,14 +2942,14 @@ block_param_def : '|' opt_bv_decl '|' https://github.com/ruby/ruby/blob/trunk/parse.y#L2942 /*%%%*/ $$ = 0; /*% %*/ - /*% ripper: block_var!("params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil)", escape_Qundef($2)) %*/ + /*% ripper: block_var!(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil), escape_Qundef($2)) %*/ } | tOROP { /*%%%*/ $$ = 0; /*% %*/ - /*% ripper: block_var!("params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil)", "Qnil") %*/ + /*% ripper: block_var!(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil), Qnil) %*/ } | '|' block_param opt_bv_decl '|' { @@ -3695,7 +3695,7 @@ superclass : '<' https://github.com/ruby/ruby/blob/trunk/parse.y#L3695 /*%%%*/ $$ = 0; /*% %*/ - /*% ripper: "Qnil" %*/ + /*% ripper: Qnil %*/ } ; @@ -4004,7 +4004,7 @@ f_kwrest : kwrest_mark tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L4004 $$ = internal_id(p); arg_var(p, $$); /*% %*/ - /*% ripper: kwrest_param!("Qnil") %*/ + /*% ripper: kwrest_param!(Qnil) %*/ } ; @@ -4078,7 +4078,7 @@ f_rest_arg : restarg_mark tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L4078 $$ = internal_id(p); arg_var(p, $$); /*% %*/ - /*% ripper: rest_param!("Qnil") %*/ + /*% ripper: rest_param!(Qnil) %*/ } ; @@ -4105,7 +4105,7 @@ opt_f_block_arg : ',' f_block_arg https://github.com/ruby/ruby/blob/trunk/parse.y#L4105 /*%%%*/ $$ = 0; /*% %*/ - /*% ripper: "Qundef" %*/ + /*% ripper: Qundef %*/ } ; Index: ext/ripper/tools/dsl.rb =================================================================== --- ext/ripper/tools/dsl.rb (revision 61973) +++ ext/ripper/tools/dsl.rb (revision 61974) @@ -47,5 +47,9 @@ class DSL https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/dsl.rb#L47 "#{ event }(#{ args.join(", ") })" end end + + def self.const_missing(name) + name + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/