@ac-kit/format-regex 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +89 -13
- package/dist/_iregexp-parse.d.ts +50 -0
- package/dist/_iregexp-parse.d.ts.map +1 -0
- package/dist/_iregexp-parse.js +367 -0
- package/dist/_iregexp-parse.js.map +1 -0
- package/dist/_unicode-category.d.ts +12 -0
- package/dist/_unicode-category.d.ts.map +1 -0
- package/dist/_unicode-category.js +49 -0
- package/dist/_unicode-category.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/iregexp-syntax-error.d.ts +13 -0
- package/dist/iregexp-syntax-error.d.ts.map +1 -0
- package/dist/iregexp-syntax-error.js +16 -0
- package/dist/iregexp-syntax-error.js.map +1 -0
- package/dist/iregexp.d.ts +91 -0
- package/dist/iregexp.d.ts.map +1 -0
- package/dist/iregexp.js +111 -0
- package/dist/iregexp.js.map +1 -0
- package/dist/limits.d.ts +25 -8
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +16 -6
- package/dist/limits.js.map +1 -1
- package/dist/parser.d.ts +16 -3
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +100 -66
- package/dist/parser.js.map +1 -1
- package/dist/printer.d.ts +12 -1
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +40 -21
- package/dist/printer.js.map +1 -1
- package/dist/regex.d.ts +43 -6
- package/dist/regex.d.ts.map +1 -1
- package/dist/regex.js +25 -10
- package/dist/regex.js.map +1 -1
- package/dist/vm/_class-predicate.d.ts +27 -0
- package/dist/vm/_class-predicate.d.ts.map +1 -0
- package/dist/vm/_class-predicate.js +65 -0
- package/dist/vm/_class-predicate.js.map +1 -0
- package/dist/vm/_thompson.d.ts +70 -0
- package/dist/vm/_thompson.d.ts.map +1 -0
- package/dist/vm/_thompson.js +196 -0
- package/dist/vm/_thompson.js.map +1 -0
- package/dist/vm/compile.d.ts +14 -2
- package/dist/vm/compile.d.ts.map +1 -1
- package/dist/vm/compile.js +83 -159
- package/dist/vm/compile.js.map +1 -1
- package/dist/vm/pike-vm.d.ts +38 -8
- package/dist/vm/pike-vm.d.ts.map +1 -1
- package/dist/vm/pike-vm.js +228 -102
- package/dist/vm/pike-vm.js.map +1 -1
- package/dist/vm/program.d.ts +29 -4
- package/dist/vm/program.d.ts.map +1 -1
- package/dist/walk.d.ts +7 -1
- package/dist/walk.d.ts.map +1 -1
- package/dist/walk.js +9 -3
- package/dist/walk.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# @ac-kit/format-regex
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5152230: Hardened for untrusted patterns, and an RFC 9485 I-Regexp compiler.
|
|
8
|
+
|
|
9
|
+
- `compileIRegexp(source, limits?, budget?)` returns an `IRegexp` with
|
|
10
|
+
`match(input)` (whole string) and `search(input)` (substring), unary so they
|
|
11
|
+
can be passed as callbacks, plus `matchWithin`/`searchWithin(input, budget)`;
|
|
12
|
+
the semantics of JSONPath's `match()` and `search()`. The RFC 9485 grammar is
|
|
13
|
+
checked exactly; a pattern outside it throws `IRegexpSyntaxError` (a
|
|
14
|
+
`SyntaxError` with a `span`), and `tryCompileIRegexp` answers `null` instead.
|
|
15
|
+
Matching is by code point, `.` excludes `\n` and `\r` (a literal line feed in
|
|
16
|
+
the pattern is an ordinary character, as the grammar allows), `\p{…}`/`\P{…}`
|
|
17
|
+
take the RFC's general categories, and quantifier bounds are ordered exactly
|
|
18
|
+
however many digits they have. `tryCompileIRegexp` answers `null` only for the
|
|
19
|
+
parser's own errors; whatever a budget throws propagates. `^` and `$` are
|
|
20
|
+
anchors, as the JSONPath compliance suite expects, rather than the RFC's
|
|
21
|
+
literal characters.
|
|
22
|
+
- No stack overflow on any pattern: the parser, compiler, printer, VM and
|
|
23
|
+
`walkRegex` are iterative. Every bound fails with `RegexLimitExceededError`.
|
|
24
|
+
- Every compilation and run accepts a `WorkBudget` from `@ac-kit/core` (any
|
|
25
|
+
`{ spend(cost) }`, such as `FixedWorkBudget`), so a caller can cap a whole
|
|
26
|
+
series of them; a budget's exhaustion throws whatever the budget throws.
|
|
27
|
+
`execProgram` accepts a budget in place of its numeric step bound; the new
|
|
28
|
+
`testProgram` answers the boolean question without capture copies and stops at
|
|
29
|
+
the first match. `compileRegex` and `compileProgram` take an optional budget;
|
|
30
|
+
`CompiledRegex` gains `testWithin`/`execWithin(input, budget)`.
|
|
31
|
+
- `RegexProgram.unit` (`"codeUnit"` by default, or `"codePoint"`) selects what
|
|
32
|
+
one VM step consumes; existing programs are unaffected.
|
|
33
|
+
- Public-dialect quantifier bounds are ordered on their digits before rounding,
|
|
34
|
+
and bounds above `Number.MAX_SAFE_INTEGER` are saturated to it in the syntax
|
|
35
|
+
tree.
|
|
36
|
+
- A repetition of an empty group (`(?:){1000000000}`) compiles at once instead
|
|
37
|
+
of looping; it emits no instructions.
|
|
38
|
+
- **Breaking:** `RegexLimits.maxNestingDepth` (default 256) bounds group nesting,
|
|
39
|
+
and `parseRegex` takes `limits`, so a pattern nesting groups deeper than the
|
|
40
|
+
bound throws `RegexLimitExceededError`. `RegexLimitKind` gains
|
|
41
|
+
`"nestingDepth"`. Migration: add the case to code that switches exhaustively
|
|
42
|
+
on the kind, and raise `maxNestingDepth` for deeper patterns.
|
|
43
|
+
- **Breaking:** the numeric `maxSteps` bound throws `RegexLimitExceededError` of
|
|
44
|
+
kind `"steps"` with the core error as its `cause`; it must be a positive safe
|
|
45
|
+
integer or `Infinity` (a `RangeError` otherwise). It counts all work as it
|
|
46
|
+
grows: a run's setup (a few units per instruction), thread activations, every
|
|
47
|
+
capture copy by its slot count and the membership work of large classes (new
|
|
48
|
+
optional `cost` on `predicate` instructions); and it bounds compilation (the
|
|
49
|
+
source length before lexing, classes by item count, nodes lowered, jumps
|
|
50
|
+
patched). Migration: a pattern or run that sat just under a tight custom
|
|
51
|
+
`maxSteps` may now exceed it; raise it. Defaults are unchanged.
|
|
52
|
+
- **Breaking:** `CompiledRegex.test` and `exec` are readonly function
|
|
53
|
+
properties rather than methods, unary as before, and `test` uses the
|
|
54
|
+
capture-free path. Migration: wrap them instead of assigning to or overriding
|
|
55
|
+
them.
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [2a0fe74]
|
|
60
|
+
- Updated dependencies [5152230]
|
|
61
|
+
- Updated dependencies [5152230]
|
|
62
|
+
- Updated dependencies [2a0fe74]
|
|
63
|
+
- Updated dependencies [5152230]
|
|
64
|
+
- Updated dependencies [2a0fe74]
|
|
65
|
+
- Updated dependencies [5152230]
|
|
66
|
+
- Updated dependencies [5152230]
|
|
67
|
+
- Updated dependencies [2a0fe74]
|
|
68
|
+
- Updated dependencies [2a0fe74]
|
|
69
|
+
- Updated dependencies [5152230]
|
|
70
|
+
- Updated dependencies [5152230]
|
|
71
|
+
- Updated dependencies [5152230]
|
|
72
|
+
- Updated dependencies [5152230]
|
|
73
|
+
- Updated dependencies [5152230]
|
|
74
|
+
- Updated dependencies [5152230]
|
|
75
|
+
- Updated dependencies [5152230]
|
|
76
|
+
- Updated dependencies [5152230]
|
|
77
|
+
- @ac-kit/algo@0.4.0
|
|
78
|
+
- @ac-kit/core@0.10.0
|
|
79
|
+
|
|
80
|
+
## 0.2.7
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [20341eb]
|
|
85
|
+
- @ac-kit/core@0.9.0
|
|
86
|
+
- @ac-kit/algo@0.3.2
|
|
87
|
+
|
|
3
88
|
## 0.2.6
|
|
4
89
|
|
|
5
90
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @ac-kit/format-regex
|
|
2
2
|
|
|
3
3
|
A regex-dialect lexer, parser, printer, and a Thompson-construction / Pike-VM
|
|
4
|
-
codec
|
|
4
|
+
codec — plus an RFC 9485 I-Regexp compiler on the same VM, safe for patterns
|
|
5
|
+
that come from untrusted input.
|
|
5
6
|
|
|
6
7
|
```ts
|
|
7
8
|
import { compileRegex } from "@ac-kit/format-regex";
|
|
@@ -14,9 +15,46 @@ re.exec("pages 10-20"); // { index: 6, length: 5, text: "10-20", groups: [...] }
|
|
|
14
15
|
Because matching runs on a Pike VM (all threads advance in lockstep, no
|
|
15
16
|
backtracking), it is immune to catastrophic ("ReDoS") blowup: `(a+)+b` against a
|
|
16
17
|
long non-matching input returns in linear time, where a backtracking engine
|
|
17
|
-
(including native `RegExp`) is exponential.
|
|
18
|
+
(including native `RegExp`) is exponential. `test` takes a capture-free path that
|
|
19
|
+
stops at the first match.
|
|
18
20
|
|
|
19
|
-
##
|
|
21
|
+
## I-Regexp (RFC 9485)
|
|
22
|
+
|
|
23
|
+
`compileIRegexp` checks a pattern against the RFC 9485 grammar exactly and
|
|
24
|
+
compiles it for whole-string (`match`) and substring (`search`) tests — the
|
|
25
|
+
semantics JSONPath's `match()` and `search()` functions (RFC 9535) need:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { compileIRegexp, tryCompileIRegexp } from "@ac-kit/format-regex";
|
|
29
|
+
|
|
30
|
+
const date = compileIRegexp("[0-9]{4}-[0-9]{2}-[0-9]{2}");
|
|
31
|
+
date.match("2026-11-24"); // true
|
|
32
|
+
date.search("due 2026-11-24."); // true
|
|
33
|
+
|
|
34
|
+
compileIRegexp("a.b").match("a😀b"); // true: matching is by code point
|
|
35
|
+
compileIRegexp("\\p{Lu}+").match("ÉTÉ"); // true
|
|
36
|
+
tryCompileIRegexp("\\d+"); // null: \d is not I-Regexp
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- Rejected with an `IRegexpSyntaxError` (a `SyntaxError` with a `span`):
|
|
40
|
+
`\d \w \s` and their complements, lazy quantifiers, `(?:` and every other
|
|
41
|
+
`(?` group, backreferences, any escape outside the RFC's list (`\-` is
|
|
42
|
+
accepted, `\/` and `\$` are not), unknown or long `\p{…}` names, and a lone
|
|
43
|
+
surrogate in the pattern. `tryCompileIRegexp` answers `null` instead.
|
|
44
|
+
- Matching is by code point: an astral character is one `.`, class ranges
|
|
45
|
+
compare code points, and a lone surrogate in the input is one character.
|
|
46
|
+
- `.` matches anything but `\n` and `\r`.
|
|
47
|
+
- `\p{…}`/`\P{…}` accept the general categories RFC 9485 lists (`L`, `Lu`,
|
|
48
|
+
`Nd`, …), validated against a fixed table; no text from a pattern is ever
|
|
49
|
+
handed to the native regex compiler. Membership follows the JavaScript
|
|
50
|
+
engine's Unicode version.
|
|
51
|
+
- **Deviation:** `^` and `$` outside a class are start and end anchors, as the
|
|
52
|
+
JSONPath compliance test suite expects and as RFC 9485 §5.3 maps them, rather
|
|
53
|
+
than the literal characters of the XSD grammar. Write `\^` or `[$]` for the
|
|
54
|
+
characters.
|
|
55
|
+
- Groups do not capture: I-Regexp only answers whether a string matches.
|
|
56
|
+
|
|
57
|
+
## Limits and budgets
|
|
20
58
|
|
|
21
59
|
Linear is not the same as bounded. The program is sized by the pattern —
|
|
22
60
|
`a{1,200000}` emits one instruction per repetition before a character is read —
|
|
@@ -24,24 +62,62 @@ and the work is program size × input length, so a caller holding neither factor
|
|
|
24
62
|
needs a ceiling on both. `RegexLimits` supplies it:
|
|
25
63
|
|
|
26
64
|
```ts
|
|
65
|
+
import { compileRegex } from "@ac-kit/format-regex";
|
|
66
|
+
|
|
27
67
|
compileRegex("a{1,100}", { maxProgramSize: 16 }); // RegexLimitExceededError
|
|
28
68
|
```
|
|
29
69
|
|
|
30
|
-
`maxProgramSize` is checked as the program is emitted, so the array never
|
|
31
|
-
past it
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
70
|
+
- `maxProgramSize` is checked as the program is emitted, so the array never
|
|
71
|
+
grows past it.
|
|
72
|
+
- `maxSteps` bounds the work of one compilation or one run. Work is charged as
|
|
73
|
+
it grows, before it is done: a compilation pays for the source length before
|
|
74
|
+
lexing, for each class by its item count, and one unit per syntax node
|
|
75
|
+
lowered and per jump patched; a run pays a few units per instruction for its
|
|
76
|
+
tables, one per thread activation, one per capture slot it copies, and the
|
|
77
|
+
membership work of a large class each time it is tested.
|
|
78
|
+
- `maxNestingDepth` bounds how deeply groups nest, so the syntax tree
|
|
79
|
+
`parseRegex` hands out can be walked recursively.
|
|
80
|
+
|
|
81
|
+
Every bound of `RegexLimits` fails with a `RegexLimitExceededError` naming it.
|
|
82
|
+
The parser, the compiler, the printer, `walkRegex` and the VM are all
|
|
83
|
+
iterative: no pattern, however deep or repetitive, can reach a stack overflow.
|
|
84
|
+
|
|
85
|
+
To cap a whole series of calls — every `match()` of one JSONPath evaluation, say
|
|
86
|
+
— pass one `WorkBudget` from `@ac-kit/core` to all of them, through
|
|
87
|
+
`compileRegex`/`compileIRegexp` and the `…Within` forms of the matchers
|
|
88
|
+
(`testWithin`, `execWithin`, `matchWithin`, `searchWithin`). The plain
|
|
89
|
+
`test`, `exec`, `match` and `search` stay unary, so `texts.filter(re.match)`
|
|
90
|
+
works. `FixedWorkBudget`
|
|
91
|
+
is a fixed allowance; any object with a `spend(cost)` method that throws when
|
|
92
|
+
exhausted works, so a caller's own evaluation budget can be charged directly.
|
|
93
|
+
A budget's exhaustion throws whatever the budget throws (`FixedWorkBudget`
|
|
94
|
+
throws `WorkBudgetExceededError`); only the numeric `maxSteps` bound reports a
|
|
95
|
+
`RegexLimitExceededError`:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { FixedWorkBudget } from "@ac-kit/core";
|
|
99
|
+
import { compileIRegexp } from "@ac-kit/format-regex";
|
|
100
|
+
|
|
101
|
+
const budget = new FixedWorkBudget(1_000_000);
|
|
102
|
+
const word = compileIRegexp("[a-z]+");
|
|
103
|
+
for (const text of ["alpha", "beta", "gamma"]) {
|
|
104
|
+
word.matchWithin(text, budget); // all three runs charged to one million units
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Supported syntax of `compileRegex`
|
|
35
109
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
110
|
+
Literals, `.`, `^`/`$` anchors, `[...]`/`[^...]` classes (with ranges and
|
|
111
|
+
`\d\w\s\D\W\S` shorthands, also usable outside classes), `(...)` capturing /
|
|
112
|
+
`(?:...)` non-capturing groups, `|` alternation, and
|
|
39
113
|
`*`/`+`/`?`/`{m}`/`{m,}`/`{m,n}` quantifiers (each optionally lazy via a
|
|
40
114
|
trailing `?`). Not supported, rejected with a clear parse error rather than
|
|
41
115
|
silently mishandled: lookaround, named groups, backreferences, flags, and
|
|
42
116
|
`\p{...}` Unicode property escapes. Matching is by UTF-16 code unit, not full
|
|
43
|
-
Unicode code point (no special handling of astral characters)
|
|
44
|
-
|
|
117
|
+
Unicode code point (no special handling of astral characters); a hand-built
|
|
118
|
+
`RegexProgram` can opt into code-point stepping with `unit: "codePoint"`. A bare
|
|
119
|
+
`{` is always parsed as the start of a quantifier — use `\{` for a literal
|
|
120
|
+
brace.
|
|
45
121
|
|
|
46
122
|
See the
|
|
47
123
|
[generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/format-regex/)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Callable, type WorkBudget } from "@ac-kit/core";
|
|
2
|
+
import { IRegexpSyntaxError } from "./iregexp-syntax-error.js";
|
|
3
|
+
import type { ThompsonShape } from "./vm/_thompson.js";
|
|
4
|
+
import type { Instruction } from "./vm/program.js";
|
|
5
|
+
/**
|
|
6
|
+
* An I-Regexp syntax node, already in the shape the Thompson compiler reads
|
|
7
|
+
* (every variant is a {@link ThompsonShape} over itself).
|
|
8
|
+
*/
|
|
9
|
+
export type IRegexpNode_ = {
|
|
10
|
+
readonly kind: "emit";
|
|
11
|
+
readonly instruction: Instruction;
|
|
12
|
+
} | IRegexpSequence_ | IRegexpChoice_ | IRegexpRepeat_;
|
|
13
|
+
interface IRegexpSequence_ {
|
|
14
|
+
readonly kind: "sequence";
|
|
15
|
+
readonly items: readonly IRegexpNode_[];
|
|
16
|
+
}
|
|
17
|
+
interface IRegexpChoice_ {
|
|
18
|
+
readonly kind: "choice";
|
|
19
|
+
readonly alternatives: readonly IRegexpNode_[];
|
|
20
|
+
}
|
|
21
|
+
interface IRegexpRepeat_ {
|
|
22
|
+
readonly kind: "repeat";
|
|
23
|
+
readonly body: IRegexpNode_;
|
|
24
|
+
readonly min: number;
|
|
25
|
+
readonly max: number | undefined;
|
|
26
|
+
readonly lazy: false;
|
|
27
|
+
}
|
|
28
|
+
/** The identity: a node is its own Thompson shape. */
|
|
29
|
+
export declare const shapeOfIRegexpNode_: (node: IRegexpNode_) => ThompsonShape<IRegexpNode_>;
|
|
30
|
+
/**
|
|
31
|
+
* Parses an I-Regexp (RFC 9485 §3), checking the grammar exactly, into the
|
|
32
|
+
* shape the Thompson compiler reads.
|
|
33
|
+
*
|
|
34
|
+
* Two departures from the literal grammar, both what the JSONPath compliance
|
|
35
|
+
* suite expects: `^` and `$` outside a class are start and end anchors rather
|
|
36
|
+
* than ordinary characters, as in the ECMAScript mapping of §5.3. Groups do not
|
|
37
|
+
* capture: I-Regexp only answers whether a string matches.
|
|
38
|
+
*
|
|
39
|
+
* Iterative over an explicit group stack; O(source length) time and memory.
|
|
40
|
+
*
|
|
41
|
+
* @param onSyntaxError - Receives errors created by this parse, before they are
|
|
42
|
+
* thrown.
|
|
43
|
+
* @throws {IRegexpSyntaxError} If `source` is not an I-Regexp, including a lone
|
|
44
|
+
* surrogate anywhere in it.
|
|
45
|
+
* @throws {RegexLimitExceededError} If groups nest deeper than
|
|
46
|
+
* `maxNestingDepth`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseIRegexp_(source: string, maxNestingDepth: number, budget: WorkBudget, onSyntaxError?: Callable<[error: IRegex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;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,UAAU,EAClB,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,GACnD,YAAY,CAwSd"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { ASTERISK, BACKSLASH, CARET, COMMA, compareDecimalDigits, CR, DOLLAR, HT, HYPHEN_MINUS, isAsciiDigit, isSurrogate, saturatingDecimalToNumber, LEFT_CURLY_BRACKET, LEFT_PARENTHESIS, LEFT_SQUARE_BRACKET, LF, LOWERCASE_N, LOWERCASE_P, LOWERCASE_R, LOWERCASE_T, PERIOD, PLUS, QUESTION_MARK, RIGHT_CURLY_BRACKET, RIGHT_PARENTHESIS, RIGHT_SQUARE_BRACKET, SUPPLEMENTARY_PLANE_START, UPPERCASE_P, VERTICAL_BAR, } from "@ac-kit/core";
|
|
2
|
+
import { UNICODE_CATEGORY_TESTS_ } from "./_unicode-category.js";
|
|
3
|
+
import { IRegexpSyntaxError } from "./iregexp-syntax-error.js";
|
|
4
|
+
import { RegexLimitExceededError } from "./limits.js";
|
|
5
|
+
import { classPredicate_ } from "./vm/_class-predicate.js";
|
|
6
|
+
/** The identity: a node is its own Thompson shape. */
|
|
7
|
+
export const shapeOfIRegexpNode_ = (node) => node;
|
|
8
|
+
/** Code points that are not a NormalChar (RFC 9485 §3), surrogates aside. */
|
|
9
|
+
const NOT_NORMAL_CHARS_ = new Set([
|
|
10
|
+
LEFT_PARENTHESIS,
|
|
11
|
+
RIGHT_PARENTHESIS,
|
|
12
|
+
ASTERISK,
|
|
13
|
+
PLUS,
|
|
14
|
+
PERIOD,
|
|
15
|
+
QUESTION_MARK,
|
|
16
|
+
LEFT_SQUARE_BRACKET,
|
|
17
|
+
BACKSLASH,
|
|
18
|
+
RIGHT_SQUARE_BRACKET,
|
|
19
|
+
LEFT_CURLY_BRACKET,
|
|
20
|
+
VERTICAL_BAR,
|
|
21
|
+
RIGHT_CURLY_BRACKET,
|
|
22
|
+
]);
|
|
23
|
+
/** Code points that are not a CCchar (RFC 9485 §3), surrogates aside. */
|
|
24
|
+
const NOT_CLASS_CHARS_ = new Set([
|
|
25
|
+
HYPHEN_MINUS,
|
|
26
|
+
LEFT_SQUARE_BRACKET,
|
|
27
|
+
BACKSLASH,
|
|
28
|
+
RIGHT_SQUARE_BRACKET,
|
|
29
|
+
]);
|
|
30
|
+
/** SingleCharEsc (RFC 9485 §3): the escaped code point to what it stands for. */
|
|
31
|
+
const SINGLE_CHAR_ESCAPES_ = new Map([
|
|
32
|
+
[LEFT_PARENTHESIS, LEFT_PARENTHESIS],
|
|
33
|
+
[RIGHT_PARENTHESIS, RIGHT_PARENTHESIS],
|
|
34
|
+
[ASTERISK, ASTERISK],
|
|
35
|
+
[PLUS, PLUS],
|
|
36
|
+
[HYPHEN_MINUS, HYPHEN_MINUS],
|
|
37
|
+
[PERIOD, PERIOD],
|
|
38
|
+
[QUESTION_MARK, QUESTION_MARK],
|
|
39
|
+
[LEFT_SQUARE_BRACKET, LEFT_SQUARE_BRACKET],
|
|
40
|
+
[BACKSLASH, BACKSLASH],
|
|
41
|
+
[RIGHT_SQUARE_BRACKET, RIGHT_SQUARE_BRACKET],
|
|
42
|
+
[CARET, CARET],
|
|
43
|
+
[LOWERCASE_N, LF],
|
|
44
|
+
[LOWERCASE_R, CR],
|
|
45
|
+
[LOWERCASE_T, HT],
|
|
46
|
+
[LEFT_CURLY_BRACKET, LEFT_CURLY_BRACKET],
|
|
47
|
+
[VERTICAL_BAR, VERTICAL_BAR],
|
|
48
|
+
[RIGHT_CURLY_BRACKET, RIGHT_CURLY_BRACKET],
|
|
49
|
+
]);
|
|
50
|
+
/** I-Regexp's `.`: any code point but `\n` and `\r` (RFC 9485 §5.3). */
|
|
51
|
+
const isDotUnit_ = (unit) => unit !== "\n" && unit !== "\r";
|
|
52
|
+
const DOT_ = {
|
|
53
|
+
kind: "emit",
|
|
54
|
+
instruction: { op: "predicate", test: isDotUnit_, label: "." },
|
|
55
|
+
};
|
|
56
|
+
const START_ = {
|
|
57
|
+
kind: "emit",
|
|
58
|
+
instruction: { op: "assertStart" },
|
|
59
|
+
};
|
|
60
|
+
const END_ = { kind: "emit", instruction: { op: "assertEnd" } };
|
|
61
|
+
const literalNode_ = (codePoint) => ({
|
|
62
|
+
kind: "emit",
|
|
63
|
+
instruction: { op: "char", char: String.fromCodePoint(codePoint) },
|
|
64
|
+
});
|
|
65
|
+
const categoryNode_ = (category) => ({
|
|
66
|
+
kind: "emit",
|
|
67
|
+
instruction: {
|
|
68
|
+
op: "predicate",
|
|
69
|
+
test: (unit) => category.test.test(unit) !== category.negated,
|
|
70
|
+
label: `\\${category.negated ? "P" : "p"}{${category.name}}`,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const categoryKey_ = (category) => `${category.negated ? "P" : "p"}${category.name}`;
|
|
74
|
+
function classNode_(negated, bounds, categories, budget) {
|
|
75
|
+
const extraTests = [...categories.values()].map((category) => (unit) => category.test.test(unit) !== category.negated);
|
|
76
|
+
return {
|
|
77
|
+
kind: "emit",
|
|
78
|
+
instruction: classPredicate_(negated, bounds, extraTests, negated ? "[^...]" : "[...]", budget),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const closeBranch_ = (frame) => frame.items.length === 1
|
|
82
|
+
? frame.items[0]
|
|
83
|
+
: { kind: "sequence", items: frame.items };
|
|
84
|
+
function closeAlternation_(frame) {
|
|
85
|
+
const last = closeBranch_(frame);
|
|
86
|
+
return frame.alternatives.length === 0
|
|
87
|
+
? last
|
|
88
|
+
: { kind: "choice", alternatives: [...frame.alternatives, last] };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Parses an I-Regexp (RFC 9485 §3), checking the grammar exactly, into the
|
|
92
|
+
* shape the Thompson compiler reads.
|
|
93
|
+
*
|
|
94
|
+
* Two departures from the literal grammar, both what the JSONPath compliance
|
|
95
|
+
* suite expects: `^` and `$` outside a class are start and end anchors rather
|
|
96
|
+
* than ordinary characters, as in the ECMAScript mapping of §5.3. Groups do not
|
|
97
|
+
* capture: I-Regexp only answers whether a string matches.
|
|
98
|
+
*
|
|
99
|
+
* Iterative over an explicit group stack; O(source length) time and memory.
|
|
100
|
+
*
|
|
101
|
+
* @param onSyntaxError - Receives errors created by this parse, before they are
|
|
102
|
+
* thrown.
|
|
103
|
+
* @throws {IRegexpSyntaxError} If `source` is not an I-Regexp, including a lone
|
|
104
|
+
* surrogate anywhere in it.
|
|
105
|
+
* @throws {RegexLimitExceededError} If groups nest deeper than
|
|
106
|
+
* `maxNestingDepth`.
|
|
107
|
+
*/
|
|
108
|
+
export function parseIRegexp_(source, maxNestingDepth, budget, onSyntaxError) {
|
|
109
|
+
let cursor = 0;
|
|
110
|
+
const fail = (message, start, end = start + 1) => {
|
|
111
|
+
const error = new IRegexpSyntaxError(message, {
|
|
112
|
+
start,
|
|
113
|
+
end: Math.min(end, source.length),
|
|
114
|
+
});
|
|
115
|
+
onSyntaxError?.(error);
|
|
116
|
+
throw error;
|
|
117
|
+
};
|
|
118
|
+
const codePointAt = (position) => source.codePointAt(position);
|
|
119
|
+
const widthOf = (codePoint) => codePoint >= SUPPLEMENTARY_PLANE_START ? 2 : 1;
|
|
120
|
+
/** Reads a `\` escape outside `\p`/`\P`: a SingleCharEsc. */
|
|
121
|
+
const readSingleCharEscape = (start) => {
|
|
122
|
+
const escaped = codePointAt(start + 1);
|
|
123
|
+
if (escaped === undefined)
|
|
124
|
+
return fail("Trailing backslash", start);
|
|
125
|
+
const meaning = SINGLE_CHAR_ESCAPES_.get(escaped);
|
|
126
|
+
if (meaning === undefined) {
|
|
127
|
+
return fail(`'\\${String.fromCodePoint(escaped)}' is not an I-Regexp escape`, start, start + 1 + widthOf(escaped));
|
|
128
|
+
}
|
|
129
|
+
cursor = start + 2;
|
|
130
|
+
return meaning;
|
|
131
|
+
};
|
|
132
|
+
/** Reads `\p{…}`/`\P{…}` at `start`, or answers undefined if it is not one. */
|
|
133
|
+
const readCategoryEscape = (start) => {
|
|
134
|
+
const letter = source.charCodeAt(start + 1);
|
|
135
|
+
if (letter !== LOWERCASE_P && letter !== UPPERCASE_P)
|
|
136
|
+
return undefined;
|
|
137
|
+
if (source.charCodeAt(start + 2) !== LEFT_CURLY_BRACKET) {
|
|
138
|
+
return fail("Expected '{' after '\\p' or '\\P'", start, start + 3);
|
|
139
|
+
}
|
|
140
|
+
// Names are one or two letters, so the closing brace is looked for at
|
|
141
|
+
// those two places only and never scanned for.
|
|
142
|
+
const nameLength = source.charCodeAt(start + 4) === RIGHT_CURLY_BRACKET
|
|
143
|
+
? 1
|
|
144
|
+
: source.charCodeAt(start + 5) === RIGHT_CURLY_BRACKET
|
|
145
|
+
? 2
|
|
146
|
+
: 0;
|
|
147
|
+
const name = source.slice(start + 3, start + 3 + nameLength);
|
|
148
|
+
const test = nameLength === 0 ? undefined : UNICODE_CATEGORY_TESTS_.get(name);
|
|
149
|
+
if (test === undefined) {
|
|
150
|
+
return fail("Expected a Unicode general category such as 'L' or 'Nd' in '\\p{…}'", start, start + 3 + Math.max(nameLength, 1));
|
|
151
|
+
}
|
|
152
|
+
cursor = start + 4 + nameLength;
|
|
153
|
+
return { test, negated: letter === UPPERCASE_P, name };
|
|
154
|
+
};
|
|
155
|
+
/** Reads one CCchar (a class character or a SingleCharEsc). */
|
|
156
|
+
const readClassChar = () => {
|
|
157
|
+
const start = cursor;
|
|
158
|
+
const codePoint = codePointAt(start);
|
|
159
|
+
if (codePoint === undefined)
|
|
160
|
+
return fail("Unterminated character class", start);
|
|
161
|
+
if (codePoint === BACKSLASH) {
|
|
162
|
+
if (readCategoryEscape(start) !== undefined) {
|
|
163
|
+
return fail("A '\\p{…}' escape cannot bound a range", start, cursor);
|
|
164
|
+
}
|
|
165
|
+
return readSingleCharEscape(start);
|
|
166
|
+
}
|
|
167
|
+
if (NOT_CLASS_CHARS_.has(codePoint) || isSurrogate(codePoint)) {
|
|
168
|
+
return fail(`'${String.fromCodePoint(codePoint)}' must be escaped in a character class`, start);
|
|
169
|
+
}
|
|
170
|
+
cursor = start + widthOf(codePoint);
|
|
171
|
+
return codePoint;
|
|
172
|
+
};
|
|
173
|
+
const readClass = () => {
|
|
174
|
+
const open = cursor;
|
|
175
|
+
cursor++;
|
|
176
|
+
let negated = false;
|
|
177
|
+
if (source.charCodeAt(cursor) === CARET) {
|
|
178
|
+
negated = true;
|
|
179
|
+
cursor++;
|
|
180
|
+
}
|
|
181
|
+
const bounds = [];
|
|
182
|
+
// Keyed by category and polarity: a class listing one category 65 536
|
|
183
|
+
// times tests it once.
|
|
184
|
+
const categories = new Map();
|
|
185
|
+
let first = true;
|
|
186
|
+
for (;;) {
|
|
187
|
+
const position = cursor;
|
|
188
|
+
const codePoint = source.charCodeAt(position);
|
|
189
|
+
if (position >= source.length) {
|
|
190
|
+
return fail("Unterminated character class", open, position);
|
|
191
|
+
}
|
|
192
|
+
if (codePoint === RIGHT_SQUARE_BRACKET) {
|
|
193
|
+
if (first) {
|
|
194
|
+
return fail("Empty character class", open, position + 1);
|
|
195
|
+
}
|
|
196
|
+
cursor++;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
if (codePoint === HYPHEN_MINUS) {
|
|
200
|
+
if (position + 1 >= source.length) {
|
|
201
|
+
return fail("Unterminated character class", open, position + 1);
|
|
202
|
+
}
|
|
203
|
+
// '-' is a literal only first or last in the class.
|
|
204
|
+
if (!first &&
|
|
205
|
+
source.charCodeAt(position + 1) !== RIGHT_SQUARE_BRACKET) {
|
|
206
|
+
return fail("'-' must be escaped unless it is first or last in a character class", position);
|
|
207
|
+
}
|
|
208
|
+
bounds.push(HYPHEN_MINUS, HYPHEN_MINUS);
|
|
209
|
+
cursor++;
|
|
210
|
+
first = false;
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
first = false;
|
|
214
|
+
if (codePoint === BACKSLASH) {
|
|
215
|
+
const category = readCategoryEscape(position);
|
|
216
|
+
if (category !== undefined) {
|
|
217
|
+
categories.set(categoryKey_(category), category);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const from = readClassChar();
|
|
222
|
+
if (source.charCodeAt(cursor) === HYPHEN_MINUS &&
|
|
223
|
+
source.charCodeAt(cursor + 1) !== RIGHT_SQUARE_BRACKET &&
|
|
224
|
+
cursor + 1 < source.length) {
|
|
225
|
+
cursor++;
|
|
226
|
+
const to = readClassChar();
|
|
227
|
+
if (to < from) {
|
|
228
|
+
return fail("Character class range is out of order", position, cursor);
|
|
229
|
+
}
|
|
230
|
+
bounds.push(from, to);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
bounds.push(from, from);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return classNode_(negated, bounds, categories, budget);
|
|
237
|
+
};
|
|
238
|
+
const readQuantity = () => {
|
|
239
|
+
const start = cursor;
|
|
240
|
+
while (isAsciiDigit(source.charCodeAt(cursor)))
|
|
241
|
+
cursor++;
|
|
242
|
+
if (cursor === start)
|
|
243
|
+
return fail("Expected a number in '{…}'", start);
|
|
244
|
+
return source.slice(start, cursor);
|
|
245
|
+
};
|
|
246
|
+
/** Wraps `atom` in the quantifier following it, if any. */
|
|
247
|
+
const readQuantifier = (atom) => {
|
|
248
|
+
const start = cursor;
|
|
249
|
+
const codePoint = source.charCodeAt(start);
|
|
250
|
+
let min;
|
|
251
|
+
let max;
|
|
252
|
+
if (codePoint === ASTERISK) {
|
|
253
|
+
min = 0;
|
|
254
|
+
max = undefined;
|
|
255
|
+
cursor++;
|
|
256
|
+
}
|
|
257
|
+
else if (codePoint === PLUS) {
|
|
258
|
+
min = 1;
|
|
259
|
+
max = undefined;
|
|
260
|
+
cursor++;
|
|
261
|
+
}
|
|
262
|
+
else if (codePoint === QUESTION_MARK) {
|
|
263
|
+
min = 0;
|
|
264
|
+
max = 1;
|
|
265
|
+
cursor++;
|
|
266
|
+
}
|
|
267
|
+
else if (codePoint === LEFT_CURLY_BRACKET) {
|
|
268
|
+
cursor++;
|
|
269
|
+
const minText = readQuantity();
|
|
270
|
+
let maxText = minText;
|
|
271
|
+
if (source.charCodeAt(cursor) === COMMA) {
|
|
272
|
+
cursor++;
|
|
273
|
+
maxText = isAsciiDigit(source.charCodeAt(cursor))
|
|
274
|
+
? readQuantity()
|
|
275
|
+
: undefined;
|
|
276
|
+
}
|
|
277
|
+
if (source.charCodeAt(cursor) !== RIGHT_CURLY_BRACKET) {
|
|
278
|
+
return fail("Expected '}' closing the quantifier", cursor);
|
|
279
|
+
}
|
|
280
|
+
cursor++;
|
|
281
|
+
// Ordered on the digits, before any rounding to a number.
|
|
282
|
+
if (maxText !== undefined && compareDecimalDigits(maxText, minText) < 0) {
|
|
283
|
+
return fail(`Quantifier max (${maxText}) is less than min (${minText})`, start, cursor);
|
|
284
|
+
}
|
|
285
|
+
min = saturatingDecimalToNumber(minText);
|
|
286
|
+
max =
|
|
287
|
+
maxText === undefined ? undefined : saturatingDecimalToNumber(maxText);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
return atom;
|
|
291
|
+
}
|
|
292
|
+
return { kind: "repeat", body: atom, min, max, lazy: false };
|
|
293
|
+
};
|
|
294
|
+
const frames = [{ open: undefined, alternatives: [], items: [] }];
|
|
295
|
+
for (;;) {
|
|
296
|
+
const frame = frames[frames.length - 1];
|
|
297
|
+
const start = cursor;
|
|
298
|
+
const codePoint = codePointAt(start);
|
|
299
|
+
if (codePoint === undefined) {
|
|
300
|
+
if (frame.open !== undefined) {
|
|
301
|
+
return fail("Unterminated group", frame.open, start);
|
|
302
|
+
}
|
|
303
|
+
return closeAlternation_(frame);
|
|
304
|
+
}
|
|
305
|
+
switch (codePoint) {
|
|
306
|
+
case VERTICAL_BAR:
|
|
307
|
+
cursor++;
|
|
308
|
+
frame.alternatives.push(closeBranch_(frame));
|
|
309
|
+
frame.items = [];
|
|
310
|
+
continue;
|
|
311
|
+
case LEFT_PARENTHESIS:
|
|
312
|
+
if (frames.length > maxNestingDepth) {
|
|
313
|
+
throw new RegexLimitExceededError("nestingDepth", maxNestingDepth);
|
|
314
|
+
}
|
|
315
|
+
cursor++;
|
|
316
|
+
frames.push({ open: start, alternatives: [], items: [] });
|
|
317
|
+
continue;
|
|
318
|
+
case RIGHT_PARENTHESIS: {
|
|
319
|
+
if (frame.open === undefined)
|
|
320
|
+
return fail("Unmatched ')'", start);
|
|
321
|
+
cursor++;
|
|
322
|
+
frames.pop();
|
|
323
|
+
frames[frames.length - 1].items.push(readQuantifier(closeAlternation_(frame)));
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
case ASTERISK:
|
|
327
|
+
case PLUS:
|
|
328
|
+
case QUESTION_MARK:
|
|
329
|
+
case LEFT_CURLY_BRACKET:
|
|
330
|
+
return fail(`Nothing to repeat before '${String.fromCodePoint(codePoint)}'`, start);
|
|
331
|
+
case LEFT_SQUARE_BRACKET:
|
|
332
|
+
frame.items.push(readQuantifier(readClass()));
|
|
333
|
+
continue;
|
|
334
|
+
case PERIOD:
|
|
335
|
+
cursor++;
|
|
336
|
+
frame.items.push(readQuantifier(DOT_));
|
|
337
|
+
continue;
|
|
338
|
+
case CARET:
|
|
339
|
+
cursor++;
|
|
340
|
+
frame.items.push(readQuantifier(START_));
|
|
341
|
+
continue;
|
|
342
|
+
case DOLLAR:
|
|
343
|
+
cursor++;
|
|
344
|
+
frame.items.push(readQuantifier(END_));
|
|
345
|
+
continue;
|
|
346
|
+
case BACKSLASH: {
|
|
347
|
+
const category = readCategoryEscape(start);
|
|
348
|
+
const atom = category === undefined
|
|
349
|
+
? literalNode_(readSingleCharEscape(start))
|
|
350
|
+
: categoryNode_(category);
|
|
351
|
+
frame.items.push(readQuantifier(atom));
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
default:
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
if (NOT_NORMAL_CHARS_.has(codePoint)) {
|
|
358
|
+
return fail(`'${String.fromCodePoint(codePoint)}' must be escaped`, start);
|
|
359
|
+
}
|
|
360
|
+
if (isSurrogate(codePoint)) {
|
|
361
|
+
return fail("A lone surrogate is not an I-Regexp character", start);
|
|
362
|
+
}
|
|
363
|
+
cursor = start + widthOf(codePoint);
|
|
364
|
+
frame.items.push(readQuantifier(literalNode_(codePoint)));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
//# sourceMappingURL=_iregexp-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_iregexp-parse.js","sourceRoot":"","sources":["../src/_iregexp-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,KAAK,EACL,oBAAoB,EACpB,EAAE,EACF,MAAM,EACN,EAAE,EACF,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,EAAE,EACF,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,MAAM,EACN,IAAI,EACJ,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,WAAW,EACX,YAAY,GAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAgC3D,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAClC,IAAkB,EACY,EAAE,CAAC,IAAI,CAAC;AAEvC,6EAA6E;AAC7E,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC;IACtD,gBAAgB;IAChB,iBAAiB;IACjB,QAAQ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