diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-01 06:45:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-01 06:45:17 +0000 |
commit | b5ba1dcdf0d0db9dc1cdbbc9710e9cab4a6f3bab (patch) | |
tree | 8d6786a64f476fd2c60e78b64df93d4a66391a7c /parse.y | |
parent | 3dce236bf5f2343d14a30619c8c5649002744f22 (diff) | |
download | ruby-b5ba1dcdf0d0db9dc1cdbbc9710e9cab4a6f3bab.tar.gz |
parse.y: invalid instance/class variable names
* parse.y (parse_atmark): mere atmark and two atmarks without
succeeding identifiers are invalid as instance/class variable
names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -7575,9 +7575,13 @@ parse_atmark(struct parser_params *parser, const enum lex_state_e last_state) tokadd('@'); c = nextc(); } - if (c != -1 && (ISDIGIT(c) || !parser_is_identchar())) { + if (c == -1 || ISSPACE(c)) { + compile_error(PARSER_ARG "unexpected @"); + return 0; + } + else if (ISDIGIT(c) || !parser_is_identchar()) { pushback(c); - if (tokidx == 1) { + if (result == tIVAR) { compile_error(PARSER_ARG "`@%c' is not allowed as an instance variable name", c); } else { |