Skip to content

Commit

Permalink
Reserve some characters for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed May 23, 2024
1 parent 35a15d5 commit afd1402
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ const TESTS: Test[] = [
[[undefined, "/(testing)"]],
],
[
"/.\\+\\*\\?\\{\\}=^!\\:$[]|",
"/.\\+\\*\\?\\{\\}=^\\!\\:$[]\\|",
undefined,
["/.+*?{}=^!:$[]|"],
[["/.+*?{}=^!:$[]|", ["/.+*?{}=^!:$[]|"]]],
Expand Down
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ interface LexToken {
| "CHAR"
| "ESCAPED_CHAR"
| "MODIFIER"
| "RESERVED"
| "END";
index: number;
value: string;
Expand All @@ -106,6 +107,11 @@ function lexer(str: string) {
while (i < chars.length) {
const char = chars[i];

if (char === "!" || char === ";" || char === "|") {
tokens.push({ type: "RESERVED", index: i, value: chars[i++] });
continue;
}

if (char === "*" || char === "+" || char === "?") {
tokens.push({ type: "MODIFIER", index: i, value: chars[i++] });
continue;
Expand Down Expand Up @@ -510,6 +516,7 @@ function matchRegexp<P extends ParamData>(
): MatchFunction<P> {
const { decode = decodeURIComponent, loose = DEFAULT_DELIMITER } = options;
const stringify = toStringify(loose);

const decoders = keys.map((key) => {
if (key.separator) {
const re = new RegExp(
Expand Down

0 comments on commit afd1402

Please sign in to comment.