parseman 0.52.0 → 0.54.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 (108) hide show
  1. package/dist/analysis/diagnostics.js +636 -126
  2. package/dist/analysis/diagnostics.js.map +3 -3
  3. package/dist/cli/index.js +6191 -6274
  4. package/dist/cli/index.js.map +3 -3
  5. package/dist/combinators/field-trivia.d.ts +40 -0
  6. package/dist/combinators/field-trivia.d.ts.map +1 -0
  7. package/dist/combinators/map.d.ts +19 -2
  8. package/dist/combinators/map.d.ts.map +1 -1
  9. package/dist/combinators/parser.d.ts +34 -0
  10. package/dist/combinators/parser.d.ts.map +1 -1
  11. package/dist/combinators/ref.d.ts +0 -13
  12. package/dist/combinators/ref.d.ts.map +1 -1
  13. package/dist/combinators/repeat.d.ts.map +1 -1
  14. package/dist/combinators/sequence.d.ts.map +1 -1
  15. package/dist/compiler/borrowed-rules.d.ts +30 -0
  16. package/dist/compiler/borrowed-rules.d.ts.map +1 -0
  17. package/dist/compiler/compile-linkable-table.d.ts +1 -1
  18. package/dist/compiler/fields.d.ts +2 -0
  19. package/dist/compiler/fields.d.ts.map +1 -1
  20. package/dist/compiler/grammar-coverage-ids.d.ts.map +1 -1
  21. package/dist/compiler/ir-serialize.d.ts +10 -4
  22. package/dist/compiler/ir-serialize.d.ts.map +1 -1
  23. package/dist/compiler/linker.d.ts +48 -91
  24. package/dist/compiler/linker.d.ts.map +1 -1
  25. package/dist/coverage.d.ts +1 -1
  26. package/dist/coverage.d.ts.map +1 -1
  27. package/dist/cst/reflection.d.ts.map +1 -1
  28. package/dist/cst/trivia-charscan.d.ts +11 -3
  29. package/dist/cst/trivia-charscan.d.ts.map +1 -1
  30. package/dist/cst/trivia-kinds.d.ts +11 -0
  31. package/dist/cst/trivia-kinds.d.ts.map +1 -1
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +764 -888
  35. package/dist/index.js.map +3 -3
  36. package/dist/language-service/index.js.map +1 -1
  37. package/dist/plugin/evaluator.d.ts +38 -2
  38. package/dist/plugin/evaluator.d.ts.map +1 -1
  39. package/dist/plugin/index.d.ts.map +1 -1
  40. package/dist/plugin/index.js +1443 -729
  41. package/dist/plugin/index.js.map +3 -3
  42. package/dist/plugin/ir-eval.d.ts +21 -0
  43. package/dist/plugin/ir-eval.d.ts.map +1 -0
  44. package/dist/plugin/reducer-resolver.d.ts +6 -0
  45. package/dist/plugin/reducer-resolver.d.ts.map +1 -1
  46. package/dist/spec/index.js +555 -6109
  47. package/dist/spec/index.js.map +3 -3
  48. package/dist/spec/railroad-lib.d.ts +7 -2
  49. package/dist/spec/railroad-lib.d.ts.map +1 -1
  50. package/dist/spec/railroad.d.ts.map +1 -1
  51. package/dist/table/assemble.d.ts +9 -0
  52. package/dist/table/assemble.d.ts.map +1 -1
  53. package/dist/table/compile-rule-map.d.ts +11 -4
  54. package/dist/table/compile-rule-map.d.ts.map +1 -1
  55. package/dist/table/compile.d.ts +16 -0
  56. package/dist/table/compile.d.ts.map +1 -1
  57. package/dist/table/emit-assembly.d.ts +1 -1
  58. package/dist/table/emit-assembly.d.ts.map +1 -1
  59. package/dist/table/emit.d.ts +6 -2
  60. package/dist/table/emit.d.ts.map +1 -1
  61. package/dist/table/encode.d.ts.map +1 -1
  62. package/dist/table/exec.d.ts.map +1 -1
  63. package/dist/table/field-spec.d.ts +13 -0
  64. package/dist/table/field-spec.d.ts.map +1 -0
  65. package/dist/table/index.js +480 -199
  66. package/dist/table/index.js.map +2 -2
  67. package/dist/table/scalar-terminal.d.ts +11 -0
  68. package/dist/table/scalar-terminal.d.ts.map +1 -1
  69. package/dist/types.d.ts +14 -0
  70. package/dist/types.d.ts.map +1 -1
  71. package/dist/version.d.ts +1 -1
  72. package/package.json +1 -1
  73. package/src/analysis/duplication.ts +1 -1
  74. package/src/analysis/rebuild.ts +1 -1
  75. package/src/combinators/field-trivia.ts +44 -0
  76. package/src/combinators/map.ts +48 -6
  77. package/src/combinators/parser.ts +133 -67
  78. package/src/combinators/ref.ts +10 -1
  79. package/src/combinators/repeat.ts +6 -1
  80. package/src/combinators/sequence.ts +9 -1
  81. package/src/compiler/borrowed-rules.ts +88 -0
  82. package/src/compiler/compile-linkable-table.ts +1 -1
  83. package/src/compiler/fields.ts +5 -2
  84. package/src/compiler/grammar-coverage-ids.ts +35 -6
  85. package/src/compiler/ir-serialize.ts +19 -119
  86. package/src/compiler/linker.ts +190 -666
  87. package/src/coverage.ts +7 -5
  88. package/src/cst/reflection.ts +6 -1
  89. package/src/cst/trivia-charscan.ts +17 -56
  90. package/src/cst/trivia-kinds.ts +24 -8
  91. package/src/index.ts +1 -0
  92. package/src/plugin/evaluator.ts +114 -14
  93. package/src/plugin/index.ts +588 -110
  94. package/src/plugin/ir-eval.ts +165 -0
  95. package/src/plugin/reducer-resolver.ts +20 -3
  96. package/src/spec/railroad-lib.ts +18 -8
  97. package/src/spec/railroad.ts +3 -4
  98. package/src/table/assemble.ts +126 -22
  99. package/src/table/compile-rule-map.ts +18 -8
  100. package/src/table/compile.ts +61 -0
  101. package/src/table/emit-assembly.ts +38 -18
  102. package/src/table/emit.ts +15 -4
  103. package/src/table/encode.ts +18 -2
  104. package/src/table/exec.ts +15 -1
  105. package/src/table/field-spec.ts +17 -0
  106. package/src/table/scalar-terminal.ts +25 -0
  107. package/src/types.ts +12 -2
  108. package/src/version.ts +1 -1
@@ -0,0 +1,40 @@
1
+ import type { Combinator } from '../types.ts';
2
+ /**
3
+ * Where the trivia before a `field(…, { leadingTrivia: true })` began.
4
+ *
5
+ * A sequence or separated list skips the trivia before a term and calls the
6
+ * term at the first byte after it, so the term cannot see where the gap
7
+ * started. The boundary that calls such a field writes its pre-trivia cursor
8
+ * here immediately before the call, and the field reads it and resets it to −1
9
+ * on entry, before its own child can run another boundary. Nothing else writes
10
+ * it, so a field reached any other way reads −1 and records no leading trivia.
11
+ *
12
+ * ONE per process, like `FAIL`: the write and the read are adjacent in one
13
+ * synchronous call, and every engine (the interpreter included) must agree on
14
+ * the same cell when one calls another.
15
+ */
16
+ export declare const LEAD: {
17
+ at: number;
18
+ };
19
+ /** Option bits of a trivia-attributing `field()`, as the table carries them. */
20
+ export declare const FIELD_LEADING_TRIVIA = 1;
21
+ export declare const FIELD_TRAILING_TRIVIA = 2;
22
+ /**
23
+ * The capture a trivia-attributing field pushes. `leadFrom` is the cursor before
24
+ * the trivia its boundary skipped (−1 when it was not called from one), and
25
+ * `trailEnd` the end of the trivia it consumed after its match. One spelling for
26
+ * every engine, so the captures agree byte for byte.
27
+ */
28
+ export declare function triviaFieldCapture(name: string, value: unknown, input: string, start: number, end: number, leadFrom: number, trailEnd: number): {
29
+ name: string;
30
+ value: unknown;
31
+ span: {
32
+ start: number;
33
+ end: number;
34
+ };
35
+ leading: string;
36
+ trailing: string;
37
+ };
38
+ /** Is `p` a `field(…, { leadingTrivia: true })` — the term itself, not wrapped? */
39
+ export declare function leadsTrivia(p: Combinator<unknown>): boolean;
40
+ //# sourceMappingURL=field-trivia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-trivia.d.ts","sourceRoot":"","sources":["../../src/combinators/field-trivia.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAe,CAAA;AAE9C,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,IAAI,CAAA;AACrC,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAC1G;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAQ3G;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAE3D"}
@@ -21,9 +21,26 @@ export declare function classifiedTrivia(arms: Readonly<Record<string, Combinato
21
21
  * trivia-kind capture (`'whitespace'`, `'blockComment'`, …).
22
22
  */
23
23
  export declare function label<T>(name: string, combinator: Combinator<T>): Combinator<T>;
24
+ export type FieldOptions = {
25
+ /**
26
+ * Record, as the capture's `leading`, the source text of the trivia that the
27
+ * enclosing `sequence()` (as any term after the first) or separated list (as
28
+ * its separator) skipped right before this field. A comment written before a
29
+ * `,` belongs to no term, so a builder could only read it from its node's
30
+ * trivia log; this hands it to the separator instead. The field must be the
31
+ * term or separator itself, not wrapped; anywhere else `leading` is `''`.
32
+ */
33
+ leadingTrivia?: boolean;
34
+ /**
35
+ * After the match, consume the trivia that follows (as `node({ trailingTrivia })`
36
+ * does) and record its source text as the capture's `trailing`.
37
+ */
38
+ trailingTrivia?: boolean;
39
+ };
24
40
  /**
25
41
  * Capture a named parse result for the nearest enclosing node() builder.
26
- * Parse behavior and the normal returned value are unchanged.
42
+ * Parse behavior and the normal returned value are unchanged, except that
43
+ * `trailingTrivia` also consumes the trivia after the match.
27
44
  */
28
- export declare function field<T>(name: string, combinator: Combinator<T>): Combinator<T>;
45
+ export declare function field<T>(name: string, combinator: Combinator<T>, opts?: FieldOptions): Combinator<T>;
29
46
  //# sourceMappingURL=map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/combinators/map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU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D,UAAU,CAAC,CAAC,CAAC,CAiEf;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAkBlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GAClD,UAAU,CAAC,OAAO,CAAC,CAqBrB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAW/E;AAED,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,CAmCpG"}
@@ -94,5 +94,39 @@ type RuleMapNodeTag<T extends Record<string, Combinator<unknown>>> = {
94
94
  type RulesResult<T extends Record<string, Combinator<unknown>>> = T & GrammarWithReflection<RuleMapNodeType<T>, RuleMapNodeTag<T>>;
95
95
  export declare function rules<T extends Record<string, Combinator<unknown>>>(factory: (self: any) => T): RulesResult<T>;
96
96
  export declare function rules<T extends Record<string, Combinator<unknown>>>(options: RulesOptions, factory: (self: any) => T): RulesResult<T>;
97
+ /**
98
+ * The recipe a `rules()` result was built from — its factory and options —
99
+ * non-enumerable, in piece order. Runtime `compose()` links grammars by running
100
+ * these again against ONE shared namespace (`linkRules`), which is what makes a
101
+ * composition the same graph as one `rules()` written over every piece. A
102
+ * composed result carries the concatenated list, so it composes again.
103
+ */
104
+ export declare const RULES_RECIPE: unique symbol;
105
+ export type RulesRecipe = {
106
+ readonly factory: (self: Record<string, Combinator<unknown>>) => Record<string, Combinator<unknown>>;
107
+ readonly options: RulesOptions | undefined;
108
+ };
109
+ /**
110
+ * How a composition overrides its pieces' own options: the composing grammar's
111
+ * trivia governs every rule (composing-wins), and an explicit host mode wins
112
+ * over each piece's.
113
+ */
114
+ export type LinkOptions = {
115
+ readonly trivia?: Combinator<unknown> | undefined;
116
+ readonly hostMode?: HostMode | undefined;
117
+ };
118
+ /**
119
+ * Build ONE rule map from one or more recipes, run in order against a single
120
+ * shared namespace, a later recipe's definition winning per rule name.
121
+ *
122
+ * `rules()` is the one-recipe case. Runtime `compose()` passes every piece's
123
+ * recipe plus `link`: each `g.X` in every factory then resolves to the one
124
+ * composed slot for X, so an override reroutes a base piece's own calls (open
125
+ * recursion) and every choice computes its first-set dispatch against the
126
+ * winners. The graph is built fresh, so no shared rule of any piece is touched;
127
+ * under `link` a winner is always held in a fresh slot, so the stamps below never
128
+ * land on a combinator a factory returned from module scope either.
129
+ */
130
+ export declare function linkRules(recipes: readonly RulesRecipe[], link?: LinkOptions): Record<string, Combinator<unknown>>;
97
131
  export {};
98
132
  //# sourceMappingURL=parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/combinators/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAInD,OAAO,EAA4B,QAAQ,EAAE,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAGhH;;;;GAIG;AACH,eAAO,MAAM,UAAU,wBAAwB,CAAA;AA0B/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG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CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAC/G,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AAatI;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,eAAqC,CAAA;AAC9D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IACpG,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAAA;CAC3C,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CACzC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,IAAI,CAAC,EAAE,WAAW,GACjB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAwHrC"}
@@ -1,17 +1,4 @@
1
1
  import type { Combinator } from '../types.ts';
2
- /**
3
- * Create a forward-declared parser slot for mutually recursive grammars.
4
- *
5
- * Because JS evaluates arguments eagerly, you can't reference a variable
6
- * before it's declared. ref() creates a placeholder you fill in later:
7
- *
8
- * const value = ref<JSONValue>()
9
- * const array = transform(sequence(literal('['), sepBy(value, literal(',')), literal(']')), ...)
10
- * const object = transform(sequence(literal('{'), sepBy(pair, literal(',')), literal('}')), ...)
11
- * value.define(choice(object, array, string, number, bool, nullVal))
12
- *
13
- * Unlike lazy(() => x), you use the ref directly — no wrapping at each call site.
14
- */
15
2
  export declare function ref<T>(): Combinator<T> & {
16
3
  define(p: Combinator<T>): void;
17
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../src/combinators/ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAepF;;;;;;;;;;;;GAYG;AACH,wBAAgB,GAAG,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;CAAE,CAmG3E"}
1
+ {"version":3,"file":"ref.d.ts","sourceRoot":"","sources":["../../src/combinators/ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAqCpF,wBAAgB,GAAG,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;CAAE,CAmG3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/combinators/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkD,MAAM,aAAa,CAAA;AAwF7F,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAiCD;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,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FAAiF;IACjF,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B,CAAA;AAED,uFAAuF;AACvF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAAE,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE3E;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EACxB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EAC9C,IAAI,GAAE,YAAiB,GACtB,UAAU,CAAC,CAAC,EAAE,CAAC,CAqNjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../src/combinators/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAoD,MAAM,aAAa,CAAA;AAW/F,KAAK,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI;KACnD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAC7D,CAAA;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAChF,GAAG,OAAO,EAAE,CAAC,GACZ,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAyI9B"}
1
+ {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../src/combinators/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAoD,MAAM,aAAa,CAAA;AAY/F,KAAK,aAAa,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI;KACnD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAC7D,CAAA;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,EAChF,GAAG,OAAO,EAAE,CAAC,GACZ,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAgJ9B"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Where the interpreter and a compiled table would bind one reference differently.
3
+ *
4
+ * A rule reference (`g.X`) is a slot object. The interpreter follows the slot it
5
+ * holds. The table encoder binds a reference to the map's rule of the same NAME
6
+ * (`encode.ts`, `winners`). Within one linked map the two are the same rule. They
7
+ * differ only for a rule object BORROWED from another grammar (`Entry: base.Entry`):
8
+ * its graph holds `base`'s own slots, so the interpreter keeps `base`'s `Atom` while
9
+ * the encoder binds this map's `Atom`. Both parse, and they accept different input.
10
+ *
11
+ * ponytail: refuses the pattern instead of rebinding borrowed graphs, which is the
12
+ * planned follow-up that lets both engines agree.
13
+ */
14
+ import type { Combinator } from '../types.ts';
15
+ type Comb = Combinator<unknown>;
16
+ /**
17
+ * The first rule of `map` whose graph reaches another grammar's slot for a rule
18
+ * `map` also defines — the rule, and the name it references — or `undefined`.
19
+ */
20
+ export declare function borrowedRuleReference(map: Readonly<Record<string, Comb>>): {
21
+ rule: string;
22
+ reference: string;
23
+ } | undefined;
24
+ /** The refusal, worded for the API that refused. */
25
+ export declare function borrowedRuleMessage(api: string, hit: {
26
+ rule: string;
27
+ reference: string;
28
+ }): string;
29
+ export {};
30
+ //# sourceMappingURL=borrowed-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"borrowed-rules.d.ts","sourceRoot":"","sources":["../../src/compiler/borrowed-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI7C,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;AAe/B;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAwCjD;AAED,oDAAoD;AACpD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMjG"}
@@ -26,7 +26,7 @@ import type { TableProgram, TableRule } from '../table/program.ts';
26
26
  * composable half, and it is NOT new machinery: the plugin
27
27
  * already carries pieces as IR (`plugin/index.ts:1772`) and
28
28
  * the linker already re-lowers them (`linker.ts:640`,
29
- * `compileLinkable(evalRuleMapIR(p.ir), …)`).
29
+ * `compileLinkable(evalRuleMapIR(p.ir), …)` at build time).
30
30
  *
31
31
  * ── WHY THAT MAKES COMPOSITION THE EASY KIND ─────────────────────────────────
32
32
  * The open question was whether table-to-table composition has to merge two
@@ -44,6 +44,8 @@ export declare function buildFieldMap(captures: ReadonlyArray<{
44
44
  start: number;
45
45
  end: number;
46
46
  };
47
+ leading?: string;
48
+ trailing?: string;
47
49
  }> | undefined): FieldMap | undefined;
48
50
  export {};
49
51
  //# sourceMappingURL=fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/compiler/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA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/compiler/grammar-coverage-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAGxD,MAAM,MAAM,yBAAyB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc,GAAG,OAAO,CAAA;CAAE,CAAA;AAC9G,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,SAAS,yBAAyB,EAAE,CAAA;IACjD,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACpD,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACvD;gFAC4E;IAC5E,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACnD,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;CACxC,CAAA;AAuDD;;yCAEyC;AACzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,mBAAmB,CA8DhK"}
1
+ {"version":3,"file":"grammar-coverage-ids.d.ts","sourceRoot":"","sources":["../../src/compiler/grammar-coverage-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAGxD,MAAM,MAAM,yBAAyB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc,GAAG,OAAO,CAAA;CAAE,CAAA;AAC9G,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,SAAS,yBAAyB,EAAE,CAAA;IACjD,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACpD,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACvD;gFAC4E;IAC5E,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,CAAA;IACnD,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAA;CACxC,CAAA;AA0DD;;yCAEyC;AACzC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,mBAAmB,CAwFhK"}
@@ -20,9 +20,15 @@
20
20
  import type { Combinator } from '../types.ts';
21
21
  type Comb = Combinator<unknown>;
22
22
  export declare function serializeRuleMap(ruleMap: ReadonlyArray<readonly [string, Comb]>, scanSkip?: readonly Comb[] | null): string | null;
23
- /** Reconstruct a rule map from serialized IR (the inverse of `serializeRuleMap`) —
24
- * evaluate the combinator-construction expression with every constructor in scope.
25
- * Used at fuse time (runtime linker + build-time plugin) to re-lower carried IR. */
26
- export declare function evalRuleMapIR(ir: string): Array<[string, Comb]>;
23
+ /**
24
+ * ONE plain combinator as IR — what a compiled module carries on an exported terminal
25
+ * so another module can import it into a grammar (the macro evaluates grammars, and a
26
+ * compiled parser function is not a combinator it can evaluate).
27
+ *
28
+ * No new format: it is `serializeRuleMap`'s `scanSkip` channel over an empty map, which
29
+ * already serializes rule-free terminals OUTSIDE any factory — exactly this shape. Its
30
+ * inverse, `evalCombinatorIR`, evaluates source and so lives in `src/plugin/ir-eval.ts`.
31
+ */
32
+ export declare function serializeCombinator(c: Comb): string | null;
27
33
  export {};
28
34
  //# sourceMappingURL=ir-serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ir-serialize.d.ts","sourceRoot":"","sources":["../../src/compiler/ir-serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,aAAa,CAAA;AAuB7E,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;AAsG/B,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAC/C,QAAQ,CAAC,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAChC,MAAM,GAAG,IAAI,CAUf;AAED;;oFAEoF;AACpF,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAkH/D"}
1
+ {"version":3,"file":"ir-serialize.d.ts","sourceRoot":"","sources":["../../src/compiler/ir-serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAkC,MAAM,aAAa,CAAA;AAuB7E,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;AAsG/B,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAC/C,QAAQ,CAAC,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAChC,MAAM,GAAG,IAAI,CAUf;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAE1D"}
@@ -48,30 +48,15 @@ export { FUSED_HOST_MODE, FUSED_HOST_ELIDED } from '../cst/host-mode.ts';
48
48
  export declare function fusedHostModeOf(registry: object): HostMode;
49
49
  /** Whether a fused/composed rule map dropped any direct builder's CST branch. */
50
50
  export declare function fusedHostElidedOf(registry: object): boolean;
51
- /**
52
- * Compose grammars/artifacts into a runnable parser map — the ONLY public
53
- * composition entry point. `compose([base, ext, …])`: later entries override
54
- * earlier ones by rule name, and because fusion re-binds every reference in one
55
- * shared scope, an override reroutes the base's OWN calls too (open recursion).
56
- *
57
- * Each entry may be a **grammar** (a `rules()` result — a map of combinators,
58
- * linkable-ified here) OR an already-compiled **linkable artifact** (what the
59
- * macro emits and a package ships). So a package needs no opt-in wrapper to be
60
- * composable — `compose([importedGrammar, myRules])` just works.
61
- *
62
- * The macro compiles `compose([...])` to STATIC fused source (no `new Function`).
63
- * Called at runtime (no macro, like `compile()`) it fuses via `new Function`.
64
- */
65
- /** A composed parser carries its flattened source pieces (non-enumerable) so it
66
- * can be composed AGAIN — `compose([lessGrammar, delta])` where `lessGrammar` is
67
- * itself a `compose([...])` result. */
51
+ /** The carried pieces a BUILD-compiled (`compose()` under the macro) grammar
52
+ * holds: its pieces as serialized IR, re-lowered by the macro plugin at build
53
+ * time. A runtime composition carries recipes instead (`RULES_RECIPE`). */
68
54
  export declare const COMPOSED_PIECES: unique symbol;
69
- /** The carried pieces a `compose()`/`composeLeaf()` result holds, or `undefined` when
70
- * the value is not a composed grammar. This is what makes a fused grammar analysable:
71
- * the pieces are re-lowerable IR even though the fused map itself is only functions. */
55
+ /** The carried pieces a build-compiled composed grammar holds, or `undefined`
56
+ * when the value is not one. */
72
57
  export declare function composedPiecesOf(grammar: Record<string, unknown>): ReadonlyArray<LinkableTable | IRPiece> | undefined;
73
- /** The compact IR form a grammar carries instead of its lowered rule source: the
74
- * combinator-construction expression, re-lowered here at fuse time. */
58
+ /** The compact IR form a build-compiled grammar carries: the combinator-construction
59
+ * expression, re-lowered by the macro plugin at build time. */
75
60
  export type IRPiece = {
76
61
  ns: string;
77
62
  ir: string;
@@ -90,7 +75,7 @@ export declare function once<T>(fn: () => T): () => T;
90
75
  * where the skip must be REPORTED — a diagnostic that drops part of the grammar and
91
76
  * then returns a clean result is indistinguishable from one that verified it. */
92
77
  export declare function carriedRuleMaps(carried: ReadonlyArray<LinkableTable | IRPiece>): Array<Array<[string, Combinator<unknown>]>>;
93
- /** `carriedRuleMaps` plus the pieces it could NOT re-lower, named by namespace and
78
+ /** `carriedRuleMaps` plus the pieces it could NOT recover, named by namespace and
94
79
  * rule count, so a caller can report exactly how much of the grammar went unseen. */
95
80
  export declare function carriedRuleMapsDetailed(carried: ReadonlyArray<LinkableTable | IRPiece>): {
96
81
  maps: Array<Array<[string, Combinator<unknown>]>>;
@@ -100,16 +85,10 @@ export declare function carriedRuleMapsDetailed(carried: ReadonlyArray<LinkableT
100
85
  }>;
101
86
  };
102
87
  /**
103
- * Recover the override-winner COMBINATOR map behind a `compose()` result, plus the
104
- * pieces that could not be recovered.
105
- *
106
- * A fused map holds rule functions, so any consumer that walks a combinator graph
107
- * (gating analysis, the spec/EBNF/railroad model) cannot read it directly. The graph
108
- * is not lost, though — `compose()` retains re-lowerable IR — so this is the single
109
- * shared recovery both consumers use. Sharing it is the point: two copies of this
110
- * logic is how one walker gets fixed and the other silently keeps failing.
111
- *
112
- * Returns `undefined` when `grammar` is not a composed result.
88
+ * Recover the override-winner COMBINATOR map behind a BUILD-compiled composed
89
+ * grammar, plus the pieces that could not be recovered. A runtime composition is
90
+ * already a combinator map, so this returns `undefined` for it, exactly as for a
91
+ * plain `rules()` map: walk it directly.
113
92
  */
114
93
  export declare function recoverComposedRules(grammar: Record<string, unknown>): {
115
94
  rules: Map<string, Combinator<unknown>>;
@@ -118,76 +97,54 @@ export declare function recoverComposedRules(grammar: Record<string, unknown>):
118
97
  ruleNames: string[];
119
98
  }>;
120
99
  } | undefined;
121
- /** Return the final override-winner combinator map carried by runtime
122
- * `compose()`, or `undefined` when a precompiled opaque artifact participated.
123
- * This is intentionally internal: callers must not treat it as a parser API. */
100
+ /** The final override-winner combinator map of a runtime composition, or
101
+ * `undefined` for anything else. INTERNAL: coverage tooling only. */
124
102
  export declare function composedCoverageRules(grammar: Record<string, unknown>): Record<string, Combinator<unknown>> | undefined;
103
+ /** The linked winner map a runtime composition's rule belongs to, or `undefined`.
104
+ * Lets a coverage run over ONE composed rule name its choices exactly as
105
+ * `composedGrammarCoverageDefinitions` does. INTERNAL: coverage tooling only. */
106
+ export declare function linkedWinnersOf(rule: Combinator<unknown>): Record<string, Combinator<unknown>> | undefined;
107
+ /**
108
+ * Compose grammars into ONE parser map — the only public composition entry point.
109
+ * `compose([base, ext, …])`: a later entry's rule WINS by name, and because every
110
+ * piece is linked against one namespace, an override reroutes the base's OWN calls
111
+ * too (open recursion).
112
+ *
113
+ * UNDER THE MACRO, `compose([...])` is lowered at BUILD time to a static table.
114
+ *
115
+ * AT RUNTIME it only links (docs/design/runtime-and-size-contract.md, rule 2):
116
+ * every piece's `rules()` factory runs again against one shared namespace, so the
117
+ * result is exactly the interpreter grammar one `rules()` over all the pieces would
118
+ * build. It builds no table, evaluates no source and mutates no piece. Linking is
119
+ * LAZY — the first read of a rule links the whole map once — so `compose()` itself
120
+ * costs a walk of the items' declared names. For speed, `compile()` a rule of it;
121
+ * `compile()` specialises when the environment allows and falls back under CSP.
122
+ */
125
123
  export declare function compose(items: Array<LinkableTable | Record<string, unknown>>,
126
124
  /**
127
- * Compile-time host mode for the fused artifact, same meaning as
128
- * `compile(g, { hostMode })`. Omit (or `'ast'`) for the eval driver — the fused rules
129
- * build through the grammar's own `build` callbacks and carry no positioned-CST
130
- * branch. Pass `'cst'` to fuse a SECOND artifact from the same pieces for the linter /
131
- * IDE / language-service driver. Two compilations of one grammar, decided here, rather
132
- * than one artifact deciding per node on every parse.
125
+ * Host mode for the composed grammar, same meaning as `compile(g, { hostMode })`.
126
+ * The interpreter routes by host at parse time; this records `'cst'` on every rule
127
+ * so `run()` can refuse a mismatched host instead of building the wrong tree.
133
128
  */
134
129
  opts?: {
135
130
  hostMode?: HostMode;
136
- }): Record<string, FusedRule>;
131
+ }): Record<string, Runnable>;
137
132
  /**
138
- * Compose a terminal grammar. This is for a leaf parser that overlays local
139
- * semantic reductions on reusable recognition rules.
140
- *
141
- * Under the macro this lowers to STATIC fused source (functions), exactly like
142
- * `compose()`. It is still macro-only as a *compiled* artifact: without macro
143
- * lowering there is no safe way to keep lexical builders out of carried IR, so it
144
- * never falls back to runtime CODEGEN composition.
145
- *
146
- * Called at runtime (no macro) it returns the INTERPRETED fuse of the same items —
147
- * a combinator map, not a map of compiled functions (`fuseInterpreted`), fused lazily
148
- * per rule name.
133
+ * Compose a TERMINAL grammar: a leaf parser that overlays local semantic reductions
134
+ * on reusable recognition rules. Under the macro it lowers to a static table exactly
135
+ * like `compose()` and must: there is no runtime codegen fallback.
149
136
  *
150
- * THE RETURN TYPE IS `Runnable`, NOT `FusedRule`, BECAUSE BOTH PATHS ARE REAL. A macro
151
- * build yields fused functions; an un-macro'd call yields combinators. `Runnable` is
152
- * already the library's name for "either of those" — it is what `run()` and
153
- * `parseDoc()` take — so the declared type is TRUE on both paths and a caller needs no
154
- * narrowing to use the result. This used to declare `Record<string, FusedRule>` and
155
- * launder the runtime path through an `as unknown as`, which let a caller hold a
156
- * combinator map while the type promised compiled functions.
157
- *
158
- * Do NOT "fix" this by deleting the runtime path. It is load-bearing: the `bench/jess`
159
- * harness family and two differential-gate legs (`emit-identity-one`,
160
- * `scan-shape-oracle-one`) import un-macro'd grammar modules and depend on this lazy
161
- * interpreted fuse, one dialect per process. Whether an un-macro'd `composeLeaf()`
162
- * should exist at all is a separate, open owner question — but while the gates depend
163
- * on it, it exists, and the type says so.
137
+ * At runtime it is the same lazy link as `compose()`, marked terminal. The bench and
138
+ * differential harnesses import un-macro'd grammar modules and run this path.
164
139
  */
165
140
  export declare function composeLeaf(items: Array<LinkableTable | Record<string, unknown>>): Record<string, Runnable>;
166
- /** Whether `map` is an interpreted fuse (a combinator map) rather than a compiled
167
- * `compose()` result (a map of fused functions). INTERNAL — not re-exported from
168
- * `src/index.ts`. A consumer never has to ask this question: what it holds is
169
- * whatever the macro built. Diagnostics that fuse interpreted on purpose do. */
141
+ /** Whether `map` is a runtime composition (a combinator map) rather than a
142
+ * build-compiled one (a table). INTERNAL — diagnostics only. */
170
143
  export declare function isInterpretedFuse(map: object): boolean;
171
144
  /**
172
- * Materialize a composition as a RUNNABLE INTERPRETED rule map — the interpreted
173
- * counterpart of `compose()`, with identical fuse semantics (later piece wins,
174
- * override reroutes the base's own calls, composing trivia governs every rule).
175
- * No codegen, no `new Function`, no macro build step: the result is a plain map of
176
- * combinators that `run()` / `parseDoc()` accept exactly like a fused map.
177
- *
178
- * This is what diagnostics and profiling run against — they must stay in
179
- * interpreted mode, and before this they could not see a composed grammar at all.
180
- *
181
- * Items are the SAME items `compose()`/`composeLeaf()` take: `rules()` maps
182
- * (the intended input), a prior `fuseInterpreted()` result, or a runtime
183
- * `compose()` result (re-lowered from its carried IR — note that carried IR cannot
184
- * materialize direct `node()` builders, so prefer the source maps). A precompiled
185
- * `linkable()` artifact is rejected: it has no combinator graph.
186
- *
187
- * MUTATION: binding a cross-piece hole rewrites the shared placeholder object every
188
- * call site already holds — that IS how an override reaches a base piece's own
189
- * calls. A second, DIFFERENT fusion over the same piece objects therefore throws
190
- * rather than silently rewriting the first one's parser.
145
+ * The linked interpreter map for a composition, as plain combinators — what
146
+ * diagnostics and profiling walk. The same link `compose()` makes, forced now.
147
+ * INTERNAL: not re-exported from `src/index.ts`.
191
148
  */
192
149
  export declare function fuseInterpreted(items: Array<LinkableTable | Record<string, unknown>>, opts?: {
193
150
  hostMode?: HostMode;
@@ -1 +1 @@
1
- {"version":3,"file":"linker.d.ts","sourceRoot":"","sources":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;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrD;;;;GAIG;AACH,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAK1B;AA6BD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACpD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAE1B;AAED;gEACgE;AAChE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACrD,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAGrC"}
@@ -68,7 +68,7 @@ export declare function createGrammarTraceSink(options: {
68
68
  export declare function createGrammarCoverageCollector(definitions: readonly GrammarCoverageDefinition[]): GrammarCoverageCollector;
69
69
  export declare function grammarCoverageDefinitions(entry: Combinator<unknown>, winners?: Record<string, Combinator<unknown>>): readonly GrammarCoverageDefinition[];
70
70
  /** Definitions for a runtime `compose()` result, normalized through its final
71
- * IR winner map. Opaque precompiled pieces intentionally fail rather than
71
+ * winner map. Anything else — a compiled table, a plain map — fails rather than
72
72
  * reporting source-piece identities as though they were final grammar IDs. */
73
73
  export declare function composedGrammarCoverageDefinitions(grammar: Record<string, unknown>, startRule: string): readonly GrammarCoverageDefinition[];
74
74
  export declare function runWithGrammarCoverage(entry: Runnable, input: string,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CACxC,CAAA;AAED,MAAM,MAAM,qBAAqB,CAC/B,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,OAAO,SAAS,MAAM,GAAG,MAAM,IAC7B;IACF,QAAQ,CAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,iBAAiB,CAAA;IACjD,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAA;IAC/B,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AA0FD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAC9D,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9B,iBAAiB,CAmBnB;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,GAAG,iBAAiB,CAepG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAElF;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAE7E"}
@@ -1,21 +1,29 @@
1
1
  import { type CssTriviaVisitor } from './trivia-css-scanner.ts';
2
2
  import type { LabeledTriviaSpec } from './trivia-kinds.ts';
3
3
  export type TriviaArmMatcher = (input: string, pos: number) => number;
4
- /** A direct classified scanner for the four canonical CSS/Less trivia tuples. */
5
- export declare function commonLabeledTriviaVisitor(spec: LabeledTriviaSpec): CssTriviaVisitor | null;
4
+ /** The fields of a spec the char-level lowerings below are computed from. */
5
+ type TriviaArmsSpec = Pick<LabeledTriviaSpec, 'arms' | 'minRepeats'>;
6
+ /**
7
+ * A direct classified scanner for the four canonical CSS/Less trivia tuples.
8
+ * Computed once per spec, by `analyzeLabeledTrivia`, and read off it as
9
+ * `spec.visitor`: a scan never asks again.
10
+ */
11
+ export declare function commonLabeledTriviaVisitor(spec: TriviaArmsSpec): CssTriviaVisitor | null;
6
12
  /**
7
13
  * The character-level matchers for a spec's arms — index-parallel to `spec.arms`,
8
14
  * so a matcher's index IS its kind index — or `null` when any arm has no lowering.
15
+ * Computed once per spec, as `spec.charArms`.
9
16
  *
10
17
  * `spec.minRepeats > 1` is excluded: the loops below report only an END, and a run
11
18
  * that fails a minimum of two must report NOTHING. `classifiedTrivia()` never
12
19
  * produces one, and the combinator path still handles it if a host writes one.
13
20
  */
14
- export declare function charArmsFor(spec: LabeledTriviaSpec): readonly TriviaArmMatcher[] | null;
21
+ export declare function charArmsFor(spec: TriviaArmsSpec): readonly TriviaArmMatcher[] | null;
15
22
  /** End of the trivia run at `cur`, or `cur` when nothing matched. */
16
23
  export declare function charTriviaEnd(input: string, cur: number, arms: readonly TriviaArmMatcher[]): number;
17
24
  /** As `charTriviaEnd`, reporting each chunk with the kind index that matched it. */
18
25
  export declare function charTriviaVisit(input: string, cur: number, arms: readonly TriviaArmMatcher[], visit: (start: number, end: number, kindIndex: number) => void): number;
19
26
  /** The `1 << kindIndex` mask of the categories in the run at `cur`. */
20
27
  export declare function charTriviaKindMask(input: string, cur: number, arms: readonly TriviaArmMatcher[]): number;
28
+ export {};
21
29
  //# sourceMappingURL=trivia-charscan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trivia-charscan.d.ts","sourceRoot":"","sources":["../../src/cst/trivia-charscan.ts"],"names":[],"mappings":"AA4BA,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;AA8MrE,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,IAAI,CAgB3F;AAWD;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pF;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAWnG;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAC7D,MAAM,CAWR;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAYxG"}
@@ -1,4 +1,6 @@
1
1
  import type { Combinator, ParseContext } from '../types.ts';
2
+ import { type TriviaArmMatcher } from './trivia-charscan.ts';
3
+ import type { CssTriviaVisitor } from './trivia-css-scanner.ts';
2
4
  export type TriviaChunk = {
3
5
  start: number;
4
6
  end: number;
@@ -12,6 +14,13 @@ export type LabeledTriviaSpec = {
12
14
  parser: Combinator<unknown>;
13
15
  }>;
14
16
  readonly minRepeats: number;
17
+ /**
18
+ * The spec's char-level scanners, built with it. A scan reads them here: the
19
+ * four-slot memo they used to sit behind thrashed on a grammar with more trivia
20
+ * tables than slots, and rebuilt one on every miss.
21
+ */
22
+ readonly visitor: CssTriviaVisitor | null;
23
+ readonly charArms: readonly TriviaArmMatcher[] | null;
15
24
  };
16
25
  /** Strip `label()` wrapper; returns inner parser for matching. */
17
26
  export declare function peelLabel(p: Combinator<unknown>): {
@@ -23,6 +32,8 @@ export declare function peelLabel(p: Combinator<unknown>): {
23
32
  * (or a single labeled arm), return the label table and matchers.
24
33
  */
25
34
  export declare function analyzeLabeledTrivia(trivia: Combinator<unknown>): LabeledTriviaSpec | null;
35
+ /** A spec, with the char-level scanners every scan of it reads. */
36
+ export declare function labeledTriviaSpec(arms: LabeledTriviaSpec['arms'], minRepeats: number): LabeledTriviaSpec;
26
37
  /** Label table on a `trivia()` combinator, if all arms are labeled. */
27
38
  export declare function triviaKindLabels(trivia: Combinator<unknown> | undefined): readonly string[] | undefined;
28
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"trivia-kinds.d.ts","sourceRoot":"","sources":["../../src/cst/trivia-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM3D,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC,CAAA;IAC/F,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B,CAAA;AA+BD,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAGvG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,iBAAiB,GAAG,IAAI,CAgD1F;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,GAAG,SAA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