parseman 0.32.0 → 0.34.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/dist/analysis/gating.d.ts +66 -1
- package/dist/analysis/gating.d.ts.map +1 -1
- package/dist/combinators/case-fold.d.ts +39 -0
- package/dist/combinators/case-fold.d.ts.map +1 -0
- package/dist/combinators/expect.d.ts.map +1 -1
- package/dist/combinators/first-set.d.ts +38 -11
- package/dist/combinators/first-set.d.ts.map +1 -1
- package/dist/combinators/keywords.d.ts +12 -3
- package/dist/combinators/keywords.d.ts.map +1 -1
- package/dist/combinators/not.d.ts.map +1 -1
- package/dist/combinators/peek.d.ts +27 -0
- package/dist/combinators/peek.d.ts.map +1 -0
- package/dist/combinators/repeat.d.ts +68 -3
- package/dist/combinators/repeat.d.ts.map +1 -1
- package/dist/combinators/trivia-skip.d.ts +23 -1
- package/dist/combinators/trivia-skip.d.ts.map +1 -1
- package/dist/compiler/codegen.d.ts +40 -0
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/fields.d.ts.map +1 -1
- package/dist/compiler/ir-serialize.d.ts +1 -1
- package/dist/compiler/ir-serialize.d.ts.map +1 -1
- package/dist/compiler/linker.d.ts +5 -0
- package/dist/compiler/linker.d.ts.map +1 -1
- package/dist/compiler/value-usage.d.ts.map +1 -1
- package/dist/coverage.d.ts.map +1 -1
- package/dist/index.cjs +459 -86
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +459 -86
- package/dist/index.js.map +4 -4
- package/dist/language-service/index.cjs.map +1 -1
- package/dist/language-service/index.js.map +1 -1
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.cjs +538 -123
- package/dist/plugin/index.cjs.map +4 -4
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +538 -123
- package/dist/plugin/index.js.map +4 -4
- package/dist/spec/ebnf.d.ts.map +1 -1
- package/dist/spec/index.cjs +79 -17
- package/dist/spec/index.cjs.map +2 -2
- package/dist/spec/index.js +79 -17
- package/dist/spec/index.js.map +2 -2
- package/dist/spec/model.d.ts +23 -3
- package/dist/spec/model.d.ts.map +1 -1
- package/dist/spec/railroad.d.ts.map +1 -1
- package/dist/types.d.ts +9 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +5 -1
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
* (see `src/compiler/codegen.ts`). Accept a deliberately-ungated choice by listing
|
|
16
16
|
* its `id` in the gating snapshot allowlist (`analyzeGating(entry, { accept })` /
|
|
17
17
|
* `compile(g, { gating: { level, accept } })`) — the single suppression mechanism.
|
|
18
|
+
*
|
|
19
|
+
* WHERE the question is asked matters as much as the answer. A SHARED SHAPE — a
|
|
20
|
+
* `rules()` map referencing a rule it doesn't define (`g.Value`) — has no verdict of
|
|
21
|
+
* its own: the hole makes every first-set through it `any`, but that configuration is
|
|
22
|
+
* never executed and its author cannot fix it. Such a choice is `deferred` here, and
|
|
23
|
+
* re-asked with `resolveRef` at the site that BINDS the name (`runFusedGatingDiagnostic`
|
|
24
|
+
* in codegen.ts) — the artifact that really runs, whose author really can fix it.
|
|
18
25
|
*/
|
|
19
26
|
import type { Combinator, FirstSet } from '../types.ts';
|
|
27
|
+
import { type RefResolver } from '../combinators/first-set.ts';
|
|
20
28
|
/** Why an arm's (deep) first-set is `any` / over-broad — the poison source. */
|
|
21
29
|
export type FirstSetCause = 'leading-not' | 'nullable-prefix' | 'cross-artifact-ref' | 'broad-recognizer' | 'opaque-wrapper' | 'ref-cycle';
|
|
22
30
|
/** An arm whose deep first-set is `any` / over-broad. */
|
|
@@ -32,6 +40,16 @@ export type AnyArm = {
|
|
|
32
40
|
* genuinely-ungated finding.
|
|
33
41
|
*/
|
|
34
42
|
shallowAnyOnly: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True when the poison is a NAMED cross-artifact hole this artifact cannot resolve
|
|
45
|
+
* (`g.Value` in a shared shape). The author of THIS artifact cannot act on it — the
|
|
46
|
+
* arm's real first-set only exists once a consumer binds the name — so a choice
|
|
47
|
+
* whose every `any` arm is one of these is `deferred`, not `ungated`.
|
|
48
|
+
*
|
|
49
|
+
* An UNNAMED unresolved `ref()` is NOT this: nobody can bind it by name, so it is a
|
|
50
|
+
* genuine local finding and stays reportable here.
|
|
51
|
+
*/
|
|
52
|
+
unresolvedExternal: boolean;
|
|
35
53
|
/** Concrete fix, naming a real primitive. */
|
|
36
54
|
suggestion: string;
|
|
37
55
|
};
|
|
@@ -72,6 +90,17 @@ export type ChoiceGating = {
|
|
|
72
90
|
gates: 'yes' | 'recoverable' | 'no';
|
|
73
91
|
/** True when this ungated choice's `id` is in the accepted-snapshot allowlist. */
|
|
74
92
|
accepted: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* `gates: 'no'` was decided by cross-artifact HOLES ONLY — every `any` arm is an
|
|
95
|
+
* unresolved NAMED `g.Foo` ref and no two finite arms overlap. The verdict is not
|
|
96
|
+
* this artifact's to make: the shape module can't fix it (the hole has no body
|
|
97
|
+
* here) and the configuration it describes never runs. The answer belongs to the
|
|
98
|
+
* FUSED artifact, where the name is bound — see `runFusedGatingDiagnostic`.
|
|
99
|
+
*
|
|
100
|
+
* Deferred choices are excluded from `ungated`: they neither warn nor fail the
|
|
101
|
+
* `'error'` gate at this site.
|
|
102
|
+
*/
|
|
103
|
+
deferred: boolean;
|
|
75
104
|
combinedFirstSet: {
|
|
76
105
|
shallow: FirstSet;
|
|
77
106
|
deep: FirstSet;
|
|
@@ -88,6 +117,22 @@ export type AnalyzeGatingOptions = {
|
|
|
88
117
|
* SINGLE per-choice suppression mechanism.
|
|
89
118
|
*/
|
|
90
119
|
accept?: Iterable<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Name to attribute an UNNAMED entry to, instead of the synthetic `<entry>`.
|
|
122
|
+
* The macro plugin passes the binding's own variable name, so a warning on a
|
|
123
|
+
* top-level combinator const reads `choice @ directMixinReferenceAhead`
|
|
124
|
+
* (actionable, and a discriminating `accept` key) rather than `choice @
|
|
125
|
+
* <entry>` repeated once per const. Ignored when the entry already carries a
|
|
126
|
+
* `_ruleName`.
|
|
127
|
+
*/
|
|
128
|
+
entryName?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Bind NAMED cross-artifact holes (`g.Foo`) by name — supply the FUSED winner map's
|
|
131
|
+
* lookup. With it, an arm led by a shared shape's hole reports the first-set it
|
|
132
|
+
* really has once bound, so `deferred` collapses to a real `yes`/`no` verdict.
|
|
133
|
+
* Without it (the authoring site) such a choice stays `deferred`.
|
|
134
|
+
*/
|
|
135
|
+
resolveRef?: RefResolver;
|
|
91
136
|
};
|
|
92
137
|
export type GatingReport = {
|
|
93
138
|
totalChoices: number;
|
|
@@ -97,6 +142,12 @@ export type GatingReport = {
|
|
|
97
142
|
ungated: ChoiceGating[];
|
|
98
143
|
/** Ungated choices whose id was in the accepted allowlist — silent, accepted with intent. */
|
|
99
144
|
accepted: ChoiceGating[];
|
|
145
|
+
/**
|
|
146
|
+
* Choices whose verdict is NOT this artifact's to make — every `any` arm is an
|
|
147
|
+
* unresolved cross-artifact hole (see `ChoiceGating.deferred`). Silent here; the
|
|
148
|
+
* fused artifact re-asks the question with the hole bound.
|
|
149
|
+
*/
|
|
150
|
+
deferred: ChoiceGating[];
|
|
100
151
|
/** Accepted ids that matched no ungated choice — stale snapshot entries to prune. */
|
|
101
152
|
acceptedUnused: string[];
|
|
102
153
|
/** Every choice, for full inspection / CI snapshots. */
|
|
@@ -105,11 +156,25 @@ export type GatingReport = {
|
|
|
105
156
|
};
|
|
106
157
|
export declare function firstSetToString(fs: FirstSet): string;
|
|
107
158
|
export declare function analyzeGating(entry: Combinator<unknown>, opts?: AnalyzeGatingOptions): GatingReport;
|
|
159
|
+
/**
|
|
160
|
+
* Multi-root variant: analyze a WHOLE `rules()` map in one walk, so every choice
|
|
161
|
+
* is attributed to the rule that owns it.
|
|
162
|
+
*
|
|
163
|
+
* The macro build compiles a grammar through `compileRuleMap`/`compileLinkable`,
|
|
164
|
+
* never through the single-entry `compile()`. Analyzing one entry at a time (or
|
|
165
|
+
* not at all) is what produced unnamed `choice @ <entry>` warnings and ZERO
|
|
166
|
+
* anti-patterns for grammars that in fact have dozens: an unnamed warning in a
|
|
167
|
+
* multi-thousand-line grammar is unactionable. Seeding the walk with EVERY named
|
|
168
|
+
* root is what recovers the rule names — and, because the walk is shared, each
|
|
169
|
+
* choice is still analyzed exactly once however many rules reach it.
|
|
170
|
+
*/
|
|
171
|
+
export declare function analyzeGatingRules(ruleMap: ReadonlyArray<readonly [string, Combinator<unknown>]>, opts?: AnalyzeGatingOptions): GatingReport;
|
|
108
172
|
export type GatingWarnLevel = 'off' | 'warn' | 'error';
|
|
109
173
|
/**
|
|
110
174
|
* Format the genuinely-ungated findings + anti-patterns as ready-to-print lines.
|
|
111
175
|
* Precise by design: only 'no'-gated choices NOT in the accepted allowlist, plus
|
|
112
|
-
* the anti-pattern lints. Recoverable / gated / accepted choices produce
|
|
176
|
+
* the anti-pattern lints. Recoverable / gated / accepted / DEFERRED choices produce
|
|
177
|
+
* nothing (a deferred choice's verdict belongs to the fusing artifact, not here).
|
|
113
178
|
*/
|
|
114
179
|
export declare function formatGatingWarnings(report: GatingReport): string[];
|
|
115
180
|
//# sourceMappingURL=gating.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gating.d.ts","sourceRoot":"","sources":["../../src/analysis/gating.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"gating.d.ts","sourceRoot":"","sources":["../../src/analysis/gating.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAa,MAAM,aAAa,CAAA;AAClE,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAExF,+EAA+E;AAC/E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O,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAanE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The case-fold CLASS of a code point under ECMAScript's NON-Unicode `/i`
|
|
3
|
+
* matching — the exact relation `keywords({ caseInsensitive: true })` compiles to.
|
|
4
|
+
*
|
|
5
|
+
* A first-set drives O(1) `choice` dispatch, so it MUST be a superset of every
|
|
6
|
+
* character the combinator can really start with. For a case-insensitive matcher
|
|
7
|
+
* that means: for every input char X that the matcher would accept as the first
|
|
8
|
+
* char, X is in the set. Under `/i` WITHOUT `u`, two chars match iff they share a
|
|
9
|
+
* canonical form, and that relation is NOT simply `{c, toUpperCase(c),
|
|
10
|
+
* toLowerCase(c)}` — 67 BMP code points sit in classes those three miss:
|
|
11
|
+
*
|
|
12
|
+
* σ (U+03C3) ↔ Σ (U+03A3) ↔ ς (U+03C2) final sigma is in the class but is
|
|
13
|
+
* neither the upper- nor lowercase of σ
|
|
14
|
+
* µ (U+00B5) ↔ μ (U+03BC) ↔ Μ (U+039C) micro sign folds into Greek mu
|
|
15
|
+
* DŽ (U+01C4) ↔ Dž (U+01C5) ↔ dž (U+01C6) titlecase digraphs (also LJLjljNJNjnjDZDzdz)
|
|
16
|
+
* ͅ (U+0345) ↔ ι (U+03B9) ↔ ι (U+1FBE) combining iota subscript
|
|
17
|
+
*
|
|
18
|
+
* so widening a first-set by upper/lower alone is UNSOUND for them.
|
|
19
|
+
*
|
|
20
|
+
* The canonical form below is ECMAScript's `Canonicalize` for non-Unicode mode:
|
|
21
|
+
* uppercase the char; if that is not exactly one char, or if it would cross the
|
|
22
|
+
* ASCII boundary INTO Basic Latin, keep the original. That last clause is why
|
|
23
|
+
* `/s/i` does not match `ſ` (U+017F) and `/k/i` does not match `K` (U+212A) —
|
|
24
|
+
* cross-boundary folds are refused in BOTH directions, which is what keeps an
|
|
25
|
+
* ASCII first-set tight and sound for the common all-ASCII keyword set.
|
|
26
|
+
*
|
|
27
|
+
* The classes are derived from the RUNNING engine's own `toUpperCase`, not a
|
|
28
|
+
* frozen table, so they cannot drift from the regex engine that will do the
|
|
29
|
+
* matching. Verified exhaustively against real `/i` behaviour across the BMP:
|
|
30
|
+
* 1141 multi-member classes, 2307 members, zero disagreements in either
|
|
31
|
+
* direction (see `test/unit/case-fold.test.ts`).
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Every code point that a non-Unicode `/i` matcher treats as equal to `cp`,
|
|
35
|
+
* INCLUDING `cp` itself. Union these into a first-set to keep case-insensitive
|
|
36
|
+
* dispatch sound.
|
|
37
|
+
*/
|
|
38
|
+
export declare function caseFoldVariants(cp: number): readonly number[];
|
|
39
|
+
//# sourceMappingURL=case-fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case-fold.d.ts","sourceRoot":"","sources":["../../src/combinators/case-fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAuCH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAc9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/combinators/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,UAAU,EAAE,MAAM,aAAa,CAAA;AAGhG,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/combinators/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,UAAU,EAAE,MAAM,aAAa,CAAA;AAGhG,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAuC/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,CA2B/F;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { FirstSet, Combinator } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a NAMED cross-artifact rule reference (`g.Foo`) whose own thunk does not
|
|
4
|
+
* resolve — the shared-shape hole, bound by name at fuse time.
|
|
5
|
+
*
|
|
6
|
+
* A shape module compiles `Ratio: sequence(g.Value, …)` without defining `Value`, so
|
|
7
|
+
* that `lazy`'s thunk throws and every first-set through it degrades to `any`. Once
|
|
8
|
+
* the shape is FUSED with a dialect that defines `Value`, the hole is bound — pass a
|
|
9
|
+
* resolver over the fused winner map and the first-set is the real one.
|
|
10
|
+
*
|
|
11
|
+
* Only NAMED refs are resolvable: an unnamed `ref()` that was never `.define()`d
|
|
12
|
+
* carries no name for anyone to bind, so it stays `any`.
|
|
13
|
+
*/
|
|
14
|
+
export type RefResolver = (name: string) => Combinator<unknown> | undefined;
|
|
2
15
|
export declare function union(a: FirstSet, b: FirstSet): FirstSet;
|
|
3
16
|
export declare function intersects(a: FirstSet, b: FirstSet): boolean;
|
|
4
17
|
export declare function fromChar(code: number): FirstSet;
|
|
@@ -20,7 +33,7 @@ export declare function empty(): FirstSet;
|
|
|
20
33
|
* set, which stays sound; under-estimating would drop valid start chars and make
|
|
21
34
|
* first-char dispatch skip a matching arm.
|
|
22
35
|
*/
|
|
23
|
-
export declare function matchesEmpty(p: Combinator<unknown>, seen?: Set<Combinator<unknown
|
|
36
|
+
export declare function matchesEmpty(p: Combinator<unknown>, seen?: Set<Combinator<unknown>>, resolve?: RefResolver): boolean;
|
|
24
37
|
/**
|
|
25
38
|
* A ZERO-WIDTH ASSERTION never consumes input, so it contributes NOTHING to a
|
|
26
39
|
* sequence's first-set — the first consumed char comes from the following
|
|
@@ -33,17 +46,27 @@ export declare function matchesEmpty(p: Combinator<unknown>, seen?: Set<Combinat
|
|
|
33
46
|
* widens the set of possible first chars beyond Y. So firstSet(Y) is a sound (and
|
|
34
47
|
* tighter) superset.
|
|
35
48
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* (a nullable `(?=body)` succeeds on empty, so it imposes no first-char constraint
|
|
41
|
-
* and intersecting would UNSOUNDLY exclude valid chars). It must NOT be added to
|
|
42
|
-
* this predicate without that intersection logic — a future assertion combinator
|
|
43
|
-
* left out of this set merely contributes its shallow `any` first-set, which stays
|
|
44
|
-
* sound (over-approximation), only losing tightness.
|
|
49
|
+
* The POSITIVE lookahead `peek(X)` is zero-width too, but it is NOT in this
|
|
50
|
+
* predicate: unlike `not`, it knows what it requires, so its first-set is a real
|
|
51
|
+
* constraint that must be INTERSECTED into the sequence's set rather than dropped
|
|
52
|
+
* (see `isPositiveLookahead` and `sequenceFirstSet`).
|
|
45
53
|
*/
|
|
46
54
|
export declare function isZeroWidthAssertion(p: Combinator<unknown>): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* A POSITIVE zero-width assertion (`peek(X)`). It consumes nothing, so like
|
|
57
|
+
* `not(X)` it does not contribute a first char of its own — but it does REQUIRE
|
|
58
|
+
* that X match here, so `peek(X) Y` can only start with a char in
|
|
59
|
+
* firstSet(X) ∩ firstSet(Y). That intersection is what makes a leading `peek()`
|
|
60
|
+
* gate its choice arm; `not(not(X))`, the only previous spelling, reports `any()`
|
|
61
|
+
* and poisons the dispatch instead.
|
|
62
|
+
*
|
|
63
|
+
* Soundness: first-sets are SUPERSETS of the true first chars, and
|
|
64
|
+
* (A ⊇ a) ∧ (B ⊇ b) ⇒ A ∩ B ⊇ a ∩ b — so intersecting stays a superset and can
|
|
65
|
+
* never skip a real match. A NULLABLE body succeeds on the empty string and
|
|
66
|
+
* therefore constrains nothing; `peek()` reports `any()` in that case, which the
|
|
67
|
+
* intersection treats as "no constraint".
|
|
68
|
+
*/
|
|
69
|
+
export declare function isPositiveLookahead(p: Combinator<unknown>): boolean;
|
|
47
70
|
/**
|
|
48
71
|
* First-set of a sequence: union each term's first-set through the NULLABLE
|
|
49
72
|
* PREFIX — a leading `optional(…)` / `many(…)` / nullable term can be skipped, so
|
|
@@ -66,6 +89,10 @@ export declare function sequenceFirstSet(parsers: readonly Combinator<unknown>[]
|
|
|
66
89
|
* SOUND ONLY where refs are FINAL (monolithic compile). Under compose OVERRIDE a
|
|
67
90
|
* referenced rule can be replaced with a WIDER first-set, so a baked deep set
|
|
68
91
|
* would wrongly skip valid input — the compose path defers dispatch to fuse time.
|
|
92
|
+
*
|
|
93
|
+
* `resolve` binds NAMED cross-artifact holes (`g.Foo`) against a fused winner map —
|
|
94
|
+
* see `RefResolver`. Diagnostic-only today: it is what lets the gating analysis ask
|
|
95
|
+
* the question at the site where the hole actually HAS an answer.
|
|
69
96
|
*/
|
|
70
|
-
export declare function firstSetOf(p: Combinator<unknown>, seen?: Set<Combinator<unknown
|
|
97
|
+
export declare function firstSetOf(p: Combinator<unknown>, seen?: Set<Combinator<unknown>>, resolve?: RefResolver): FirstSet;
|
|
71
98
|
//# sourceMappingURL=first-set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-set.d.ts","sourceRoot":"","sources":["../../src/combinators/first-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,QAAQ,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAE7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E,MAAM,GAAG,OAAO,CAQnG;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,CAE1D;AAED,wBAAgB,GAAG,IAAI,QAAQ,CAE9B;AAED,wBAAgB,KAAK,IAAI,QAAQ,CAEhC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EACtB,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,EAC1C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CA6CT;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAEpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAEnE;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,UAAU,CAAC,OAAO,CAAC,EAAE,GAAG,QAAQ,CAalF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EACtB,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,EAC1C,OAAO,CAAC,EAAE,WAAW,GACpB,QAAQ,CAsDV"}
|
|
@@ -13,10 +13,19 @@ export type KeywordsOptions = {
|
|
|
13
13
|
* matching `true` inside `trueish`. The boundary defaults to `_0-9A-Za-z`,
|
|
14
14
|
* which covers most programming-language identifiers.
|
|
15
15
|
*
|
|
16
|
-
* word('true')
|
|
17
|
-
* word('color', 'A-Za-z-')
|
|
16
|
+
* word('true') // matches "true" but not "trueish"
|
|
17
|
+
* word('color', 'A-Za-z-') // CSS-style identifier boundary
|
|
18
|
+
* word('media', 'A-Za-z0-9_-', { caseInsensitive: true })
|
|
19
|
+
* word('media', { caseInsensitive: true }) // default boundary + options
|
|
20
|
+
*
|
|
21
|
+
* `caseInsensitive` matches `keywords()` and exists because it is REQUIRED, not a
|
|
22
|
+
* nicety: CSS at-keywords, function names and units are ASCII case-insensitive per
|
|
23
|
+
* spec (CSS Syntax §3). Without it the only conforming spellings were
|
|
24
|
+
* `regex(/media/i)` — which `analyzeGating` correctly flags as the `keyword-regex`
|
|
25
|
+
* anti-pattern — or `keywords(['media'], …)` for a single word.
|
|
18
26
|
*/
|
|
19
|
-
export declare function word(str: string, boundary?: string): Combinator<string>;
|
|
27
|
+
export declare function word(str: string, boundary?: string, opts?: Omit<KeywordsOptions, 'boundary'>): Combinator<string>;
|
|
28
|
+
export declare function word(str: string, opts: Omit<KeywordsOptions, 'boundary'>): Combinator<string>;
|
|
20
29
|
/**
|
|
21
30
|
* Create a keyword factory with a fixed word-boundary class. Use when many
|
|
22
31
|
* keywords share the same boundary (e.g. CSS identifiers). For a single keyword,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keywords.d.ts","sourceRoot":"","sources":["../../src/combinators/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAmD,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"keywords.d.ts","sourceRoot":"","sources":["../../src/combinators/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAmD,MAAM,aAAa,CAAA;AAM9F,MAAM,MAAM,eAAe,GAAG;IAC5B,gCAAgC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAClH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAW9F;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAe,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAErF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,GAAE,eAAoB,GAAG,UAAU,CAAC,MAAM,CAAC,CA8DjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not.d.ts","sourceRoot":"","sources":["../../src/combinators/not.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAIpF;;;;;;;;;GASG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"not.d.ts","sourceRoot":"","sources":["../../src/combinators/not.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAIpF;;;;;;;;;GASG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAwCrE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Combinator } from '../types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Positive lookahead. Succeeds (consuming nothing) when `combinator` matches at
|
|
4
|
+
* this position; fails when it doesn't. The mirror of `not()`.
|
|
5
|
+
*
|
|
6
|
+
* // "a mixin reference, not a class selector": require the punctuation ahead,
|
|
7
|
+
* // then let the real production consume it.
|
|
8
|
+
* const mixinRef = sequence(peek(regex(/[.#]/)), mixinCall)
|
|
9
|
+
*
|
|
10
|
+
* WHY THIS EXISTS AS A PRIMITIVE (not `not(not(X))`):
|
|
11
|
+
*
|
|
12
|
+
* `not(not(X))` is behaviourally a positive lookahead, but `not()` reports
|
|
13
|
+
* `firstSet: any()` — it cannot know what it forbids — so `not(not(X))` reports
|
|
14
|
+
* `any()` too. An arm leading with it therefore POISONS its choice's first-char
|
|
15
|
+
* dispatch (`analyzeGating` flags it as the `double-not` anti-pattern), and among
|
|
16
|
+
* sibling arms that share a first char the hand-rolled gate miscompiles.
|
|
17
|
+
*
|
|
18
|
+
* `peek(X)` carries X's first-set instead, so a leading `peek()` GATES its arm:
|
|
19
|
+
* `choice(sequence(peek(regex(/[.#]/)), …), …)` still emits O(1) dispatch.
|
|
20
|
+
*
|
|
21
|
+
* The first-set is exact only when X is NON-NULLABLE. A nullable `peek(X)`
|
|
22
|
+
* succeeds on the empty string, so it constrains no first character at all — it
|
|
23
|
+
* reports `any()`, the sound over-approximation. (Same rule the sequence
|
|
24
|
+
* first-set uses; see `isPositiveLookahead` in `first-set.ts`.)
|
|
25
|
+
*/
|
|
26
|
+
export declare function peek(combinator: Combinator<unknown>): Combinator<null>;
|
|
27
|
+
//# sourceMappingURL=peek.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peek.d.ts","sourceRoot":"","sources":["../../src/combinators/peek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAIpF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAkCtE"}
|
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
import type { Combinator } from '../types.ts';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type RepeatOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Minimum number of ITEMS. Default `0`.
|
|
5
|
+
*
|
|
6
|
+
* `min >= 1` is not a validation nicety — it is what makes the combinator
|
|
7
|
+
* NON-NULLABLE. A nullable arm matches at every position, which disables its
|
|
8
|
+
* `choice`'s first-char dispatch by parseman's own first-set rule; a `min >= 1`
|
|
9
|
+
* repeat keeps the item's first-set, so an arm led by it still gates.
|
|
10
|
+
*/
|
|
11
|
+
min?: number;
|
|
12
|
+
/** Maximum number of ITEMS. Default: unbounded. Never affects nullability. */
|
|
13
|
+
max?: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Repetition: `item*` by default, bounded by `{ min, max }` (both count ITEMS).
|
|
17
|
+
*
|
|
18
|
+
* many(g.Decl) // zero or more — NULLABLE
|
|
19
|
+
* many(g.Decl, { min: 1 }) // one or more — same as oneOrMore(g.Decl)
|
|
20
|
+
* many(g.HexDigit, { min: 3, max: 8 })
|
|
21
|
+
*
|
|
22
|
+
* `oneOrMore(x)` is kept as the sugar for the common `{ min: 1 }` case.
|
|
23
|
+
*/
|
|
24
|
+
export declare function many<T>(combinator: Combinator<T>, opts?: RepeatOptions): Combinator<T[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Sugar for the commonest bound: `many(combinator, { min: 1 })` — the identical
|
|
27
|
+
* combinator, not merely an equivalent one.
|
|
28
|
+
*/
|
|
29
|
+
export declare function oneOrMore<T>(combinator: Combinator<T>, opts?: RepeatOptions): Combinator<T[]>;
|
|
4
30
|
export declare function optional<T>(combinator: Combinator<T>): Combinator<T | null>;
|
|
5
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Non-empty separated list — `oneOrMore`'s relationship to `many`, for separated
|
|
33
|
+
* lists. `oneOrMoreSep(item, sep)` is exactly `sepBy(item, sep, { min: 1 })`.
|
|
34
|
+
*
|
|
35
|
+
* oneOrMoreSep(g.Selector, literal(',')) // a selector list is never empty
|
|
36
|
+
*
|
|
37
|
+
* REACH FOR THIS, NOT `sepBy`, for any list that cannot actually be empty —
|
|
38
|
+
* selector lists, value lists, media-query preludes, keyframe selectors. `sepBy`'s
|
|
39
|
+
* min-0 default matches the EMPTY STRING, which makes it nullable, and a nullable
|
|
40
|
+
* arm disables its `choice`'s first-char dispatch by parseman's own first-set
|
|
41
|
+
* rule. This form is non-nullable and keeps the item's first-set, so an arm led by
|
|
42
|
+
* it still gates.
|
|
43
|
+
*/
|
|
44
|
+
export declare function oneOrMoreSep<T, S>(combinator: Combinator<T>, separator: Combinator<S>, opts?: SepByOptions): Combinator<T[]>;
|
|
45
|
+
/** How a separator with NO item after it is treated. */
|
|
46
|
+
export type TrailingSeparator =
|
|
47
|
+
/**
|
|
48
|
+
* DEFAULT, and what `sepBy` has always done: the trailing separator is NOT
|
|
49
|
+
* consumed — the list ends before it and the enclosing grammar sees it. (It is
|
|
50
|
+
* not an error here; "forbid" means the list refuses to own it.)
|
|
51
|
+
*/
|
|
52
|
+
'forbid'
|
|
53
|
+
/** Consume a trailing separator when present (`a, b,` → 2 items, comma eaten). */
|
|
54
|
+
| 'allow';
|
|
55
|
+
export type SepByOptions = RepeatOptions & {
|
|
56
|
+
/** What to do with a separator that has no item after it. Default `'forbid'`. */
|
|
57
|
+
trailing?: TrailingSeparator;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Separated list: `(item (sep item)*)?` by default — note that it MATCHES THE
|
|
61
|
+
* EMPTY STRING, which makes it nullable and therefore un-gateable as a choice arm.
|
|
62
|
+
* For a list that cannot be empty reach for `oneOrMoreSep`, or pass `{ min: 1 }`.
|
|
63
|
+
*
|
|
64
|
+
* sepBy(g.Value, literal(',')) // may be empty — NULLABLE
|
|
65
|
+
* oneOrMoreSep(g.Selector, literal(',')) // non-empty — gates as a choice arm
|
|
66
|
+
* sepBy(g.Decl, literal(';'), { trailing: 'allow' })
|
|
67
|
+
*
|
|
68
|
+
* `min`/`max` count ITEMS, not separators.
|
|
69
|
+
*/
|
|
70
|
+
export declare function sepBy<T, S>(combinator: Combinator<T>, separator: Combinator<S>, opts?: SepByOptions): Combinator<T[]>;
|
|
6
71
|
//# sourceMappingURL=repeat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/combinators/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAqEpF,wBAAgB,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/combinators/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAqEpF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAcD;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,aAAkB,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CA6D5F;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,aAAkB,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAEjG;AA6ED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,CAwB3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,YAAiB,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAEhI;AAED,wDAAwD;AACxD,MAAM,MAAM,iBAAiB;AAC3B;;;;GAIG;AACD,QAAQ;AACV,kFAAkF;GAChF,OAAO,CAAA;AAEX,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG;IACzC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAC7B,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,GAAE,YAAiB,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAoJzH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ParseContext } from '../types.ts';
|
|
1
|
+
import type { ParseContext, ParseFail } from '../types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Result of scanning trivia: the position after it, plus a `commit()` that
|
|
4
4
|
* records the matched trivia tokens into the active rawChildren collector.
|
|
@@ -23,6 +23,28 @@ export type TriviaRollbackMark = {
|
|
|
23
23
|
export declare function needsDeferredTriviaCommit(ctx: ParseContext): boolean;
|
|
24
24
|
export declare function saveTriviaMark(ctx: ParseContext): TriviaRollbackMark;
|
|
25
25
|
export declare function rollbackTrivia(ctx: ParseContext, mark: TriviaRollbackMark): void;
|
|
26
|
+
/**
|
|
27
|
+
* A ZERO-WIDTH LOOKAHEAD's mark: everything `saveTriviaMark` covers, plus the
|
|
28
|
+
* completions probe's current best failure.
|
|
29
|
+
*
|
|
30
|
+
* `_probe` is a sink like any other — `failAt` (probe.ts) replaces
|
|
31
|
+
* `ctx._probe.best` whenever a failure lands at or before the cursor — but it is
|
|
32
|
+
* deliberately NOT part of `rollbackTrivia`, because most rollbacks must leave it
|
|
33
|
+
* alone. A failed `choice` arm or `sequence` term SHOULD keep its contribution:
|
|
34
|
+
* merging the expectations of alternatives that failed at the cursor is exactly
|
|
35
|
+
* how `completionsAt` builds its set.
|
|
36
|
+
*
|
|
37
|
+
* A lookahead is the exception. `peek`/`not` consume nothing on EITHER outcome
|
|
38
|
+
* and promise to leave no observable trace, so expectations raised INSIDE the
|
|
39
|
+
* probe are not reachable from the enclosing grammar at the cursor:
|
|
40
|
+
* `peek(sequence(literal('a'), literal('zzz')))` over `"ab"` offered `"zzz"` as
|
|
41
|
+
* the ONLY completion, though no input can ever reach it there.
|
|
42
|
+
*/
|
|
43
|
+
export type LookaheadMark = TriviaRollbackMark & {
|
|
44
|
+
probeBest: ParseFail | null;
|
|
45
|
+
};
|
|
46
|
+
export declare function saveLookaheadMark(ctx: ParseContext): LookaheadMark;
|
|
47
|
+
export declare function rollbackLookahead(ctx: ParseContext, mark: LookaheadMark): void;
|
|
26
48
|
/**
|
|
27
49
|
* Skip trivia at `cur` and return the new position. No recording, no wrapper
|
|
28
50
|
* object — use between sequence/repeat terms when CST trivia capture is off.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trivia-skip.d.ts","sourceRoot":"","sources":["../../src/combinators/trivia-skip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"trivia-skip.d.ts","sourceRoot":"","sources":["../../src/combinators/trivia-skip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAetE;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AAE5D,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAM3H,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAEpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,kBAAkB,CAGpE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAGhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG;IAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,CAAA;AAEhF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAElE;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAG9E;AAiBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,MAAM,CAWnF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,UAAU,CAkCpF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,MAAM,CAKnF"}
|
|
@@ -128,7 +128,33 @@ export declare function ruleDependencies(ruleMap: ReadonlyArray<readonly [string
|
|
|
128
128
|
export type GatingOption = GatingWarnLevel | {
|
|
129
129
|
level?: GatingWarnLevel;
|
|
130
130
|
accept?: Iterable<string>;
|
|
131
|
+
entryName?: string;
|
|
131
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* The FUSE-time form of the diagnostic — the only site where a shared shape's
|
|
135
|
+
* `g.Foo` hole has an answer.
|
|
136
|
+
*
|
|
137
|
+
* A shape module (`rules(g => ({ Term: choice(sequence(g.Value, …), …) }))`) cannot
|
|
138
|
+
* decide whether `Term` gates: `g.Value` is unbound there, so its first-set reads
|
|
139
|
+
* `any`. `analyzeGatingRules` marks such a choice `deferred` rather than `ungated` —
|
|
140
|
+
* warning about it would describe a configuration that never runs, and its author
|
|
141
|
+
* has nothing to fix. This runs the SAME analysis over the fused winner map, where
|
|
142
|
+
* `Value` is bound, and reports what the binding actually produced.
|
|
143
|
+
*
|
|
144
|
+
* Threading `gating` into the per-piece `compileLinkable` calls would NOT do this:
|
|
145
|
+
* each piece is lowered alone, so the hole is still unbound and the shape's own false
|
|
146
|
+
* positive is simply re-emitted. Resolution needs the MERGED map.
|
|
147
|
+
*
|
|
148
|
+
* Reports ONLY choices their authoring site deferred (the local, resolver-free pass
|
|
149
|
+
* names them). That is what keeps an ordinary hole-free grammar from being warned
|
|
150
|
+
* about twice — once by `compileRuleMap` and again by every `compose()` that fuses
|
|
151
|
+
* it. Anti-patterns are structural and already reported at the authoring site, so
|
|
152
|
+
* they are dropped here for the same reason.
|
|
153
|
+
*
|
|
154
|
+
* The rule maps arrive as a THUNK because producing them costs a re-hydration of the
|
|
155
|
+
* carried IR: `gating: 'off'` must not pay for a diagnostic it will not print.
|
|
156
|
+
*/
|
|
157
|
+
export declare function runFusedGatingDiagnostic(getRuleMaps: () => ReadonlyArray<ReadonlyArray<readonly [string, Combinator<unknown>]>>, opt?: GatingOption): GatingReport | undefined;
|
|
132
158
|
export declare function compile<T>(combinator: Combinator<T>, mapFnSources?: string[], opts?: {
|
|
133
159
|
recovery?: boolean;
|
|
134
160
|
coverage?: boolean;
|
|
@@ -139,6 +165,7 @@ export declare function compileRuleMap(ruleMap: ReadonlyArray<readonly [string,
|
|
|
139
165
|
scanSkip?: Combinator<unknown>[];
|
|
140
166
|
recovery?: boolean;
|
|
141
167
|
coverage?: boolean;
|
|
168
|
+
gating?: GatingOption;
|
|
142
169
|
}): {
|
|
143
170
|
keys: string[];
|
|
144
171
|
replacement: string;
|
|
@@ -219,5 +246,18 @@ export declare function compileLinkable(ruleMapArg: ReadonlyArray<readonly [stri
|
|
|
219
246
|
recovery?: boolean;
|
|
220
247
|
captureTerminals?: boolean;
|
|
221
248
|
coverage?: GrammarCoveragePlan;
|
|
249
|
+
gating?: GatingOption;
|
|
222
250
|
}): LinkablePieces | null;
|
|
251
|
+
/**
|
|
252
|
+
* Does this rule map reference a rule it doesn't define — a NAMED `ref` (`g.Foo`)
|
|
253
|
+
* that never got `.define()`d? That is the SHARED-SHAPE signature: the grammar is a
|
|
254
|
+
* shape with a hole, so it can't be inlined as a standalone parser, but it IS
|
|
255
|
+
* linkable (`compileLinkable` emits a by-name `_r_Foo` call for the hole, bound at
|
|
256
|
+
* fuse time). Callers use this to tell that case apart from a genuine
|
|
257
|
+
* "couldn't compile, fall back to the interpreter".
|
|
258
|
+
*
|
|
259
|
+
* A `rules()` map's own `Object.entries` also leaks accessed-but-undefined names as
|
|
260
|
+
* top-level entries, so both the entry values AND their bodies are scanned.
|
|
261
|
+
*/
|
|
262
|
+
export declare function hasExternalRuleRef(ruleMap: ReadonlyArray<readonly [string, Combinator<unknown>]>): boolean;
|
|
223
263
|
//# sourceMappingURL=codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/compiler/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAAU,EAAa,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAA4B,MAAM,aAAa,CAAA;AAKnI,OAAO,
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/compiler/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,UAA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":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/compiler/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlE,KAAK,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAElD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAMtD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/compiler/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlE,KAAK,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAElD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAMtD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,GAAG,OAAO,CAkC9G;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,GAAG,OAAO,CA2C/G;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,GAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAa,GAAG,OAAO,CAkCtH;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAW/J"}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import type { Combinator } from '../types.ts';
|
|
21
21
|
type Comb = Combinator<unknown>;
|
|
22
|
-
export declare function serializeRuleMap(ruleMap: ReadonlyArray<readonly [string, Comb]
|
|
22
|
+
export declare function serializeRuleMap(ruleMap: ReadonlyArray<readonly [string, Comb]>, scanSkip?: readonly Comb[] | null): string | null;
|
|
23
23
|
/** Reconstruct a rule map from serialized IR (the inverse of `serializeRuleMap`) —
|
|
24
24
|
* evaluate the combinator-construction expression with every constructor in scope.
|
|
25
25
|
* Used at fuse time (runtime linker + build-time plugin) to re-lower carried IR. */
|
|
@@ -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,EAAa,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"ir-serialize.d.ts","sourceRoot":"","sources":["../../src/compiler/ir-serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAoBxD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;AAwD/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,CAqG/D"}
|
|
@@ -77,6 +77,11 @@ export type IRPiece = {
|
|
|
77
77
|
ns: string;
|
|
78
78
|
ir: string;
|
|
79
79
|
};
|
|
80
|
+
/** The re-lowerable carried pieces' rule maps, in compose order — the input to the
|
|
81
|
+
* fuse-time gating diagnostic. An opaque precompiled artifact contributes no
|
|
82
|
+
* combinator graph, so it is simply skipped: a hole it would have bound stays
|
|
83
|
+
* unresolved and its choice stays deferred (silent), never falsely warned. */
|
|
84
|
+
export declare function carriedRuleMaps(carried: ReadonlyArray<LinkablePieces | IRPiece>): Array<Array<[string, Combinator<unknown>]>>;
|
|
80
85
|
/** Return the final override-winner combinator map carried by runtime
|
|
81
86
|
* `compose()`, or `undefined` when a precompiled opaque artifact participated.
|
|
82
87
|
* This is intentionally internal: callers must not treat it as a parser API. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../src/compiler/linker.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,cAAc,CAAA;AAGlE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAY,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAanH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAC7C,EAAE,CAAC,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAC3B,cAAc,CAIhB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EA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AAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAE7H;AAmBD;;gFAEgF;AAChF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,CAEvH;AAED;qEACqE;AACrE,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,cAAc,GAAG,OAAO,EAC3B,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,EAC5B,gBAAgB,UAAQ,GACvB,cAAc,CAQhB;AAgFD,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACrD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAuB3B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAE3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-usage.d.ts","sourceRoot":"","sources":["../../src/compiler/value-usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"value-usage.d.ts","sourceRoot":"","sources":["../../src/compiler/value-usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,aAAa,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAmHhE"}
|
package/dist/coverage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAe,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAe,MAAM,YAAY,CAAA;AAkBvE,OAAO,EAAoB,KAAK,yBAAyB,EAA4B,MAAM,oCAAoC,CAAA;AAE/H,YAAY,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAGnF,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,SAAS,yBAAyB,EAAE,CAAA;IACjD,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,IAAI,uBAAuB,CAAA;IACnC,KAAK,IAAI,IAAI,CAAA;CACd,CAAA;AAED;;2DAE2D;AAC3D,eAAO,MAAM,4BAA4B,EAAE,MAA0D,CAAA;AAErG,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,yBAAyB,EAAE,CAUzH;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,G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