diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-13 02:13:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-13 02:13:43 +0000 |
commit | 60730d91ce235dec66016001444b50d7131f0e10 (patch) | |
tree | d3bc115cbc4522fea0649888d0bb1185068bfc8c /parse.y | |
parent | 5b80ca1db8df9a4368ce1412bad28c823a6e3c8b (diff) | |
download | ruby-60730d91ce235dec66016001444b50d7131f0e10.tar.gz |
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.y | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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': |