mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: token name
* parse.y: more descriptive token names in syntax error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f4bc341b00
commit
89bcc681f0
3 changed files with 38 additions and 28 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Aug 20 23:02:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y: more descriptive token names in syntax error messages.
|
||||
|
||||
Mon Aug 20 20:36:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (vm_call_method): follow iclasses as klass in cfp
|
||||
|
|
|
@ -529,7 +529,7 @@ def assert_syntax_error expected, code, message = ''
|
|||
end
|
||||
assert_syntax_error "unterminated string meets end of file", '().."', '[ruby-dev:29732]'
|
||||
assert_equal %q{[]}, %q{$&;[]}, '[ruby-dev:31068]'
|
||||
assert_syntax_error "syntax error, unexpected tSTAR, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
|
||||
assert_syntax_error "syntax error, unexpected *, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
|
||||
assert_syntax_error "`@0' is not allowed as an instance variable name", %q{@0..0}, '[ruby-dev:31095]'
|
||||
assert_syntax_error "identifier $00 is not valid to get", %q{$00..0}, '[ruby-dev:31100]'
|
||||
assert_syntax_error "identifier $00 is not valid to set", %q{0..$00=1}
|
||||
|
|
60
parse.y
60
parse.y
|
@ -741,34 +741,40 @@ static void token_info_pop(struct parser_params*, const char *token);
|
|||
/*%
|
||||
%type <val> program reswords then do dot_or_colon
|
||||
%*/
|
||||
%token tUPLUS /* unary+ */
|
||||
%token tUMINUS /* unary- */
|
||||
%token tPOW /* ** */
|
||||
%token tCMP /* <=> */
|
||||
%token tEQ /* == */
|
||||
%token tEQQ /* === */
|
||||
%token tNEQ /* != */
|
||||
%token tGEQ /* >= */
|
||||
%token tLEQ /* <= */
|
||||
%token tANDOP tOROP /* && and || */
|
||||
%token tMATCH tNMATCH /* =~ and !~ */
|
||||
%token tDOT2 tDOT3 /* .. and ... */
|
||||
%token tAREF tASET /* [] and []= */
|
||||
%token tLSHFT tRSHFT /* << and >> */
|
||||
%token tCOLON2 /* :: */
|
||||
%token tCOLON3 /* :: at EXPR_BEG */
|
||||
%token END_OF_INPUT 0 "end-of-input"
|
||||
%token tUPLUS "unary+"
|
||||
%token tUMINUS "unary-"
|
||||
%token tPOW "**"
|
||||
%token tCMP "<=>"
|
||||
%token tEQ "=="
|
||||
%token tEQQ "==="
|
||||
%token tNEQ "!="
|
||||
%token tGEQ ">="
|
||||
%token tLEQ "<="
|
||||
%token tANDOP "&&"
|
||||
%token tOROP "||"
|
||||
%token tMATCH "=~"
|
||||
%token tNMATCH "!~"
|
||||
%token tDOT2 ".."
|
||||
%token tDOT3 "..."
|
||||
%token tAREF "[]"
|
||||
%token tASET "[]="
|
||||
%token tLSHFT "<<"
|
||||
%token tRSHFT ">>"
|
||||
%token tCOLON2 "::"
|
||||
%token tCOLON3 ":: at EXPR_BEG"
|
||||
%token <id> tOP_ASGN /* +=, -= etc. */
|
||||
%token tASSOC /* => */
|
||||
%token tLPAREN /* ( */
|
||||
%token tLPAREN_ARG /* ( */
|
||||
%token tRPAREN /* ) */
|
||||
%token tLBRACK /* [ */
|
||||
%token tLBRACE /* { */
|
||||
%token tLBRACE_ARG /* { */
|
||||
%token tSTAR /* * */
|
||||
%token tDSTAR /* ** */
|
||||
%token tAMPER /* & */
|
||||
%token tLAMBDA /* -> */
|
||||
%token tASSOC "=>"
|
||||
%token tLPAREN "("
|
||||
%token tLPAREN_ARG "( arg"
|
||||
%token tRPAREN ")"
|
||||
%token tLBRACK "["
|
||||
%token tLBRACE "{"
|
||||
%token tLBRACE_ARG "{ arg"
|
||||
%token tSTAR "*"
|
||||
%token tDSTAR "**arg"
|
||||
%token tAMPER "&"
|
||||
%token tLAMBDA "->"
|
||||
%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG
|
||||
%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tSTRING_END tLAMBEG
|
||||
|
||||
|
|
Loading…
Reference in a new issue