summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-14 08:13:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-14 08:13:46 +0000
commit9800fc26b0367c63ada516b932b13268bb79524b (patch)
tree1d645a9c5f00e5ea2e7ae2532d511a15e97aca58 /parse.y
parent277af37b427c635688d9ca7cba0b2fa8d1fb459d (diff)
parse.y: no punctuation instance/class variables
* parse.y (parse_atmark): exclude punctuation follows @ marks, whereas it is inclusive after $ mark as some punctuation global variables exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 89e3d5b647..fd7ba924f9 100644
--- a/parse.y
+++ b/parse.y
@@ -7596,7 +7596,8 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
tokadd(p, '@');
c = nextc(p);
}
- if (c == -1 || ISSPACE(c)) {
+ if (c == -1 || !parser_is_identchar(p)) {
+ pushback(p, c);
if (result == tIVAR) {
compile_error(p, "`@' without identifiers is not allowed as an instance variable name");
}
@@ -7605,7 +7606,7 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
}
return 0;
}
- else if (ISDIGIT(c) || !parser_is_identchar(p)) {
+ else if (ISDIGIT(c)) {
pushback(p, c);
if (result == tIVAR) {
compile_error(p, "`@%c' is not allowed as an instance variable name", c);