[ruby/prism] Fix escape unicode curly inline whitespace

Fixes [Bug #21145]

be2d845639
This commit is contained in:
Kevin Newton 2025-02-17 12:57:54 -05:00 committed by git
parent 8324e3148a
commit 2db365dc83
2 changed files with 7 additions and 2 deletions

View file

@ -9776,7 +9776,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
size_t whitespace;
while (true) {
if ((whitespace = pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
if ((whitespace = pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
parser->current.end += whitespace;
} else if (peek(parser) == '\\' && peek_offset(parser, 1) == 'n') {
// This is super hacky, but it gets us nicer error
@ -9824,7 +9824,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
uint32_t value = escape_unicode(parser, unicode_start, hexadecimal_length);
escape_write_unicode(parser, buffer, flags, unicode_start, parser->current.end, value);
parser->current.end += pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end);
parser->current.end += pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end);
}
// ?\u{nnnn} character literal should contain only one codepoint

View file

@ -0,0 +1,5 @@
"\u{
^ invalid Unicode escape sequence
^ unterminated Unicode escape
61}"