зеркало из https://github.com/github/ruby.git
parse.y: more token names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
12afc11fcd
Коммит
62ec5eb018
|
@ -46,9 +46,9 @@ assert_equal '1', '1rescue nil'
|
||||||
assert_equal '10000000000000000001/10000000000000000000',
|
assert_equal '10000000000000000001/10000000000000000000',
|
||||||
'1.0000000000000000001r'
|
'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}
|
%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}
|
%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}
|
%q{begin eval('1e1r', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
|
||||||
|
|
25
parse.y
25
parse.y
|
@ -826,9 +826,21 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in
|
||||||
keyword__FILE__ "__FILE__"
|
keyword__FILE__ "__FILE__"
|
||||||
keyword__ENCODING__ "__ENCODING__"
|
keyword__ENCODING__ "__ENCODING__"
|
||||||
|
|
||||||
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
|
%token <id> tIDENTIFIER "local variable or method"
|
||||||
%token <node> tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
|
%token <id> tFID "method"
|
||||||
%token <node> tNTH_REF tBACK_REF
|
%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
|
%token <num> tREGEXP_END
|
||||||
|
|
||||||
%type <node> singleton strings string string1 xstring regexp
|
%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 tLAMBDA "->"
|
||||||
%token tSYMBEG "symbol literal"
|
%token tSYMBEG "symbol literal"
|
||||||
%token tSTRING_BEG "string 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
|
%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG tLABEL_END
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1079,7 +1079,7 @@ x = __ENCODING__
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_truncated_source_line
|
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")
|
eval("'0123456789012345678901234567890123456789' abcdefghijklmnopqrstuvwxyz0123456789 0123456789012345678901234567890123456789")
|
||||||
end
|
end
|
||||||
line = e.message.lines[1]
|
line = e.message.lines[1]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче