ruby-changes:55085
From: nobu <ko1@a...>
Date: Mon, 18 Mar 2019 15:42:25 +0900 (JST)
Subject: [ruby-changes:55085] nobu:r67292 (trunk): parse.y: continue after invalid name
nobu 2019-03-18 15:42:19 +0900 (Mon, 18 Mar 2019) New Revision: 67292 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67292 Log: parse.y: continue after invalid name * parse.y (set_yylval_noname): continue after an invalid global, instance, class variable name, without "unexpected end-of-file" error. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 67291) +++ parse.y (revision 67292) @@ -4555,6 +4555,8 @@ ripper_yylval_id(struct parser_params *p https://github.com/ruby/ruby/blob/trunk/parse.y#L4555 # define _cur_loc NULL_LOC /* dummy */ #endif +#define set_yylval_noname() set_yylval_id(keyword_nil) + #ifndef RIPPER #define literal_flush(p, ptr) ((p)->lex.ptok = (ptr)) #define dispatch_scan_event(p, t) ((void)0) @@ -7617,7 +7619,8 @@ parse_gvar(struct parser_params *p, cons https://github.com/ruby/ruby/blob/trunk/parse.y#L7619 compile_error(p, "`$%c' is not allowed as a global variable name", c); } parser_show_error_line(p, &loc); - return 0; + set_yylval_noname(); + return tGVAR; } case '0': tokadd(p, '$'); @@ -7671,7 +7674,8 @@ parse_atmark(struct parser_params *p, co https://github.com/ruby/ruby/blob/trunk/parse.y#L7674 compile_error(p, "`@@' without identifiers is not allowed as a class variable name"); } parser_show_error_line(p, &loc); - return 0; + set_yylval_noname(); + return result; } else if (ISDIGIT(c)) { if (result == tIVAR) { @@ -7697,7 +7701,8 @@ parse_atmark(struct parser_params *p, co https://github.com/ruby/ruby/blob/trunk/parse.y#L7701 compile_error(p, "`@@%c' is not allowed as a class variable name", c); } parser_show_error_line(p, &loc); - return 0; + set_yylval_noname(); + return result; } if (tokadd_ident(p, c)) return 0; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/