summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-01 06:45:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-01 06:45:17 +0000
commitb5ba1dcdf0d0db9dc1cdbbc9710e9cab4a6f3bab (patch)
tree8d6786a64f476fd2c60e78b64df93d4a66391a7c /parse.y
parent3dce236bf5f2343d14a30619c8c5649002744f22 (diff)
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.y8
1 files changed, 6 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 6d04f4175e..d707a1bd04 100644
--- a/parse.y
+++ b/parse.y
@@ -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 {