summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-05-16 10:01:30 -0400
committergit <svn-admin@ruby-lang.org>2024-05-16 14:16:32 +0000
commit011668883ca62bc727f372fa8abb6a64e3a33aae (patch)
treecdead2d272d7308f4dbd7f84bc5dc2e0845b5886
parent477b13ba17d595cda5c8d38da145ef2600702af5 (diff)
[ruby/prism] Always go to string lex mode even if EOF
https://github.com/ruby/prism/commit/57d5c9be2c
-rw-r--r--prism/prism.c5
-rw-r--r--test/prism/errors_test.rb2
2 files changed, 2 insertions, 5 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 4107550223..e6f10f0810 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -11375,10 +11375,7 @@ parser_lex(pm_parser_t *parser) {
const uint8_t delimiter = pm_lex_percent_delimiter(parser);
lex_mode_push_string(parser, true, false, lex_mode_incrementor(delimiter), lex_mode_terminator(delimiter));
-
- if (parser->current.end < parser->end) {
- LEX(PM_TOKEN_STRING_BEGIN);
- }
+ LEX(PM_TOKEN_STRING_BEGIN);
}
// Delimiters for %-literals cannot be alphanumeric. We
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb
index c6991519c5..65b913fc32 100644
--- a/test/prism/errors_test.rb
+++ b/test/prism/errors_test.rb
@@ -222,7 +222,7 @@ module Prism
def test_cr_without_lf_in_percent_expression
assert_errors expression("%\r"), "%\r", [
- ["invalid `%` token", 0..2],
+ ["unterminated string meets end of file", 2..2],
]
end