[前][次][番号順一覧][スレッド一覧]

ruby-changes:55101

From: nobu <ko1@a...>
Date: Wed, 20 Mar 2019 09:31:09 +0900 (JST)
Subject: [ruby-changes:55101] nobu:r67308 (trunk): parse.y: make tNUMPARAM id

nobu	2019-03-20 09:31:02 +0900 (Wed, 20 Mar 2019)

  New Revision: 67308

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67308

  Log:
    parse.y: make tNUMPARAM id

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 67307)
+++ parse.y	(revision 67308)
@@ -862,6 +862,7 @@ static void token_info_warn(struct parse https://github.com/ruby/ruby/blob/trunk/parse.y#L862
 %token <id>   tCONSTANT      "constant"
 %token <id>   tCVAR          "class variable"
 %token <id>   tLABEL
+%token <id>   tNUMPARAM      "numbered parameter"
 %token <node> tINTEGER       "integer literal"
 %token <node> tFLOAT         "float literal"
 %token <node> tRATIONAL      "rational literal"
@@ -871,7 +872,6 @@ static void token_info_warn(struct parse https://github.com/ruby/ruby/blob/trunk/parse.y#L872
 %token <node> tBACK_REF      "back reference"
 %token <node> tSTRING_CONTENT "literal content"
 %token <num>  tREGEXP_END
-%token <num>  tNUMPARAM      "numbered parameter"
 
 %type <node> singleton strings string string1 xstring regexp
 %type <node> string_contents xstring_contents regexp_contents string_content
@@ -3820,11 +3820,9 @@ string_dvar	: tGVAR https://github.com/ruby/ruby/blob/trunk/parse.y#L3820
 		    }
 		| tNUMPARAM
 		    {
-			ID id = numparam_id(p, get_num($1));
 		    /*%%%*/
-			$$ = NEW_DVAR(id, &@1);
+			$$ = NEW_DVAR($1, &@1);
 		    /*% %*/
-			(void)id;
 		    /*% ripper: var_ref!($1) %*/
 		    }
 		| backref
@@ -3883,14 +3881,6 @@ user_variable	: tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L3881
 		| tCONSTANT
 		| tCVAR
 		| tNUMPARAM
-		    {
-			ID id = numparam_id(p, get_num($1));
-		    /*%%%*/
-			$$ = id;
-		    /*%
-			$$ = ripper_new_yylval(p, id, get_value($1), 0);
-		    %*/
-		    }
 		;
 
 keyword_variable: keyword_nil {$$ = KWD2EID(nil, $1);}
@@ -7663,7 +7653,7 @@ parser_numbered_param(struct parser_para https://github.com/ruby/ruby/blob/trunk/parse.y#L7653
 	compile_error(p, "ordinary parameter is defined");
 	return false;
     }
-    set_yylval_num((int)n);
+    set_yylval_name(numparam_id(p, (int)n));
     SET_LEX_STATE(EXPR_ARG);
     return true;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]