Skip to content

Commit

Permalink
[ruby/prism] Always go to string lex mode even if EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed May 16, 2024
1 parent 477b13b commit 0116688
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions prism/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/prism/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test_unterminated_interpolated_symbol

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

Expand Down

0 comments on commit 0116688

Please sign in to comment.