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 | c3dad9883dcf477bdb1a1ad95208659ff0994ae7 (patch) | |
tree | d3bc115cbc4522fea0649888d0bb1185068bfc8c /parse.y | |
parent | 2852b3d56ab6dbc0f7a0a600310d310e355a3afb (diff) | |
download | ruby-c3dad9883dcf477bdb1a1ad95208659ff0994ae7.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': |