diff options
author | Kevin Newton <[email protected]> | 2024-04-09 12:23:27 -0400 |
---|---|---|
committer | git <[email protected]> | 2024-04-09 16:29:01 +0000 |
commit | 0107954f257af6fd4cb280aa36b9b320795c0a86 (patch) | |
tree | b0f4c4eea2ecdc7b58165a9f52262d63fe3e4e6d /prism/prism.c | |
parent | d101ec65e9507310b5498ffd8ced4c5a6624662c (diff) |
[ruby/prism] Fix up invalid global variable error message
https://github.com/ruby/prism/commit/8ce9ae487f
Diffstat (limited to 'prism/prism.c')
-rw-r--r-- | prism/prism.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/prism/prism.c b/prism/prism.c index c394ae95b6..16dad45b37 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -8404,6 +8404,10 @@ lex_global_variable(pm_parser_t *parser) { do { parser->current.end += width; } while (parser->current.end < parser->end && (width = char_is_identifier(parser, parser->current.end)) > 0); + } else if (pm_char_is_whitespace(peek(parser))) { + // If we get here, then we have a $ followed by whitespace, + // which is not allowed. + pm_parser_err_token(parser, &parser->current, PM_ERR_GLOBAL_VARIABLE_BARE); } else { // If we get here, then we have a $ followed by something that // isn't recognized as a global variable. |