Skip to content

Commit 5a2c783

Browse files
committed
Fix invalid unescape sequence error for lower w
1 parent 292600f commit 5a2c783

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/yarp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6477,7 +6477,14 @@ parser_lex(yp_parser_t *parser) {
64776477
// If we hit escapes, then we need to treat the next token
64786478
// literally. In this case we'll skip past the next character and
64796479
// find the next breakpoint.
6480-
size_t difference = yp_unescape_calculate_difference(breakpoint, parser->end, YP_UNESCAPE_ALL, false, &parser->error_list);
6480+
6481+
yp_unescape_type_t unescape_type;
6482+
if (parser->lex_modes.current->as.list.interpolation) {
6483+
unescape_type = YP_UNESCAPE_ALL;
6484+
} else {
6485+
unescape_type = YP_UNESCAPE_MINIMAL;
6486+
}
6487+
size_t difference = yp_unescape_calculate_difference(breakpoint, parser->end, unescape_type, false, &parser->error_list);
64816488

64826489
// If the result is an escaped newline, then we need to
64836490
// track that newline.

test/fixtures/arrays.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,5 @@ foo[bar] = baz
7878
%w{one two three}
7979

8080
%x{one two three}
81+
82+
%w[\C:]

test/snapshots/arrays.txt

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)