[ruby/yarp] Fix invalid unescape sequence error for lower w

https://github.com/ruby/yarp/commit/5a2c78367a
This commit is contained in:
Jemma Issroff 2023-06-21 12:49:41 -04:00 коммит произвёл git
Родитель fcf2f5a522
Коммит b0a3a6ade0
3 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -78,3 +78,5 @@ foo[bar] = baz
%w{one two three}
%x{one two three}
%w[\C:]

Просмотреть файл

@ -1,6 +1,6 @@
ProgramNode(0...502)(
ProgramNode(0...511)(
[],
StatementsNode(0...502)(
StatementsNode(0...511)(
[ArrayNode(0...4)(
[SplatNode(1...3)(
(1...2),
@ -691,6 +691,11 @@ ProgramNode(0...502)(
(488...501),
(501...502),
"one two three"
),
ArrayNode(504...511)(
[StringNode(507...510)(nil, (507...510), nil, "\\C:")],
(504...507),
(510...511)
)]
)
)

Просмотреть файл

@ -6477,7 +6477,14 @@ parser_lex(yp_parser_t *parser) {
// If we hit escapes, then we need to treat the next token
// literally. In this case we'll skip past the next character and
// find the next breakpoint.
size_t difference = yp_unescape_calculate_difference(breakpoint, parser->end, YP_UNESCAPE_ALL, false, &parser->error_list);
yp_unescape_type_t unescape_type;
if (parser->lex_modes.current->as.list.interpolation) {
unescape_type = YP_UNESCAPE_ALL;
} else {
unescape_type = YP_UNESCAPE_MINIMAL;
}
size_t difference = yp_unescape_calculate_difference(breakpoint, parser->end, unescape_type, false, &parser->error_list);
// If the result is an escaped newline, then we need to
// track that newline.