diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-18 06:42:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-18 06:42:19 +0000 |
commit | 17018d4c31a86af2b47e09b3229dab2e80d3db6d (patch) | |
tree | 2c2eef2266495ad04d78735d931c09ed1d0cc9ff | |
parent | 908b5301124cf673a2ee44de652968aa5360afd1 (diff) | |
download | ruby-17018d4c31a86af2b47e09b3229dab2e80d3db6d.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | parse.y | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -4555,6 +4555,8 @@ ripper_yylval_id(struct parser_params *p, ID x) # 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, const enum lex_state_e last_state) 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, const enum lex_state_e last_state) 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, const enum lex_state_e last_state) 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; |