Skip to content

Commit

Permalink
fix(regular_expression): Fixed control Y regular expression (#6524)
Browse files Browse the repository at this point in the history
Fixes #6413

Fixed regular expression for control Y
  • Loading branch information
tapanprakasht authored Oct 14, 2024
1 parent 591f5dd commit 9f9057b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 2 additions & 0 deletions crates/oxc_regular_expression/src/ast_impl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ fn character_to_string(
'\n' => Cow::Borrowed(r"\cJ"),
'\r' => Cow::Borrowed(r"\cM"),
'\t' => Cow::Borrowed(r"\cI"),
'\u{0019}' => Cow::Borrowed(r"\cY"),
_ => Cow::Owned(format!(r"\c{ch}")),
},
CharacterKind::Identifier => Cow::Owned(format!(r"\{ch}")),
Expand Down Expand Up @@ -479,6 +480,7 @@ mod test {
(r"/\d/g", None),
("/abcd/igv", Some("/abcd/igv")),
(r"/\d/ug", Some(r"/\d/ug")),
(r"/\cY/", None),
// we capitalize hex unicodes.
(r"/\n\cM\0\x41\u{1f600}\./u", Some(r"/\n\cM\0\x41\u{1F600}\./u")),
(r"/\u02c1/u", Some(r"/\u02C1/u")),
Expand Down
5 changes: 1 addition & 4 deletions tasks/coverage/snapshots/parser_test262.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ commit: d62fa93c

parser_test262 Summary:
AST Parsed : 43914/43914 (100.00%)
Positive Passed: 43913/43914 (100.00%)
Positive Passed: 43914/43914 (100.00%)
Negative Passed: 4320/4322 (99.95%)
Expect Syntax Error: tasks/coverage/test262/test/language/import/import-attributes/json-invalid.js
Expect Syntax Error: tasks/coverage/test262/test/language/import/import-attributes/json-named-bindings.js
Expect to Parse: tasks/coverage/test262/test/built-ins/String/prototype/split/separator-regexp.js

× Regular Expression content mismatch for `/\cY/`: `\c` == `\c`

× '0'-prefixed octal literals and octal escape sequences are deprecated
╭─[test262/test/annexB/language/expressions/template-literal/legacy-octal-escape-sequence-strict.js:19:4]
Expand Down
5 changes: 1 addition & 4 deletions tasks/coverage/snapshots/semantic_test262.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ commit: d62fa93c

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

tasks/coverage/test262/test/built-ins/String/prototype/split/separator-regexp.js
semantic error: Regular Expression content mismatch for `/\cY/`: `\c` == `\c`

tasks/coverage/test262/test/language/module-code/eval-rqstd-once.js
semantic error: Bindings mismatch:
after transform: ScopeId(0): ["dflt1", "dflt2", "dflt3", "global", "ns1", "ns3"]
Expand Down

0 comments on commit 9f9057b

Please sign in to comment.