summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-13 02:13:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-13 02:13:43 +0000
commit60730d91ce235dec66016001444b50d7131f0e10 (patch)
treed3bc115cbc4522fea0649888d0bb1185068bfc8c /parse.y
parent5b80ca1db8df9a4368ce1412bad28c823a6e3c8b (diff)
parse.y: refine message for gvar w/o identitirs
* parse.y (parse_gvar): separate message for gvar without non-space characters from message for invalid identitirs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 63c8d45480..54850e7e63 100644
--- a/parse.y
+++ b/parse.y
@@ -7675,8 +7675,13 @@ parse_gvar(struct parser_params *parser, const enum lex_state_e last_state)
default:
if (!parser_is_identchar()) {
- pushback(c);
- compile_error(PARSER_ARG "`$%c' is not allowed as a global variable name", c);
+ if (c == -1 || ISSPACE(c)) {
+ compile_error(PARSER_ARG "`$' without identifiers is not allowed as a global variable name");
+ }
+ else {
+ pushback(c);
+ compile_error(PARSER_ARG "`$%c' is not allowed as a global variable name", c);
+ }
return 0;
}
case '0':