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

ruby-changes:54680

From: nobu <ko1@a...>
Date: Mon, 21 Jan 2019 19:25:01 +0900 (JST)
Subject: [ruby-changes:54680] nobu:r66896 (trunk): parse.y: more token names

nobu	2019-01-21 19:24:56 +0900 (Mon, 21 Jan 2019)

  New Revision: 66896

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

  Log:
    parse.y: more token names

  Modified files:
    trunk/bootstraptest/test_literal_suffix.rb
    trunk/parse.y
    trunk/test/ruby/test_parse.rb
Index: parse.y
===================================================================
--- parse.y	(revision 66895)
+++ parse.y	(revision 66896)
@@ -826,9 +826,21 @@ static void token_info_warn(struct parse https://github.com/ruby/ruby/blob/trunk/parse.y#L826
         keyword__FILE__      "__FILE__"
         keyword__ENCODING__  "__ENCODING__"
 
-%token <id>   tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
-%token <node> tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
-%token <node> tNTH_REF tBACK_REF
+%token <id>   tIDENTIFIER    "local variable or method"
+%token <id>   tFID           "method"
+%token <id>   tGVAR          "global variable"
+%token <id>   tIVAR          "instance variable"
+%token <id>   tCONSTANT      "constant"
+%token <id>   tCVAR          "class variable"
+%token <id>   tLABEL
+%token <node> tINTEGER       "integer literal"
+%token <node> tFLOAT         "float literal"
+%token <node> tRATIONAL      "rational literal"
+%token <node> tIMAGINARY     "imaginary literal"
+%token <node> tCHAR          "char literal"
+%token <node> tNTH_REF       "numbered reference"
+%token <node> tBACK_REF      "back reference"
+%token <node> tSTRING_CONTENT
 %token <num>  tREGEXP_END
 
 %type <node> singleton strings string string1 xstring regexp
@@ -902,7 +914,12 @@ static void token_info_warn(struct parse https://github.com/ruby/ruby/blob/trunk/parse.y#L914
 %token tLAMBDA		"->"
 %token tSYMBEG		"symbol literal"
 %token tSTRING_BEG	"string literal"
-%token tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
+%token tXSTRING_BEG	"backtick literal"
+%token tREGEXP_BEG	"regexp literal"
+%token tWORDS_BEG	"word list"
+%token tQWORDS_BEG	"verbatim word list"
+%token tSYMBOLS_BEG	"symbol list"
+%token tQSYMBOLS_BEG	"verbatim symbol list"
 %token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG tLABEL_END
 
 /*
Index: bootstraptest/test_literal_suffix.rb
===================================================================
--- bootstraptest/test_literal_suffix.rb	(revision 66895)
+++ bootstraptest/test_literal_suffix.rb	(revision 66896)
@@ -46,9 +46,9 @@ assert_equal '1',               '1rescue https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_literal_suffix.rb#L46
 assert_equal '10000000000000000001/10000000000000000000',
              '1.0000000000000000001r'
 
-assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+assert_equal 'syntax error, unexpected local variable or method, expecting end-of-input',
              %q{begin eval('1ir', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
-assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+assert_equal 'syntax error, unexpected local variable or method, expecting end-of-input',
              %q{begin eval('1.2ir', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
-assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+assert_equal 'syntax error, unexpected local variable or method, expecting end-of-input',
              %q{begin eval('1e1r', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 66895)
+++ test/ruby/test_parse.rb	(revision 66896)
@@ -1079,7 +1079,7 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1079
   end
 
   def test_truncated_source_line
-    e = assert_raise_with_message(SyntaxError, /unexpected tIDENTIFIER/) do
+    e = assert_raise_with_message(SyntaxError, /unexpected local variable or method/) do
       eval("'0123456789012345678901234567890123456789' abcdefghijklmnopqrstuvwxyz0123456789 0123456789012345678901234567890123456789")
     end
     line = e.message.lines[1]

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

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