aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-21 10:24:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-21 10:24:56 +0000
commit62ec5eb01874472e2df9d871ef329d5a76b9c853 (patch)
treeef0aef4c83f8e0cc32ec7bf18acbf4e94f13abe3
parent12afc11fcda570118c03e88cbb72521e33c38f78 (diff)
downloadruby-62ec5eb01874472e2df9d871ef329d5a76b9c853.tar.gz
parse.y: more token names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--bootstraptest/test_literal_suffix.rb6
-rw-r--r--parse.y25
-rw-r--r--test/ruby/test_parse.rb2
3 files changed, 25 insertions, 8 deletions
diff --git a/bootstraptest/test_literal_suffix.rb b/bootstraptest/test_literal_suffix.rb
index 4316c9e040..c36fa7078f 100644
--- a/bootstraptest/test_literal_suffix.rb
+++ b/bootstraptest/test_literal_suffix.rb
@@ -46,9 +46,9 @@ assert_equal '1', '1rescue nil'
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}
diff --git a/parse.y b/parse.y
index 701497c733..b72a71f502 100644
--- a/parse.y
+++ b/parse.y
@@ -826,9 +826,21 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in
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 parser_params *p, const char *token, token_in
%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
/*
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index c7aeeecb61..1345dabc6e 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1079,7 +1079,7 @@ x = __ENCODING__
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]