aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
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':