Skip to content

Commit 9f9057b

Browse files
fix(regular_expression): Fixed control Y regular expression (#6524)
Fixes #6413 Fixed regular expression for control Y
1 parent 591f5dd commit 9f9057b

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

crates/oxc_regular_expression/src/ast_impl/display.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ fn character_to_string(
339339
'\n' => Cow::Borrowed(r"\cJ"),
340340
'\r' => Cow::Borrowed(r"\cM"),
341341
'\t' => Cow::Borrowed(r"\cI"),
342+
'\u{0019}' => Cow::Borrowed(r"\cY"),
342343
_ => Cow::Owned(format!(r"\c{ch}")),
343344
},
344345
CharacterKind::Identifier => Cow::Owned(format!(r"\{ch}")),
@@ -479,6 +480,7 @@ mod test {
479480
(r"/\d/g", None),
480481
("/abcd/igv", Some("/abcd/igv")),
481482
(r"/\d/ug", Some(r"/\d/ug")),
483+
(r"/\cY/", None),
482484
// we capitalize hex unicodes.
483485
(r"/\n\cM\0\x41\u{1f600}\./u", Some(r"/\n\cM\0\x41\u{1F600}\./u")),
484486
(r"/\u02c1/u", Some(r"/\u02C1/u")),

tasks/coverage/snapshots/parser_test262.snap

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ commit: d62fa93c
22

33
parser_test262 Summary:
44
AST Parsed : 43914/43914 (100.00%)
5-
Positive Passed: 43913/43914 (100.00%)
5+
Positive Passed: 43914/43914 (100.00%)
66
Negative Passed: 4320/4322 (99.95%)
77
Expect Syntax Error: tasks/coverage/test262/test/language/import/import-attributes/json-invalid.js
88
Expect Syntax Error: tasks/coverage/test262/test/language/import/import-attributes/json-named-bindings.js
9-
Expect to Parse: tasks/coverage/test262/test/built-ins/String/prototype/split/separator-regexp.js
10-
11-
× Regular Expression content mismatch for `/\cY/`: `\c` == `\c`
129

1310
× '0'-prefixed octal literals and octal escape sequences are deprecated
1411
╭─[test262/test/annexB/language/expressions/template-literal/legacy-octal-escape-sequence-strict.js:19:4]

tasks/coverage/snapshots/semantic_test262.snap

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ commit: d62fa93c
22

33
semantic_test262 Summary:
44
AST Parsed : 43914/43914 (100.00%)
5-
Positive Passed: 43713/43914 (99.54%)
5+
Positive Passed: 43714/43914 (99.54%)
66
tasks/coverage/test262/test/annexB/language/function-code/if-decl-else-decl-a-func-block-scoping.js
77
semantic error: Symbol scope ID mismatch for "f":
88
after transform: SymbolId(3): ScopeId(4294967294)
@@ -1119,9 +1119,6 @@ semantic error: Symbol scope ID mismatch for "f":
11191119
after transform: SymbolId(0): ScopeId(4294967294)
11201120
rebuilt : SymbolId(0): ScopeId(4294967294)
11211121

1122-
tasks/coverage/test262/test/built-ins/String/prototype/split/separator-regexp.js
1123-
semantic error: Regular Expression content mismatch for `/\cY/`: `\c` == `\c`
1124-
11251122
tasks/coverage/test262/test/language/module-code/eval-rqstd-once.js
11261123
semantic error: Bindings mismatch:
11271124
after transform: ScopeId(0): ["dflt1", "dflt2", "dflt3", "global", "ns1", "ns3"]

0 commit comments

Comments
 (0)