[ruby/yarp] For errored % characters, use TOKEN_PERCENT and not TOKEN_STRING_BEGIN
https://github.com/ruby/yarp/commit/2ec671fe1e
This commit is contained in:
parent
242f3c3a77
commit
cededf73dc
Notes:
git
2025-04-09 13:49:37 +00:00
10
yarp/yarp.c
10
yarp/yarp.c
@ -6325,12 +6325,14 @@ parser_lex(yp_parser_t *parser) {
|
||||
|
||||
// % %= %i %I %q %Q %w %W
|
||||
case '%': {
|
||||
// In a BEG state, if you encounter a % then you must be starting
|
||||
// something. In this case if there is no subsequent character then
|
||||
// we have an invalid token.
|
||||
// In a BEG state, if you encounter a % then you must be
|
||||
// starting something. In this case if there is no
|
||||
// subsequent character then we have an invalid token. We're
|
||||
// going to say it's the percent operator because we don't
|
||||
// want to move into the string lex mode unnecessarily.
|
||||
if (lex_state_beg_p(parser) && (parser->current.end >= parser->end)) {
|
||||
yp_diagnostic_list_append(&parser->error_list, parser->current.start, parser->current.end, "unexpected end of input");
|
||||
LEX(YP_TOKEN_STRING_BEGIN);
|
||||
LEX(YP_TOKEN_PERCENT);
|
||||
}
|
||||
|
||||
if (!lex_state_beg_p(parser) && match(parser, '=')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user