From cededf73dca8986aec44e01647be8bef8cb85579 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 1 Aug 2023 11:11:40 -0400 Subject: [PATCH] [ruby/yarp] For errored % characters, use TOKEN_PERCENT and not TOKEN_STRING_BEGIN https://github.com/ruby/yarp/commit/2ec671fe1e --- yarp/yarp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/yarp/yarp.c b/yarp/yarp.c index 9aa4e264c6..ee9aa1b172 100644 --- a/yarp/yarp.c +++ b/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, '=')) {