Skip to content

Commit

Permalink
Fix regex parsing with slashes (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell authored Nov 22, 2024
1 parent 359b8f1 commit 72049c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ RegularExpressionLiteral = ///
|
\\.
)*
\]
\]?
|
[^ / \\ \n \r \u2028 \u2029 ]+
[^ / [ \\ \n \r \u2028 \u2029 ]+
|
\\.
)*
Expand Down
5 changes: 5 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,11 @@ describe("Token", () => {
match("/[\\]/]/");
match("/[\\\\]/]/", "/[\\\\]/");
match("/[\\\\\\]/]/");
match("/a[/]/");
match("/a[\\]]/");
match("/a[\\]/]/");
match("/a[\\\\]/]/", "/a[\\\\]/");
match("/a[\\\\\\]/]/");
match("/abc]xyz/", "/abc]xyz/");
match("/\\u05aF/");
match("/invalid escape sequence is OK: \\u/");
Expand Down

0 comments on commit 72049c6

Please sign in to comment.