@ac-kit/format-regex 0.2.7 → 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.
Files changed (61) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +89 -13
  3. package/dist/_iregexp-parse.d.ts +50 -0
  4. package/dist/_iregexp-parse.d.ts.map +1 -0
  5. package/dist/_iregexp-parse.js +367 -0
  6. package/dist/_iregexp-parse.js.map +1 -0
  7. package/dist/_unicode-category.d.ts +12 -0
  8. package/dist/_unicode-category.d.ts.map +1 -0
  9. package/dist/_unicode-category.js +49 -0
  10. package/dist/_unicode-category.js.map +1 -0
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/iregexp-syntax-error.d.ts +13 -0
  16. package/dist/iregexp-syntax-error.d.ts.map +1 -0
  17. package/dist/iregexp-syntax-error.js +16 -0
  18. package/dist/iregexp-syntax-error.js.map +1 -0
  19. package/dist/iregexp.d.ts +91 -0
  20. package/dist/iregexp.d.ts.map +1 -0
  21. package/dist/iregexp.js +111 -0
  22. package/dist/iregexp.js.map +1 -0
  23. package/dist/limits.d.ts +25 -8
  24. package/dist/limits.d.ts.map +1 -1
  25. package/dist/limits.js +16 -6
  26. package/dist/limits.js.map +1 -1
  27. package/dist/parser.d.ts +16 -3
  28. package/dist/parser.d.ts.map +1 -1
  29. package/dist/parser.js +100 -66
  30. package/dist/parser.js.map +1 -1
  31. package/dist/printer.d.ts +12 -1
  32. package/dist/printer.d.ts.map +1 -1
  33. package/dist/printer.js +40 -21
  34. package/dist/printer.js.map +1 -1
  35. package/dist/regex.d.ts +43 -6
  36. package/dist/regex.d.ts.map +1 -1
  37. package/dist/regex.js +25 -10
  38. package/dist/regex.js.map +1 -1
  39. package/dist/vm/_class-predicate.d.ts +27 -0
  40. package/dist/vm/_class-predicate.d.ts.map +1 -0
  41. package/dist/vm/_class-predicate.js +65 -0
  42. package/dist/vm/_class-predicate.js.map +1 -0
  43. package/dist/vm/_thompson.d.ts +70 -0
  44. package/dist/vm/_thompson.d.ts.map +1 -0
  45. package/dist/vm/_thompson.js +196 -0
  46. package/dist/vm/_thompson.js.map +1 -0
  47. package/dist/vm/compile.d.ts +14 -2
  48. package/dist/vm/compile.d.ts.map +1 -1
  49. package/dist/vm/compile.js +83 -159
  50. package/dist/vm/compile.js.map +1 -1
  51. package/dist/vm/pike-vm.d.ts +38 -8
  52. package/dist/vm/pike-vm.d.ts.map +1 -1
  53. package/dist/vm/pike-vm.js +228 -102
  54. package/dist/vm/pike-vm.js.map +1 -1
  55. package/dist/vm/program.d.ts +29 -4
  56. package/dist/vm/program.d.ts.map +1 -1
  57. package/dist/walk.d.ts +7 -1
  58. package/dist/walk.d.ts.map +1 -1
  59. package/dist/walk.js +9 -3
  60. package/dist/walk.js.map +1 -1
  61. package/package.json +4 -3
@@ -0,0 +1,70 @@
1
+ import type { WorkBudget } from "@ac-kit/core";
2
+ import type { Instruction } from "./program.js";
3
+ /**
4
+ * How the Thompson construction sees one syntax node, whatever tree it comes
5
+ * from: the public syntax tree and the I-Regexp front end each describe their
6
+ * nodes in these five shapes, and children stay in the caller's own node type
7
+ * until the compiler reaches them.
8
+ */
9
+ export type ThompsonShape<TNode> = {
10
+ readonly kind: "emit";
11
+ readonly instruction: Instruction;
12
+ } | {
13
+ readonly kind: "capture";
14
+ readonly index: number;
15
+ readonly body: TNode;
16
+ } | {
17
+ readonly kind: "sequence";
18
+ readonly items: readonly TNode[];
19
+ } | {
20
+ readonly kind: "choice";
21
+ readonly alternatives: readonly TNode[];
22
+ } | {
23
+ readonly kind: "repeat";
24
+ readonly body: TNode;
25
+ readonly min: number;
26
+ /** `undefined` means unbounded. */
27
+ readonly max: number | undefined;
28
+ readonly lazy: boolean;
29
+ };
30
+ /**
31
+ * Emits instructions and patches forward-jump targets once their destination is
32
+ * known.
33
+ */
34
+ export declare class ProgramBuilder {
35
+ private readonly maxProgramSize;
36
+ private readonly instructions;
37
+ constructor(maxProgramSize: number);
38
+ get length(): number;
39
+ /** @throws {RegexLimitExceededError} If the program outgrows its bound. */
40
+ emit(instruction: Instruction): number;
41
+ patchJmp(index: number, target: number): void;
42
+ patchSplit(index: number, first: number, second: number): void;
43
+ toInstructions(): readonly Instruction[];
44
+ }
45
+ /**
46
+ * Emits the Thompson construction of `root` into `builder`, iteratively.
47
+ *
48
+ * An explicit task stack replaces the recursion over the tree, over the
49
+ * alternatives of a choice and over the copies of a counted repetition, so
50
+ * neither a deep tree nor `a{1,100000}` nor `a|a|…|a` grows the JavaScript
51
+ * stack. A task is either a node still to lower or a continuation that emits
52
+ * the instructions following a node and patches the jumps around it; the
53
+ * instruction layout is the one the recursive construction produced.
54
+ *
55
+ * A repetition whose body emitted nothing (an empty group) stops after its
56
+ * first copy: every further copy would emit nothing too, and skipping them
57
+ * keeps `(?:){1000000000}` from looping a billion times.
58
+ *
59
+ * A sequence is scheduled one item at a time, so a wide node costs no more
60
+ * stack than a narrow one. O(tasks) time and O(tree depth + pending
61
+ * continuations) memory: every task is charged one unit to `budget`, every
62
+ * patched jump one more, `shapeOf` charges whatever it builds, and every
63
+ * emitted instruction is checked against the builder's program-size bound.
64
+ *
65
+ * @throws {RegexLimitExceededError} If the program outgrows the builder's
66
+ * bound.
67
+ * @throws Whatever `budget.spend` throws once the work allowance is spent.
68
+ */
69
+ export declare function emitThompson<TNode>(builder: ProgramBuilder, root: TNode, shapeOf: (node: TNode, budget: WorkBudget) => ThompsonShape<TNode>, budget: WorkBudget): void;
70
+ //# sourceMappingURL=_thompson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_thompson.d.ts","sourceRoot":"","sources":["../../src/vm/_thompson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;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AS,WAAW,EAAE,CAEvC;CACD;AAOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,KAAK,aAAa,CAAC,KAAK,CAAC,EAClE,MAAM,EAAE,UAAU,GAChB,IAAI,CAyJN"}
@@ -0,0 +1,196 @@
1
+ import { RegexLimitExceededError } from "../limits.js";
2
+ /**
3
+ * Emits instructions and patches forward-jump targets once their destination is
4
+ * known.
5
+ */
6
+ export class ProgramBuilder {
7
+ maxProgramSize;
8
+ instructions = [];
9
+ constructor(maxProgramSize) {
10
+ this.maxProgramSize = maxProgramSize;
11
+ }
12
+ get length() {
13
+ return this.instructions.length;
14
+ }
15
+ /** @throws {RegexLimitExceededError} If the program outgrows its bound. */
16
+ emit(instruction) {
17
+ // Checked here rather than after building: a counted quantifier emits its
18
+ // copies one at a time, so the array never grows past the bound.
19
+ if (this.instructions.length >= this.maxProgramSize) {
20
+ throw new RegexLimitExceededError("programSize", this.maxProgramSize);
21
+ }
22
+ this.instructions.push(instruction);
23
+ return this.instructions.length - 1;
24
+ }
25
+ patchJmp(index, target) {
26
+ this.instructions[index] = { op: "jmp", target };
27
+ }
28
+ patchSplit(index, first, second) {
29
+ this.instructions[index] = { op: "split", first, second };
30
+ }
31
+ toInstructions() {
32
+ return this.instructions;
33
+ }
34
+ }
35
+ /**
36
+ * Emits the Thompson construction of `root` into `builder`, iteratively.
37
+ *
38
+ * An explicit task stack replaces the recursion over the tree, over the
39
+ * alternatives of a choice and over the copies of a counted repetition, so
40
+ * neither a deep tree nor `a{1,100000}` nor `a|a|…|a` grows the JavaScript
41
+ * stack. A task is either a node still to lower or a continuation that emits
42
+ * the instructions following a node and patches the jumps around it; the
43
+ * instruction layout is the one the recursive construction produced.
44
+ *
45
+ * A repetition whose body emitted nothing (an empty group) stops after its
46
+ * first copy: every further copy would emit nothing too, and skipping them
47
+ * keeps `(?:){1000000000}` from looping a billion times.
48
+ *
49
+ * A sequence is scheduled one item at a time, so a wide node costs no more
50
+ * stack than a narrow one. O(tasks) time and O(tree depth + pending
51
+ * continuations) memory: every task is charged one unit to `budget`, every
52
+ * patched jump one more, `shapeOf` charges whatever it builds, and every
53
+ * emitted instruction is checked against the builder's program-size bound.
54
+ *
55
+ * @throws {RegexLimitExceededError} If the program outgrows the builder's
56
+ * bound.
57
+ * @throws Whatever `budget.spend` throws once the work allowance is spent.
58
+ */
59
+ export function emitThompson(builder, root, shapeOf, budget) {
60
+ const tasks = [{ kind: "node", node: root }];
61
+ const pushNode = (node) => {
62
+ tasks.push({ kind: "node", node });
63
+ };
64
+ const pushThen = (run) => {
65
+ tasks.push({ kind: "then", run });
66
+ };
67
+ const patchSplitsTo = (splits, bodyStarts, lazy) => {
68
+ budget.spend(splits.length);
69
+ const end = builder.length;
70
+ for (let index = 0; index < splits.length; index++) {
71
+ const bodyStart = bodyStarts[index];
72
+ // Greedy prefers another copy (bodyStart first); lazy prefers leaving.
73
+ if (lazy)
74
+ builder.patchSplit(splits[index], end, bodyStart);
75
+ else
76
+ builder.patchSplit(splits[index], bodyStart, end);
77
+ }
78
+ };
79
+ const scheduleChoice = (alternatives, index, exitJumps) => {
80
+ if (index === alternatives.length - 1) {
81
+ pushThen(() => {
82
+ budget.spend(exitJumps.length);
83
+ for (const jump of exitJumps)
84
+ builder.patchJmp(jump, builder.length);
85
+ });
86
+ pushNode(alternatives[index]);
87
+ return;
88
+ }
89
+ // split first, second ; first: <alt> ; jmp end ; second: <rest...> ; end:
90
+ const splitIndex = builder.emit({ op: "split", first: -1, second: -1 });
91
+ const firstStart = builder.length;
92
+ pushThen(() => {
93
+ exitJumps.push(builder.emit({ op: "jmp", target: -1 }));
94
+ builder.patchSplit(splitIndex, firstStart, builder.length);
95
+ scheduleChoice(alternatives, index + 1, exitJumps);
96
+ });
97
+ pushNode(alternatives[index]);
98
+ };
99
+ // body*: split top, end ; top: <body> ; jmp split ; end:
100
+ const scheduleStar = (body, lazy) => {
101
+ const splitIndex = builder.emit({ op: "split", first: -1, second: -1 });
102
+ const bodyStart = builder.length;
103
+ pushThen(() => {
104
+ builder.emit({ op: "jmp", target: splitIndex });
105
+ patchSplitsTo([splitIndex], [bodyStart], lazy);
106
+ });
107
+ pushNode(body);
108
+ };
109
+ // `count` nested optional copies: skipping copy i also skips every copy
110
+ // after it, so every split exits to the end of the whole chain.
111
+ const scheduleOptionalChain = (body, count, lazy) => {
112
+ const splits = [];
113
+ const bodyStarts = [];
114
+ const scheduleCopy = (remaining) => {
115
+ if (!(remaining > 0)) {
116
+ patchSplitsTo(splits, bodyStarts, lazy);
117
+ return;
118
+ }
119
+ splits.push(builder.emit({ op: "split", first: -1, second: -1 }));
120
+ const bodyStart = builder.length;
121
+ bodyStarts.push(bodyStart);
122
+ pushThen(() => {
123
+ if (builder.length === bodyStart) {
124
+ patchSplitsTo(splits, bodyStarts, lazy);
125
+ return;
126
+ }
127
+ scheduleCopy(remaining - 1);
128
+ });
129
+ pushNode(body);
130
+ };
131
+ scheduleCopy(count);
132
+ };
133
+ const scheduleRepeat = (body, min, max, lazy) => {
134
+ const scheduleMandatoryCopy = (copy) => {
135
+ if (!(copy < min)) {
136
+ if (max === undefined)
137
+ scheduleStar(body, lazy);
138
+ else
139
+ scheduleOptionalChain(body, max - min, lazy);
140
+ return;
141
+ }
142
+ const before = builder.length;
143
+ pushThen(() => {
144
+ if (builder.length === before)
145
+ return;
146
+ scheduleMandatoryCopy(copy + 1);
147
+ });
148
+ pushNode(body);
149
+ };
150
+ scheduleMandatoryCopy(0);
151
+ };
152
+ while (tasks.length > 0) {
153
+ budget.spend(1);
154
+ const task = tasks.pop();
155
+ if (task.kind === "then") {
156
+ task.run();
157
+ continue;
158
+ }
159
+ if (task.kind === "items") {
160
+ if (task.next < task.items.length) {
161
+ const item = task.items[task.next];
162
+ task.next++;
163
+ tasks.push(task);
164
+ pushNode(item);
165
+ }
166
+ continue;
167
+ }
168
+ const shape = shapeOf(task.node, budget);
169
+ switch (shape.kind) {
170
+ case "emit":
171
+ builder.emit(shape.instruction);
172
+ break;
173
+ case "capture": {
174
+ const slot = shape.index * 2;
175
+ builder.emit({ op: "save", slot });
176
+ pushThen(() => {
177
+ builder.emit({ op: "save", slot: slot + 1 });
178
+ });
179
+ pushNode(shape.body);
180
+ break;
181
+ }
182
+ case "sequence":
183
+ tasks.push({ kind: "items", items: shape.items, next: 0 });
184
+ break;
185
+ case "choice":
186
+ if (shape.alternatives.length > 0) {
187
+ scheduleChoice(shape.alternatives, 0, []);
188
+ }
189
+ break;
190
+ case "repeat":
191
+ scheduleRepeat(shape.body, shape.min, shape.max, shape.lazy);
192
+ break;
193
+ }
194
+ }
195
+ }
196
+ //# sourceMappingURL=_thompson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_thompson.js","sourceRoot":"","sources":["../../src/vm/_thompson.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAuBvD;;;GAGG;AACH,MAAM,OAAO,cAAc;IAGG,cAAc;IAF1B,YAAY,GAAkB,EAAE,CAAC;IAElD,YAA6B,cAAsB;8BAAtB,cAAc;IAAW,CAAC;IAEvD,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IACjC,CAAC;IAED,2EAA2E;IAC3E,IAAI,CAAC,WAAwB;QAC5B,0EAA0E;QAC1E,iEAAiE;QACjE,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACrD,MAAM,IAAI,uBAAuB,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG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AO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;gBAC3D,MAAM;YACP,KAAK,QAAQ;gBACZ,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACnC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC3C,CAAC;gBACD,MAAM;YACP,KAAK,QAAQ;gBACZ,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7D,MAAM;QACR,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type WorkBudget } from "@ac-kit/core";
1
2
  import type { RegexPattern } from "../ast.js";
2
3
  import type { RegexProgram } from "./program.js";
3
4
  /**
@@ -11,9 +12,20 @@ import type { RegexProgram } from "./program.js";
11
12
  * open with `^` (those simply fail `assertStart` at every offset but 0, which
12
13
  * is correct, just not the fastest possible instruction count for that case).
13
14
  *
15
+ * Iterative: neither the depth of the tree, the number of alternatives nor a
16
+ * repetition count grows the JavaScript stack, so a hand-built tree of any
17
+ * shape compiles or fails with a typed error. O(syntax nodes lowered) time,
18
+ * where a counted repetition lowers its body once per copy; O(program size)
19
+ * memory.
20
+ *
14
21
  * @param maxProgramSize - Most instructions the program may hold; see
15
22
  * `RegexLimits.maxProgramSize`, whose default this takes.
16
- * @throws {RegexLimitExceededError} If the program outgrows `maxProgramSize`.
23
+ * @param budget - Charged one unit per syntax node lowered: a step bound
24
+ * (`RegexLimits.maxSteps`'s default when omitted), or a `WorkBudget`
25
+ * (`@ac-kit/core`) shared with other calls.
26
+ * @throws {RegexLimitExceededError} If the program outgrows `maxProgramSize`,
27
+ * or the lowering outgrows a numeric step bound.
28
+ * @throws Whatever a caller's own `budget.spend` throws.
17
29
  */
18
- export declare function compileProgram(pattern: RegexPattern, maxProgramSize?: number): RegexProgram;
30
+ export declare function compileProgram(pattern: RegexPattern, maxProgramSize?: number, budget?: number | WorkBudget): RegexProgram;
19
31
  //# sourceMappingURL=compile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/vm/compile.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGX,YAAY,EAGZ,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AA8M9D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,YAAY,EACrB,cAAc,GAAE,MAA4C,GAC1D,YAAY,CAkBd"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/vm/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,UAAU,EAEf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAGX,YAAY,EAEZ,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AA6G9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,YAAY,EACrB,cAAc,GAAE,MAA4C,EAC5D,MAAM,GAAE,MAAM,GAAG,UAA0C,GACzD,YAAY,CAMd"}
@@ -1,5 +1,7 @@
1
- import { isAsciiAlphaNumeric, isAsciiDigit, isAsciiWhitespace, } from "@ac-kit/core";
2
- import { DEFAULT_REGEX_LIMITS, RegexLimitExceededError } from "../limits.js";
1
+ import { isAsciiAlphaNumeric, isAsciiDigit, isAsciiWhitespace, withWorkBudget, } from "@ac-kit/core";
2
+ import { DEFAULT_REGEX_LIMITS, stepsExceeded_ } from "../limits.js";
3
+ import { classPredicate_ } from "./_class-predicate.js";
4
+ import { emitThompson, ProgramBuilder, } from "./_thompson.js";
3
5
  const isWordChar = (char) => isAsciiAlphaNumeric(char.charCodeAt(0)) || char === "_";
4
6
  const SHORTHAND_PREDICATES = {
5
7
  d: (char) => isAsciiDigit(char.charCodeAt(0)),
@@ -9,175 +11,83 @@ const SHORTHAND_PREDICATES = {
9
11
  s: (char) => isAsciiWhitespace(char.charCodeAt(0)),
10
12
  S: (char) => !isAsciiWhitespace(char.charCodeAt(0)),
11
13
  };
12
- function compileCharClassPredicate(negated, items) {
13
- const singles = new Set();
14
- const ranges = [];
15
- const shorthands = [];
14
+ /** The shorthand tests of a class, once each, in a fixed order. */
15
+ const SHORTHAND_ORDER_ = [
16
+ "d",
17
+ "D",
18
+ "w",
19
+ "W",
20
+ "s",
21
+ "S",
22
+ ];
23
+ function compileCharClass_(negated, items, budget) {
24
+ // Charged before any per-item work, so a huge preparsed class is refused
25
+ // before it is read.
26
+ budget.spend(items.length);
27
+ const bounds = [];
28
+ const shorthands = new Set();
16
29
  for (const item of items) {
17
- if (item.kind === "char")
18
- singles.add(item.char);
19
- else if (item.kind === "range")
20
- ranges.push({ from: item.from, to: item.to });
21
- else
22
- shorthands.push(item.value);
23
- }
24
- const test = (char) => {
25
- if (singles.has(char))
26
- return true;
27
- for (const range of ranges) {
28
- if (char >= range.from && char <= range.to)
29
- return true;
30
+ if (item.kind === "char") {
31
+ const unit = item.char.codePointAt(0);
32
+ bounds.push(unit, unit);
30
33
  }
31
- for (const shorthand of shorthands) {
32
- if (SHORTHAND_PREDICATES[shorthand](char))
33
- return true;
34
+ else if (item.kind === "range") {
35
+ bounds.push(item.from.codePointAt(0), item.to.codePointAt(0));
34
36
  }
35
- return false;
36
- };
37
- return negated ? (char) => !test(char) : test;
38
- }
39
- /**
40
- * Emits instructions and patches forward-jump targets once their destination is
41
- * known.
42
- */
43
- class ProgramBuilder {
44
- maxProgramSize;
45
- instructions = [];
46
- constructor(maxProgramSize) {
47
- this.maxProgramSize = maxProgramSize;
48
- }
49
- get length() {
50
- return this.instructions.length;
51
- }
52
- emit(instruction) {
53
- // Checked here rather than after building: a counted quantifier emits its
54
- // copies one at a time, so the array never grows past the bound.
55
- if (this.instructions.length >= this.maxProgramSize) {
56
- throw new RegexLimitExceededError("programSize", this.maxProgramSize);
37
+ else {
38
+ shorthands.add(item.value);
57
39
  }
58
- this.instructions.push(instruction);
59
- return this.instructions.length - 1;
60
40
  }
61
- patchJmp(index, target) {
62
- this.instructions[index] = { op: "jmp", target };
63
- }
64
- patchSplit(index, first, second) {
65
- this.instructions[index] = { op: "split", first, second };
66
- }
67
- toInstructions() {
68
- return this.instructions;
41
+ const extraTests = [];
42
+ if (shorthands.size > 0) {
43
+ for (const value of SHORTHAND_ORDER_) {
44
+ if (shorthands.has(value))
45
+ extraTests.push(SHORTHAND_PREDICATES[value]);
46
+ }
69
47
  }
48
+ return classPredicate_(negated, bounds, extraTests, negated ? "[^...]" : "[...]", budget);
70
49
  }
71
- function compileNode(builder, node) {
50
+ function shapeOfRegexNode_(node, budget) {
72
51
  switch (node.kind) {
73
52
  case "literal":
74
- builder.emit({ op: "char", char: node.char });
75
- return;
53
+ return { kind: "emit", instruction: { op: "char", char: node.char } };
76
54
  case "any":
77
- builder.emit({ op: "any" });
78
- return;
55
+ return { kind: "emit", instruction: { op: "any" } };
79
56
  case "shorthand":
80
- builder.emit({
81
- op: "predicate",
82
- test: SHORTHAND_PREDICATES[node.value],
83
- label: `\\${node.value}`,
84
- });
85
- return;
57
+ return {
58
+ kind: "emit",
59
+ instruction: {
60
+ op: "predicate",
61
+ test: SHORTHAND_PREDICATES[node.value],
62
+ label: `\\${node.value}`,
63
+ },
64
+ };
86
65
  case "anchor":
87
- builder.emit(node.type === "start" ? { op: "assertStart" } : { op: "assertEnd" });
88
- return;
89
- case "charClass": {
90
- const test = compileCharClassPredicate(node.negated, node.items);
91
- builder.emit({
92
- op: "predicate",
93
- test,
94
- label: node.negated ? "[^...]" : "[...]",
95
- });
96
- return;
97
- }
98
- case "group": {
99
- if (node.capturing) {
100
- const slot = node.index * 2;
101
- builder.emit({ op: "save", slot });
102
- compileNode(builder, node.body);
103
- builder.emit({ op: "save", slot: slot + 1 });
104
- }
105
- else {
106
- compileNode(builder, node.body);
107
- }
108
- return;
109
- }
66
+ return {
67
+ kind: "emit",
68
+ instruction: node.type === "start" ? { op: "assertStart" } : { op: "assertEnd" },
69
+ };
70
+ case "charClass":
71
+ return {
72
+ kind: "emit",
73
+ instruction: compileCharClass_(node.negated, node.items, budget),
74
+ };
75
+ case "group":
76
+ return node.capturing
77
+ ? { kind: "capture", index: node.index, body: node.body }
78
+ : { kind: "sequence", items: [node.body] };
110
79
  case "concat":
111
- for (const item of node.items)
112
- compileNode(builder, item);
113
- return;
80
+ return { kind: "sequence", items: node.items };
114
81
  case "alternation":
115
- compileAlternation(builder, node.alternatives);
116
- return;
82
+ return { kind: "choice", alternatives: node.alternatives };
117
83
  case "quantified":
118
- compileQuantified(builder, node);
119
- return;
120
- }
121
- }
122
- function compileAlternation(builder, alternatives) {
123
- if (alternatives.length === 1) {
124
- compileNode(builder, alternatives[0]);
125
- return;
126
- }
127
- // split first, second ; first: <alt0> ; jmp end ; second: <rest...> ; end:
128
- const splitIndex = builder.emit({ op: "split", first: -1, second: -1 });
129
- const firstStart = builder.length;
130
- compileNode(builder, alternatives[0]);
131
- const jmpIndex = builder.emit({ op: "jmp", target: -1 });
132
- const secondStart = builder.length;
133
- builder.patchSplit(splitIndex, firstStart, secondStart);
134
- compileAlternation(builder, alternatives.slice(1));
135
- builder.patchJmp(jmpIndex, builder.length);
136
- }
137
- /**
138
- * `body*`/`body+`'s unbounded tail: `split top, end ; top: <body> ; jmp split ;
139
- * end:`.
140
- */
141
- function compileStar(builder, body, lazy) {
142
- const splitIndex = builder.emit({ op: "split", first: -1, second: -1 });
143
- const bodyStart = builder.length;
144
- compileNode(builder, body);
145
- builder.emit({ op: "jmp", target: splitIndex });
146
- const afterLoop = builder.length;
147
- // Greedy prefers repeating (bodyStart first); lazy prefers exiting (afterLoop first).
148
- if (lazy)
149
- builder.patchSplit(splitIndex, afterLoop, bodyStart);
150
- else
151
- builder.patchSplit(splitIndex, bodyStart, afterLoop);
152
- }
153
- /**
154
- * `count` nested optional copies of `body` — the bounded tail of `{min,max}`.
155
- *
156
- * Nesting means skipping copy _i_ also skips every copy after it, since they
157
- * are only reachable through copy _i_'s own body.
158
- */
159
- function compileOptionalChain(builder, body, count, lazy) {
160
- if (count === 0)
161
- return;
162
- const splitIndex = builder.emit({ op: "split", first: -1, second: -1 });
163
- const bodyStart = builder.length;
164
- compileNode(builder, body);
165
- compileOptionalChain(builder, body, count - 1, lazy);
166
- const afterAll = builder.length;
167
- if (lazy)
168
- builder.patchSplit(splitIndex, afterAll, bodyStart);
169
- else
170
- builder.patchSplit(splitIndex, bodyStart, afterAll);
171
- }
172
- function compileQuantified(builder, node) {
173
- const { body, min, max, lazy } = node;
174
- for (let i = 0; i < min; i++)
175
- compileNode(builder, body);
176
- if (max === undefined) {
177
- compileStar(builder, body, lazy);
178
- }
179
- else {
180
- compileOptionalChain(builder, body, max - min, lazy);
84
+ return {
85
+ kind: "repeat",
86
+ body: node.body,
87
+ min: node.min,
88
+ max: node.max,
89
+ lazy: node.lazy,
90
+ };
181
91
  }
182
92
  }
183
93
  /**
@@ -191,16 +101,30 @@ function compileQuantified(builder, node) {
191
101
  * open with `^` (those simply fail `assertStart` at every offset but 0, which
192
102
  * is correct, just not the fastest possible instruction count for that case).
193
103
  *
104
+ * Iterative: neither the depth of the tree, the number of alternatives nor a
105
+ * repetition count grows the JavaScript stack, so a hand-built tree of any
106
+ * shape compiles or fails with a typed error. O(syntax nodes lowered) time,
107
+ * where a counted repetition lowers its body once per copy; O(program size)
108
+ * memory.
109
+ *
194
110
  * @param maxProgramSize - Most instructions the program may hold; see
195
111
  * `RegexLimits.maxProgramSize`, whose default this takes.
196
- * @throws {RegexLimitExceededError} If the program outgrows `maxProgramSize`.
112
+ * @param budget - Charged one unit per syntax node lowered: a step bound
113
+ * (`RegexLimits.maxSteps`'s default when omitted), or a `WorkBudget`
114
+ * (`@ac-kit/core`) shared with other calls.
115
+ * @throws {RegexLimitExceededError} If the program outgrows `maxProgramSize`,
116
+ * or the lowering outgrows a numeric step bound.
117
+ * @throws Whatever a caller's own `budget.spend` throws.
197
118
  */
198
- export function compileProgram(pattern, maxProgramSize = DEFAULT_REGEX_LIMITS.maxProgramSize) {
119
+ export function compileProgram(pattern, maxProgramSize = DEFAULT_REGEX_LIMITS.maxProgramSize, budget = DEFAULT_REGEX_LIMITS.maxSteps) {
120
+ return withWorkBudget(budget, (work) => compileWithin_(pattern, maxProgramSize, work), stepsExceeded_);
121
+ }
122
+ function compileWithin_(pattern, maxProgramSize, budget) {
199
123
  const builder = new ProgramBuilder(maxProgramSize);
200
124
  const scanSplitIndex = builder.emit({ op: "split", first: -1, second: -1 });
201
125
  const tryStart = builder.length;
202
126
  builder.emit({ op: "save", slot: 0 });
203
- compileNode(builder, pattern.body);
127
+ emitThompson(builder, pattern.body, shapeOfRegexNode_, budget);
204
128
  builder.emit({ op: "save", slot: 1 });
205
129
  builder.emit({ op: "match" });
206
130
  const consumeStart = builder.length;
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/vm/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,GACjB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG7E,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE,CAC5C,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,GAAG,CAAC;AAEzD,MAAM,oBAAoB,GAEtB;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAA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