Skip to content

Commit afd1402

Browse files
committed
Reserve some characters for future use
1 parent 35a15d5 commit afd1402

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ const TESTS: Test[] = [
19351935
[[undefined, "/(testing)"]],
19361936
],
19371937
[
1938-
"/.\\+\\*\\?\\{\\}=^!\\:$[]|",
1938+
"/.\\+\\*\\?\\{\\}=^\\!\\:$[]\\|",
19391939
undefined,
19401940
["/.+*?{}=^!:$[]|"],
19411941
[["/.+*?{}=^!:$[]|", ["/.+*?{}=^!:$[]|"]]],

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ interface LexToken {
9090
| "CHAR"
9191
| "ESCAPED_CHAR"
9292
| "MODIFIER"
93+
| "RESERVED"
9394
| "END";
9495
index: number;
9596
value: string;
@@ -106,6 +107,11 @@ function lexer(str: string) {
106107
while (i < chars.length) {
107108
const char = chars[i];
108109

110+
if (char === "!" || char === ";" || char === "|") {
111+
tokens.push({ type: "RESERVED", index: i, value: chars[i++] });
112+
continue;
113+
}
114+
109115
if (char === "*" || char === "+" || char === "?") {
110116
tokens.push({ type: "MODIFIER", index: i, value: chars[i++] });
111117
continue;
@@ -510,6 +516,7 @@ function matchRegexp<P extends ParamData>(
510516
): MatchFunction<P> {
511517
const { decode = decodeURIComponent, loose = DEFAULT_DELIMITER } = options;
512518
const stringify = toStringify(loose);
519+
513520
const decoders = keys.map((key) => {
514521
if (key.separator) {
515522
const re = new RegExp(

0 commit comments

Comments
 (0)