summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yarp/yarp.c10
1 files 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, '=')) {