Skip to content

Commit be2d845

Browse files
committed
Fix escape unicode curly inline whitespace
Fixes [Bug #21145]
1 parent 42f6828 commit be2d845

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/prism.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9777,7 +9777,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
97779777

97789778
size_t whitespace;
97799779
while (true) {
9780-
if ((whitespace = pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
9780+
if ((whitespace = pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
97819781
parser->current.end += whitespace;
97829782
} else if (peek(parser) == '\\' && peek_offset(parser, 1) == 'n') {
97839783
// This is super hacky, but it gets us nicer error
@@ -9825,7 +9825,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
98259825
uint32_t value = escape_unicode(parser, unicode_start, hexadecimal_length);
98269826
escape_write_unicode(parser, buffer, flags, unicode_start, parser->current.end, value);
98279827

9828-
parser->current.end += pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end);
9828+
parser->current.end += pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end);
98299829
}
98309830

98319831
// ?\u{nnnn} character literal should contain only one codepoint
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"\u{
2+
^ invalid Unicode escape sequence
3+
^ unterminated Unicode escape
4+
61}"
5+

0 commit comments

Comments
 (0)