Skip to content

Commit 72049c6

Browse files
authored
Fix regex parsing with slashes (#53)
1 parent 359b8f1 commit 72049c6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: index.coffee

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ RegularExpressionLiteral = ///
1616
|
1717
\\.
1818
)*
19-
\]
19+
\]?
2020
|
21-
[^ / \\ \n \r \u2028 \u2029 ]+
21+
[^ / [ \\ \n \r \u2028 \u2029 ]+
2222
|
2323
\\.
2424
)*

Diff for: test/index.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,11 @@ describe("Token", () => {
809809
match("/[\\]/]/");
810810
match("/[\\\\]/]/", "/[\\\\]/");
811811
match("/[\\\\\\]/]/");
812+
match("/a[/]/");
813+
match("/a[\\]]/");
814+
match("/a[\\]/]/");
815+
match("/a[\\\\]/]/", "/a[\\\\]/");
816+
match("/a[\\\\\\]/]/");
812817
match("/abc]xyz/", "/abc]xyz/");
813818
match("/\\u05aF/");
814819
match("/invalid escape sequence is OK: \\u/");

0 commit comments

Comments
 (0)