parseman 0.24.0 → 0.26.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/README.md +1 -1
- package/dist/combinators/completions.d.ts +14 -4
- package/dist/combinators/completions.d.ts.map +1 -1
- package/dist/combinators/expect.d.ts +2 -0
- package/dist/combinators/expect.d.ts.map +1 -1
- package/dist/combinators/grammar.d.ts +5 -5
- package/dist/combinators/not.d.ts.map +1 -1
- package/dist/combinators/parser.d.ts +3 -2
- package/dist/combinators/parser.d.ts.map +1 -1
- package/dist/combinators/repeat.d.ts.map +1 -1
- package/dist/combinators/sequence.d.ts.map +1 -1
- package/dist/combinators/trivia-skip.d.ts +1 -0
- package/dist/combinators/trivia-skip.d.ts.map +1 -1
- package/dist/compiler/codegen.d.ts +9 -4
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/scannable-run.d.ts +2 -2
- package/dist/compiler/scannable-run.d.ts.map +1 -1
- package/dist/cst/capture-buffer.d.ts +1 -0
- package/dist/cst/capture-buffer.d.ts.map +1 -1
- package/dist/cst/relative-spans.d.ts +32 -0
- package/dist/cst/relative-spans.d.ts.map +1 -1
- package/dist/cst/types.d.ts +7 -7
- package/dist/cst/types.d.ts.map +1 -1
- package/dist/functional/doc.d.ts +89 -4
- package/dist/functional/doc.d.ts.map +1 -1
- package/dist/functional/run.d.ts +12 -1
- package/dist/functional/run.d.ts.map +1 -1
- package/dist/index.cjs +807 -278
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +807 -278
- package/dist/index.js.map +4 -4
- package/dist/language-service/index.cjs +776 -0
- package/dist/language-service/index.cjs.map +7 -0
- package/dist/language-service/index.d.ts +94 -0
- package/dist/language-service/index.d.ts.map +1 -0
- package/dist/language-service/index.js +753 -0
- package/dist/language-service/index.js.map +7 -0
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.cjs +568 -129
- package/dist/plugin/index.cjs.map +4 -4
- package/dist/plugin/index.d.ts +11 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +568 -129
- package/dist/plugin/index.js.map +4 -4
- package/dist/recovery/scan.d.ts +54 -0
- package/dist/recovery/scan.d.ts.map +1 -0
- package/dist/spec/index.cjs +67 -6
- package/dist/spec/index.cjs.map +3 -3
- package/dist/spec/index.d.ts +10 -2
- package/dist/spec/index.d.ts.map +1 -1
- package/dist/spec/index.js +67 -6
- package/dist/spec/index.js.map +3 -3
- package/dist/spec/model.d.ts.map +1 -1
- package/dist/spec/railroad.d.ts +12 -0
- package/dist/spec/railroad.d.ts.map +1 -1
- package/dist/types.d.ts +60 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -2
- package/dist/combinators/recover-list.d.ts +0 -41
- package/dist/combinators/recover-list.d.ts.map +0 -1
- package/dist/combinators/recover.d.ts +0 -20
- package/dist/combinators/recover.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ Parséman includes benchmarks against several JavaScript/TypeScript parser libra
|
|
|
110
110
|
|
|
111
111
|
**When parsing to JS values** — objects, row arrays, AST nodes — **Parséman's macro build is the fastest general-purpose JS parser we benchmark**, beating [Peggy](https://peggyjs.org/), [Parsimmon](https://github.com/jneen/parsimmon), [Chevrotain](https://chevrotain.io/), [Nearley](https://nearley.js.org/), and [Jison](https://github.com/zaach/jison) at every grammar and size. The only thing that edges it out is a purpose-built native like `JSON.parse`; for anything that *doesn't* have a built-in, Parséman is the one to beat.
|
|
112
112
|
|
|
113
|
-
For **syntax tree building**, the compiled CST path (macro build) beats [Lezer](https://lezer.codemirror.net/) on the JSON CST fixture too — while producing a richer object tree with spans and trivia. For **incremental re-parse**,
|
|
113
|
+
For **syntax tree building**, the compiled CST path (macro build) beats [Lezer](https://lezer.codemirror.net/) on the JSON CST fixture too — while producing a richer object tree with spans and trivia. For **incremental re-parse**, Parséman's `parseDoc` stores parent-relative spans so in-place value edits are ~110× faster than a full reparse and ~20× ahead of Lezer; structural edits (inserting/removing a whole list element) reuse the collection's untouched tail and land within a few × of Lezer's buffer reuse rather than at full-reparse cost. Full breakdown in the [benchmarks guide](https://matthew-dean.github.io/parseman/guide/benchmarks).
|
|
114
114
|
|
|
115
115
|
Measured on Apple M4 Pro. Bars show µs per parse — shorter is faster. Refresh: `pnpm bench:svg` (benchmarks chart parsers and updates `assets/bench-*.svg`).
|
|
116
116
|
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { Combinator } from '../types.ts';
|
|
1
|
+
import type { Combinator, ParseContext, ParseResult } from '../types.ts';
|
|
2
|
+
/** Anything `completionsAt` can probe: an interpreter combinator OR a `compile()`d
|
|
3
|
+
* grammar. A grammar compiled with `{ recovery: true }` records the probe on its fast
|
|
4
|
+
* path, so completions work on the published compiled artifact — no interpreter needed. */
|
|
5
|
+
type CompletionsTarget = Combinator<unknown> | {
|
|
6
|
+
parseWithContext(input: string, ctx: ParseContext, pos?: number): ParseResult<unknown>;
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Returns the set of expected tokens at the given cursor offset.
|
|
4
10
|
* Useful for implementing IDE completions.
|
|
@@ -7,11 +13,15 @@ import type { Combinator } from '../types.ts';
|
|
|
7
13
|
* highest-position failure seen, even when sepBy/many backtrack past the cursor.
|
|
8
14
|
* Returns the expected tokens from that deepest failure.
|
|
9
15
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
16
|
+
* Works on the interpreter combinator OR a `compile(g, { recovery: true })` grammar
|
|
17
|
+
* (the probe is recorded on the compiled fast path). Returns an empty array when the
|
|
18
|
+
* input up to `offset` parses completely with no failures at or before the cursor.
|
|
12
19
|
*
|
|
13
20
|
* The returned strings use the same labels as ParseFail.expected:
|
|
14
21
|
* quoted literals like `"\"{\""` and regex patterns like `"/[0-9]+/"`.
|
|
15
22
|
*/
|
|
16
|
-
export declare function completionsAt(
|
|
23
|
+
export declare function completionsAt(target: CompletionsTarget, input: string, offset: number, options?: {
|
|
24
|
+
tolerant?: boolean;
|
|
25
|
+
}): string[];
|
|
26
|
+
export {};
|
|
17
27
|
//# sourceMappingURL=completions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/combinators/completions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/combinators/completions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGnF;;2FAE2F;AAC3F,KAAK,iBAAiB,GAClB,UAAU,CAAC,OAAO,CAAC,GACnB;IAAE,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;CAAE,CAAA;AAE9F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,MAAM,EAAE,CAqBV"}
|
|
@@ -33,4 +33,6 @@ export declare function deriveExpected(c: Combinator<unknown>): string[];
|
|
|
33
33
|
* the inner attempt).
|
|
34
34
|
*/
|
|
35
35
|
export declare function expect<T>(combinator: Combinator<T>, label?: string): Combinator<T | ParseError>;
|
|
36
|
+
/** True when `value` is a recovery {@link ParseError} node. */
|
|
37
|
+
export declare function isParseError(value: unknown): value is ParseError;
|
|
36
38
|
//# sourceMappingURL=expect.d.ts.map
|
|
@@ -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;
|
|
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,CA4B/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"}
|
|
@@ -2,11 +2,11 @@ import type { Combinator, ParseContext, ParseResult } from '../types.ts';
|
|
|
2
2
|
export type ParseOptions = {
|
|
3
3
|
trackLines?: boolean;
|
|
4
4
|
/**
|
|
5
|
-
* Enable error
|
|
6
|
-
* into a side-channel array
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* return ParseFail as usual.
|
|
5
|
+
* Enable the error-collection channel. When true, recovery points (expect(), and
|
|
6
|
+
* tolerant list recovery) collect their ParseErrors into a side-channel array
|
|
7
|
+
* rather than only embedding them in the value tree. The returned ParseOk will
|
|
8
|
+
* have an `errors` field listing all recovered errors. Top-level parse failures
|
|
9
|
+
* (where nothing recovered) still return ParseFail as usual.
|
|
10
10
|
*/
|
|
11
11
|
recover?: boolean;
|
|
12
12
|
};
|
|
@@ -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;
|
|
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,CA0BrE"}
|
|
@@ -35,8 +35,9 @@ export declare const RULE_ORDER = "__parsemanRuleOrder";
|
|
|
35
35
|
* override it locally for a sub-region.
|
|
36
36
|
*/
|
|
37
37
|
export type RulesOptions = {
|
|
38
|
-
/** Ambient trivia for the whole grammar. See `parser({ trivia })` for the shape
|
|
39
|
-
|
|
38
|
+
/** Ambient trivia for the whole grammar. See `parser({ trivia })` for the shape
|
|
39
|
+
* (`null` clears it — equivalent to omitting it at the grammar level). */
|
|
40
|
+
trivia?: Combinator<unknown> | null;
|
|
40
41
|
};
|
|
41
42
|
export declare function rules<T extends Record<string, Combinator<unknown>>>(factory: (self: any) => T): T;
|
|
42
43
|
export declare function rules<T extends Record<string, Combinator<unknown>>>(options: RulesOptions, factory: (self: any) => T): T;
|
|
@@ -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;AAI7C;;;;GAIG;AACH,eAAO,MAAM,UAAU,wBAAwB,CAAA;AAO/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/combinators/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI7C;;;;GAIG;AACH,eAAO,MAAM,UAAU,wBAAwB,CAAA;AAO/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;8EAC0E;IAC1E,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CACpC,CAAA;AAKD,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;AAClG,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,CAAC,CAAA"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/combinators/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,aAAa,CAAA;AAyDpF,wBAAgB,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAgDlE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CA4CvE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,CAwB3E;AAYD,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAwFhG"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../src/combinators/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAoD,MAAM,aAAa,CAAA;AAK/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,CAmI9B"}
|
|
@@ -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;AAe3D;;;;;;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,G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AM,EAAE,GAAG,EAAE,YAAY,GAAG,MAAM,CAKnF"}
|
|
@@ -28,9 +28,10 @@ export type CompiledParser<T> = {
|
|
|
28
28
|
/** Like parse(), but with a caller-supplied ParseContext (e.g. `_triviaLog` for CST grammars). */
|
|
29
29
|
parseWithContext(input: string, ctx: ParseContext, pos?: number): ParseResult<T>;
|
|
30
30
|
/**
|
|
31
|
-
* Like parse(), but activates error
|
|
32
|
-
* ParseErrors into result.errors instead of
|
|
33
|
-
* Always returns ParseOk — top-level failures are
|
|
31
|
+
* Like parse(), but activates the error-collection channel. Recovery points
|
|
32
|
+
* (expect()) collect their ParseErrors into result.errors instead of only
|
|
33
|
+
* embedding them as values. Always returns ParseOk — top-level failures are
|
|
34
|
+
* still ParseFail.
|
|
34
35
|
*/
|
|
35
36
|
parseWithErrors(input: string, pos?: number): ParseResult<T> & {
|
|
36
37
|
errors: ParseError[];
|
|
@@ -64,9 +65,12 @@ export declare function ruleDependencies(ruleMap: ReadonlyArray<readonly [string
|
|
|
64
65
|
*
|
|
65
66
|
* @see https://www.greadme.com/blog/security/what-is-content-security-policy-complete-guide
|
|
66
67
|
*/
|
|
67
|
-
export declare function compile<T>(combinator: Combinator<T>, mapFnSources?: string[]
|
|
68
|
+
export declare function compile<T>(combinator: Combinator<T>, mapFnSources?: string[], opts?: {
|
|
69
|
+
recovery?: boolean;
|
|
70
|
+
}): CompiledParser<T>;
|
|
68
71
|
export declare function compileRuleMap(ruleMap: ReadonlyArray<readonly [string, Combinator<unknown>]>, opts?: {
|
|
69
72
|
trivia?: Combinator<unknown>;
|
|
73
|
+
recovery?: boolean;
|
|
70
74
|
}): {
|
|
71
75
|
keys: string[];
|
|
72
76
|
replacement: string;
|
|
@@ -114,5 +118,6 @@ export type LinkablePieces = {
|
|
|
114
118
|
};
|
|
115
119
|
export declare function compileLinkable(ruleMapArg: ReadonlyArray<readonly [string, Combinator<unknown>]>, ns: string, opts?: {
|
|
116
120
|
trivia?: Combinator<unknown>;
|
|
121
|
+
recovery?: boolean;
|
|
117
122
|
}): LinkablePieces | null;
|
|
118
123
|
//# 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;AA0BnI;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,uTAC0R,CAAA;AActT,8EAA8E;AAC9E,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAI7C;
|
|
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;AA0BnI;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,uTAC0R,CAAA;AActT,8EAA8E;AAC9E,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAI7C;AAudD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,MAAM,CAQlE;AAcD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAA0B;AA09DjF,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;IAClD,kGAAkG;IAClG,gBAAgB,CAAC,KAAK,EAAE,MAAM,E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I,EAAE,IAAI,GAAG,MAAM,CAazF"}
|
|
@@ -38,6 +38,7 @@ export type CstRollbackMark = {
|
|
|
38
38
|
tlog: number;
|
|
39
39
|
leaves: number;
|
|
40
40
|
fields: number;
|
|
41
|
+
errors: number;
|
|
41
42
|
};
|
|
42
43
|
export declare function saveCstMark(ctx: ParseContext): CstRollbackMark;
|
|
43
44
|
export declare function rollbackCstCapture(ctx: ParseContext, mark: CstRollbackMark): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-buffer.d.ts","sourceRoot":"","sources":["../../src/cst/capture-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,SAAS,CAAA;IAC3B,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CAC1B,CAAA;AAKD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAE3D;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAChC,EAAE,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IAC9B,GAAG,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACpC,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IACjC,GAAG,EAAE,OAAO,GAAG,SAAS,CAAA;IACxB,GAAG,EAAE,aAAa,GAAG,SAAS,CAAA;CAC/B,CAAA;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,mBAAmB,CAgB1E;AAED,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F;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAOnD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAOtD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAIlD;AAED,MAAM,MAAM,eAAe,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,CAAA;CAAE,CAAA;AAE3G,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,eAAe,CAa9D;AAkBD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI,CAoBjF;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAkBN;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,IAAI,CAON;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAElE"}
|
|
@@ -40,6 +40,37 @@ export declare function absoluteSpanAt(root: RelNode, path: readonly number[]):
|
|
|
40
40
|
start: number;
|
|
41
41
|
end: number;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* A CST child as far as span projection cares: a nested span + optional children.
|
|
45
|
+
* `children` is typed loosely (`unknown[]`) so the real heterogeneous CST unions
|
|
46
|
+
* (nodes, leaves, error nodes — a leaf has no `children`) satisfy it directly.
|
|
47
|
+
*/
|
|
48
|
+
type Spanned = {
|
|
49
|
+
readonly span: {
|
|
50
|
+
readonly start: number;
|
|
51
|
+
readonly end: number;
|
|
52
|
+
};
|
|
53
|
+
readonly children?: readonly unknown[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Rewrite a CST subtree's spans to be RELATIVE to `parentBase` (the absolute
|
|
57
|
+
* start of the node's parent; root base = 0). Each child's own children are
|
|
58
|
+
* relativized against *this* node's absolute start. Preserves every other field
|
|
59
|
+
* (`_tag`, `type`, `state`, leaf `value`, …) by shallow spread.
|
|
60
|
+
*/
|
|
61
|
+
export declare function relativizeCST<T extends Spanned>(node: T, parentBase?: number): T;
|
|
62
|
+
/** Reconstruct absolute CST spans from a relative subtree. Inverse of `relativizeCST`. */
|
|
63
|
+
export declare function absolutizeCST<T extends Spanned>(node: T, parentBase?: number): T;
|
|
64
|
+
/**
|
|
65
|
+
* Absolute span of the CST node at `path` (child indices from the root),
|
|
66
|
+
* accumulating the base as it descends — O(path length), no full absolutize.
|
|
67
|
+
* The relative-form cursor for a positioned CST: query one node's absolute
|
|
68
|
+
* position without materializing the whole tree.
|
|
69
|
+
*/
|
|
70
|
+
export declare function absoluteSpanCST(root: Spanned, path: readonly number[]): {
|
|
71
|
+
start: number;
|
|
72
|
+
end: number;
|
|
73
|
+
};
|
|
43
74
|
/** Naive absolute reshift (baseline): shift every offset >= `at` by `delta`. */
|
|
44
75
|
export declare function shiftAbsolute(node: AbsNode, at: number, delta: number): AbsNode;
|
|
45
76
|
/**
|
|
@@ -53,4 +84,5 @@ export declare function shiftAbsolute(node: AbsNode, at: number, delta: number):
|
|
|
53
84
|
export declare function applyEdit(root: RelNode, at: number, delta: number, stats?: {
|
|
54
85
|
allocated: number;
|
|
55
86
|
}): RelNode;
|
|
87
|
+
export {};
|
|
56
88
|
//# sourceMappingURL=relative-spans.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative-spans.d.ts","sourceRoot":"","sources":["../../src/cst/relative-spans.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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H,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAUtG;AAED,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQ/E;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC5B,OAAO,CAGT"}
|
package/dist/cst/types.d.ts
CHANGED
|
@@ -43,17 +43,17 @@ export type CSTLeaf = {
|
|
|
43
43
|
readonly span: Span;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
|
-
* A
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* A recovered parse error embedded in the tree at a recovery point (tolerant
|
|
47
|
+
* parsing). Spans exactly the skipped text; `expected` is what the grammar wanted
|
|
48
|
+
* there. Identical shape to the runtime `ParseError`, so recovery emits ONE value
|
|
49
|
+
* into both the CST `children` and the flat `ctx._errors` channel. A tree walk
|
|
50
|
+
* finds every diagnostic, and — because it rides in the tree — an incremental
|
|
51
|
+
* reuse keeps it attached to the untouched subtree it belongs to.
|
|
49
52
|
*/
|
|
50
53
|
export type CSTError = {
|
|
51
|
-
readonly _tag: '
|
|
52
|
-
readonly type: string;
|
|
54
|
+
readonly _tag: 'parseError';
|
|
53
55
|
readonly span: Span;
|
|
54
56
|
readonly expected: string[];
|
|
55
|
-
readonly children: CSTChild[];
|
|
56
|
-
readonly state: unknown;
|
|
57
57
|
};
|
|
58
58
|
export type CSTChild = CSTNode | CSTLeaf | CSTError;
|
|
59
59
|
/**
|
package/dist/cst/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cst/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC5D,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAA;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACpB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cst/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC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G,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA"}
|
package/dist/functional/doc.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Incremental parse document — incremental re-parse over a rules() registry.
|
|
3
3
|
*/
|
|
4
|
-
import type { ParseContext,
|
|
4
|
+
import type { Combinator, ParseContext, ParseError, ParseResult } from '../types.ts';
|
|
5
5
|
import type { NodeLike, CSTLeaf, CSTError } from '../cst/types.ts';
|
|
6
6
|
/** A single compiled (or interpreted) rule: parse from `pos`, producing node `N`. */
|
|
7
7
|
export type RuleFn<N> = (input: string, pos: number, ctx: ParseContext) => ParseResult<N>;
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Rule name → parser. Each entry is either a bare parse function or a
|
|
10
|
+
* `Combinator` (what `rules()` returns). Passing the `rules()` combinators
|
|
11
|
+
* directly lets `.edit()` inspect the grammar — required for **sound** structural
|
|
12
|
+
* list-reuse (see `structuralReuse`): only a rule the grammar proves is a genuine
|
|
13
|
+
* repetition is ever spliced. A bare-function registry still parses correctly; it
|
|
14
|
+
* just can't be structurally reused (the splice is skipped, never guessed).
|
|
15
|
+
*/
|
|
16
|
+
export type Registry<N> = Record<string, RuleFn<N> | Combinator<N>>;
|
|
10
17
|
export type ParseDocOptions<N extends NodeLike> = {
|
|
11
18
|
/** Initial grammar state threaded into ctx.state for the root parse. */
|
|
12
19
|
state?: unknown;
|
|
@@ -23,11 +30,83 @@ export type ParseDocOptions<N extends NodeLike> = {
|
|
|
23
30
|
* own builders (eval mode).
|
|
24
31
|
*/
|
|
25
32
|
build?: ParseContext['build'];
|
|
33
|
+
/**
|
|
34
|
+
* Enable structural list-reuse: on a length-changing *structural* edit (adding
|
|
35
|
+
* or removing a whole element in a collection) that would otherwise force a full
|
|
36
|
+
* reparse, reparse only the disturbed span and reuse the collection's untouched
|
|
37
|
+
* tail elements by identity — turning an insert near the top of a large list from
|
|
38
|
+
* O(list) into O(edit + trailing siblings).
|
|
39
|
+
*
|
|
40
|
+
* OFF by default because it is sound only when a rule whose CST children form a
|
|
41
|
+
* homogeneous, separator-delimited element list is a genuine REPETITION
|
|
42
|
+
* (`many` / `sepBy` / `oneOrMore`), not a fixed-arity sequence of same-typed
|
|
43
|
+
* tokens (e.g. `Triple = Num ',' Num ',' Num`) — the two are structurally
|
|
44
|
+
* indistinguishable without the grammar, and splicing the latter would accept an
|
|
45
|
+
* element count it shouldn't. Turn it on when your list rules are true
|
|
46
|
+
* repetitions (the common case: JSON arrays/objects, CSS value lists, argument
|
|
47
|
+
* lists). Every splice is still guarded (exact tiling + lookahead probe +
|
|
48
|
+
* stateless-tail check) and falls back to a full, correct reparse when unproven;
|
|
49
|
+
* the flag only authorises *attempting* the reuse.
|
|
50
|
+
*/
|
|
51
|
+
structuralReuse?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Parse tolerantly: `many`/`sepBy`/`oneOrMore` recover from a failed element
|
|
54
|
+
* (skip to an inferred sync point, embed a `ParseError` over the skipped span),
|
|
55
|
+
* so a broken edit keeps producing a tree instead of collapsing to `null` — the
|
|
56
|
+
* editor-backend path. Off by default (strict, byte-identical). Recovery is a cold
|
|
57
|
+
* path: well-formed input never triggers it. Every reparse the doc does — root,
|
|
58
|
+
* localized rule, and list-splice — inherits this flag, and the reuse-soundness
|
|
59
|
+
* probes run at the same tolerance so incremental reuse stays valid under recovery
|
|
60
|
+
* (a scan that would cross a splice boundary just falls back to a full reparse).
|
|
61
|
+
*/
|
|
62
|
+
tolerant?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The grammar's trivia rule, used ONLY to compute `unconsumedFrom`: a root rule
|
|
65
|
+
* consumes trivia BETWEEN terms but not after the last, so trailing
|
|
66
|
+
* whitespace/comments would otherwise read as leftover input. Given the trivia
|
|
67
|
+
* rule, the tail is skipped before reporting the first unconsumed offset —
|
|
68
|
+
* matching `run()`'s semantics. Defaults to the root rule's own
|
|
69
|
+
* `_meta.grammarTrivia` (from `rules({ trivia })`); set it only to override.
|
|
70
|
+
*/
|
|
71
|
+
trivia?: Combinator<unknown>;
|
|
26
72
|
};
|
|
27
73
|
export interface ParseDoc<N extends NodeLike> {
|
|
74
|
+
/**
|
|
75
|
+
* The parse tree with PARENT-RELATIVE spans — each node's `span` is relative to
|
|
76
|
+
* its parent's start (root base 0). This is the shareable representation: a
|
|
77
|
+
* length-changing `.edit()` keeps every untouched subtree shared by identity,
|
|
78
|
+
* and reading the tree is O(1) (no offset rewrite). For absolute positions use
|
|
79
|
+
* the O(depth) cursor `spanAt(path)`, or `absolutizeCST(doc.tree)` to
|
|
80
|
+
* materialize the whole absolute tree. A fresh non-incremental `node().parse()`
|
|
81
|
+
* result is unchanged — still absolute.
|
|
82
|
+
*/
|
|
28
83
|
readonly tree: N | null;
|
|
29
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Recovery diagnostics collected during the (re)parse — the missing-token
|
|
86
|
+
* `expect()` errors and tolerant-list recovery errors that ride the tree as
|
|
87
|
+
* `parseError` nodes, surfaced here as a flat list too (spans ABSOLUTE). Empty
|
|
88
|
+
* in strict mode. On a hard (non-recovered) parse failure this holds the single
|
|
89
|
+
* top-level failure. This is what makes an editor document able to see syntax
|
|
90
|
+
* errors — a blank `errors: []` (the prior behaviour) hid every recovery.
|
|
91
|
+
*/
|
|
92
|
+
readonly errors: ParseError[];
|
|
93
|
+
/**
|
|
94
|
+
* Offset where unparsed input begins — the first non-trivia character the parse
|
|
95
|
+
* left unconsumed (trailing trivia skipped when a trivia rule is available), or
|
|
96
|
+
* `null` if the whole input was consumed. This is how a document detects "the
|
|
97
|
+
* grammar stopped short, there's junk here"; computed exactly as `run()` does.
|
|
98
|
+
*/
|
|
99
|
+
readonly unconsumedFrom: number | null;
|
|
30
100
|
readonly input: string;
|
|
101
|
+
/**
|
|
102
|
+
* Absolute span of the node at `path` (child indices from the root) — O(depth),
|
|
103
|
+
* without materializing the absolute tree. The projection cursor for the
|
|
104
|
+
* relative representation; use it for spot queries on a large incremental doc.
|
|
105
|
+
*/
|
|
106
|
+
spanAt(path: readonly number[]): {
|
|
107
|
+
start: number;
|
|
108
|
+
end: number;
|
|
109
|
+
};
|
|
31
110
|
/**
|
|
32
111
|
* Incrementally re-parse after a text change. `from`/`to` are byte offsets in
|
|
33
112
|
* the OLD input; `replacement` fills that range (editor change-event shape).
|
|
@@ -47,6 +126,12 @@ export interface ParseDoc<N extends NodeLike> {
|
|
|
47
126
|
* probe results with.
|
|
48
127
|
*/
|
|
49
128
|
export declare function structurallyEqual(a: unknown, b: unknown): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* The relative (parent-offset) tree backing a doc. Currently identical to the
|
|
131
|
+
* public `doc.tree` (which is relative); kept as a named internal handle for the
|
|
132
|
+
* reuse-metric tests, which assert on the shareable representation explicitly.
|
|
133
|
+
*/
|
|
134
|
+
export declare function relTreeOf<N extends NodeLike>(doc: ParseDoc<N>): N | null;
|
|
50
135
|
/**
|
|
51
136
|
* Parse `input` from `rootRule` and wrap the result in a ParseDoc that can
|
|
52
137
|
* be incrementally re-parsed via `.edit()`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/functional/doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/functional/doc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAmB,MAAM,aAAa,CAAA;AACrG,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAmBlE,qFAAqF;AACrF,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,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AAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;CACjE;AA+TD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CA8BjE;AA0OD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAExE;AAqDD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,QAAQ,EACzC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,eAAe,CAAC,CAAC,CAAM,GAC5B,QAAQ,CAAC,CAAC,CAAC,CAiBb"}
|
package/dist/functional/run.d.ts
CHANGED
|
@@ -40,6 +40,17 @@ export type RunOptions = {
|
|
|
40
40
|
* `triviaLog` returned by `run()` is unaffected. Omit to capture every kind.
|
|
41
41
|
*/
|
|
42
42
|
triviaCaptureMask?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Activate automatic list recovery. When true, `many`/`sepBy`/`oneOrMore` recover
|
|
45
|
+
* from a failed element — skip to a sync point (a resume token inferred from the
|
|
46
|
+
* grammar's structure; the grammar carries no recovery config), emit a
|
|
47
|
+
* `ParseError` over the skipped span (collected in `errors`), and keep parsing the
|
|
48
|
+
* rest of the list — instead of stopping at the first bad element. Omit (the
|
|
49
|
+
* default) for the strict "one clean error and stop" behavior, byte-identical to a
|
|
50
|
+
* run with no recovery. Recovery is a cold path: on well-formed input nothing
|
|
51
|
+
* fails, so none of the machinery runs.
|
|
52
|
+
*/
|
|
53
|
+
tolerant?: boolean;
|
|
43
54
|
};
|
|
44
55
|
export type RunResult = {
|
|
45
56
|
ok: boolean;
|
|
@@ -51,7 +62,7 @@ export type RunResult = {
|
|
|
51
62
|
};
|
|
52
63
|
/** Expected-token set when the TOP-LEVEL parse failed (empty on success). */
|
|
53
64
|
expected: string[];
|
|
54
|
-
/**
|
|
65
|
+
/** Recovery diagnostics (tolerant lists / `expect()`) collected during the parse (in order). */
|
|
55
66
|
errors: ParseError[];
|
|
56
67
|
/**
|
|
57
68
|
* Flat trivia log for building a trivia map. Entry width depends on whether the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functional/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functional/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGpF;;;;;;;;;;;;GAYG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,QAAQ,GAChB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,KAAK,WAAW,CAAC,OAAO,CAAC,CAAC,GACzE,UAAU,CAAC,OAAO,CAAC,CAAA;AAEvB,MAAM,MAAM,UAAU,GAAG;IACvB;qFACiF;IACjF,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAC7B,uDAAuD;IACvD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAA;IACjB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,OAAO,CAAA;IACX,0DAA0D;IA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