Skip to content

Commit f627efe

Browse files
kddnewtonk0kubun
authored andcommitted
[ruby/prism] Fix escape unicode curly inline whitespace
Fixes [Bug #21145] ruby/prism@be2d845639
1 parent d2930f8 commit f627efe

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

prism/prism.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -9770,7 +9770,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
97709770

97719771
size_t whitespace;
97729772
while (true) {
9773-
if ((whitespace = pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
9773+
if ((whitespace = pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end)) > 0) {
97749774
parser->current.end += whitespace;
97759775
} else if (peek(parser) == '\\' && peek_offset(parser, 1) == 'n') {
97769776
// This is super hacky, but it gets us nicer error
@@ -9818,7 +9818,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
98189818
uint32_t value = escape_unicode(parser, unicode_start, hexadecimal_length);
98199819
escape_write_unicode(parser, buffer, flags, unicode_start, parser->current.end, value);
98209820

9821-
parser->current.end += pm_strspn_whitespace(parser->current.end, parser->end - parser->current.end);
9821+
parser->current.end += pm_strspn_inline_whitespace(parser->current.end, parser->end - parser->current.end);
98229822
}
98239823

98249824
// ?\u{nnnn} character literal should contain only one codepoint
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)