parseman 0.60.1 → 0.60.3
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/commitment.d.ts +1 -1
- package/dist/analysis/commitment.d.ts.map +1 -1
- package/dist/analysis/diagnostics.js +128 -43
- package/dist/analysis/diagnostics.js.map +2 -2
- package/dist/cli/index.js +128 -43
- package/dist/cli/index.js.map +2 -2
- package/dist/index.js +128 -43
- package/dist/index.js.map +2 -2
- package/dist/plugin/index.d.ts +18 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +240 -87
- package/dist/plugin/index.js.map +2 -2
- package/dist/table/assemble.d.ts +11 -0
- package/dist/table/assemble.d.ts.map +1 -1
- package/dist/table/emit-assembly.d.ts +1 -0
- package/dist/table/emit-assembly.d.ts.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/exec.d.ts.map +1 -1
- package/dist/table/index.js +128 -43
- package/dist/table/index.js.map +2 -2
- package/dist/table/program.d.ts +9 -0
- package/dist/table/program.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/analysis/commitment.ts +29 -15
- package/src/plugin/index.ts +189 -63
- package/src/table/assemble.ts +35 -10
- package/src/table/emit-assembly.ts +41 -11
- package/src/table/encode.ts +57 -9
- package/src/table/exec.ts +5 -2
- package/src/table/program.ts +19 -0
- package/src/version.ts +1 -1
package/dist/table/assemble.d.ts
CHANGED
|
@@ -114,6 +114,15 @@ export type RunCfg = {
|
|
|
114
114
|
* literal bodies to buy nothing measurable.
|
|
115
115
|
*/
|
|
116
116
|
readonly probe: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* A caller supplied `ctx.trivia` to a program with no trivia of its own. Such
|
|
119
|
+
* a program records trivia rows only then, so only this assembly restores the
|
|
120
|
+
* trivia logs a failed alternative recorded (`choiceLogRollbackMask`,
|
|
121
|
+
* `failureLogRollback`); every other parse of it takes none of those marks. A
|
|
122
|
+
* program with trivia of its own always restores them and never sets this.
|
|
123
|
+
* Fixed for the parse: a program with no trivia never installs any.
|
|
124
|
+
*/
|
|
125
|
+
readonly inheritedTrivia?: boolean;
|
|
117
126
|
};
|
|
118
127
|
/** The cfg key an assembly is cached under. */
|
|
119
128
|
export declare function cfgKey(c: RunCfg): number;
|
|
@@ -192,6 +201,8 @@ export declare class AssemblyCache {
|
|
|
192
201
|
private readonly t;
|
|
193
202
|
private readonly prog;
|
|
194
203
|
private readonly byCfg;
|
|
204
|
+
/** Whether this program installs no trivia of its own (`RunCfg.inheritedTrivia`). */
|
|
205
|
+
private readonly noOwnTrivia;
|
|
195
206
|
/**
|
|
196
207
|
* Monomorphic predicate inline cache. An assembly depends on the predicate
|
|
197
208
|
* FUNCTION and the scalar cfg key, not on the host object that carries it, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/table/assemble.ts"],"names":[],"mappings":"AAmEA,OAAO,KAAK,EAAE,UAAU,EAAsB,YAAY,EAA0B,MAAM,aAAa,CAAA;AAgDvG;;;;;;;;;;;;GAYG;AACH,OAAO,EAGL,KAAK,cAAc,EAAsB,KAAK,aAAa,EAC1C,KAAK,YAAY,EAAE,KAAK,SAAS,EACnD,MAAM,cAAc,CAAA;AA4ErB;;;;;;;;;;;;;GAaG;AACH,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAA;AAgDvE;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CA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AM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI;AACjD,qFAAqF;AACrF,GAAG,GAAE,SAAS,OAAO,EAAa,GACjC,UAAU,CAQZ;AAED;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAe;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2D;IACjF,qFAAqF;IACrF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC;;;;;;OAMG;IACH,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,cAAc,CAAyC;IAE/D,YAAY,IAAI,EAAE,YAAY,EAAE,QAAQ,GAAE,aAAkC,EAI3E;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CASzB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,GAAG,QAAQ,CAmClC;CACF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;AAC3F;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,YAAY,GAAG,cAAc,EACrC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACnD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -154,6 +154,7 @@ export declare function emitAssemblySource(t: ResolvedTable, prog: TableProgram,
|
|
|
154
154
|
tolerant: boolean;
|
|
155
155
|
coverage: boolean;
|
|
156
156
|
probe: boolean;
|
|
157
|
+
inheritedTrivia?: boolean;
|
|
157
158
|
}, extraIps?: readonly number[], staticBuild?: boolean, select?: ReadonlySet<number>,
|
|
158
159
|
/**
|
|
159
160
|
* Leave the `_errors` bit of a lexical program over a scan out of the side-sink
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-assembly.d.ts","sourceRoot":"","sources":["../../src/table/emit-assembly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAS/C,OAAO,EAEL,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAC1D,MAAM,cAAc,CAAA;AAqBrB,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAA;AACrF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAC7C,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,CAAA;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,KAAK,IAAI,CAAA;IAClG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAA;CACxC,CAAA;AACD,gFAAgF;AAChF,MAAM,MA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,MAAM,EAAO,EAChC,WAAW,UAAQ,EACnB,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AAC5B;;;;;GAKG;AACH,eAAe,UAAQ;AACvB;;;;GAIG;AACH,UAAU,UAAQ,GACjB,UAAU,CAg1EZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/table/encode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,UAAU,EAAuB,MAAM,aAAa,CAAA;AAyBhF,OAAO,KAAK,EAAmE,YAAY,EAAc,MAAM,cAAc,CAAA;AAS7H,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AA0B9E,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,YAAY,GAAG,EAAE,MAAM,EAAqE;CAC7F;AAED,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CACxC,CAAA;
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/table/encode.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,UAAU,EAAuB,MAAM,aAAa,CAAA;AAyBhF,OAAO,KAAK,EAAmE,YAAY,EAAc,MAAM,cAAc,CAAA;AAS7H,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AA0B9E,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,YAAY,GAAG,EAAE,MAAM,EAAqE;CAC7F;AAED,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CACxC,CAAA;AA8vED,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAC5C,QAAQ,GAAE,aAAkB,GAC3B,YAAY,CAEd;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,EAC5C,QAAQ,GAAE,aAAkB,GAC3B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAA;CAAE,CA+BnD"}
|
package/dist/table/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/table/exec.ts"],"names":[],"mappings":"AA6CA,OAAO,EAEL,KAAK,cAAc,EACF,KAAK,YAAY,EAAE,KAAK,SAAS,EACnD,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/table/exec.ts"],"names":[],"mappings":"AA6CA,OAAO,EAEL,KAAK,cAAc,EACF,KAAK,YAAY,EAAE,KAAK,SAAS,EACnD,MAAM,cAAc,CAAA;AAqpDrB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,GAAG,cAAc;AACrC;;;;;;;;GAQG;AACH,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,EACjC,gBAAgB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAiC3B"}
|
package/dist/table/index.js
CHANGED
|
@@ -4277,7 +4277,9 @@ function ownTableProgram(prog, resolved, caches = {}) {
|
|
|
4277
4277
|
resolved,
|
|
4278
4278
|
choiceRollbackMasks: caches.choiceRollbackMasks ?? runtime?.choiceRollbackMasks,
|
|
4279
4279
|
nonCommittingChoiceSites: caches.nonCommittingChoiceSites ?? runtime?.nonCommittingChoiceSites,
|
|
4280
|
-
failureRollbackCleanSites: caches.failureRollbackCleanSites ?? runtime?.failureRollbackCleanSites
|
|
4280
|
+
failureRollbackCleanSites: caches.failureRollbackCleanSites ?? runtime?.failureRollbackCleanSites,
|
|
4281
|
+
choiceLogRollbackMasks: caches.choiceLogRollbackMasks ?? runtime?.choiceLogRollbackMasks,
|
|
4282
|
+
failureLogRollbackSites: caches.failureLogRollbackSites ?? runtime?.failureLogRollbackSites
|
|
4281
4283
|
}
|
|
4282
4284
|
};
|
|
4283
4285
|
}
|
|
@@ -4290,6 +4292,12 @@ function choiceCannotCommit(prog, ip) {
|
|
|
4290
4292
|
function failureRollbackClean(prog, ip) {
|
|
4291
4293
|
return prog[TABLE_RUNTIME]?.failureRollbackCleanSites?.has(ip) === true;
|
|
4292
4294
|
}
|
|
4295
|
+
function choiceLogRollbackMask(prog, ip) {
|
|
4296
|
+
return prog[TABLE_RUNTIME]?.choiceLogRollbackMasks?.get(ip) ?? 0;
|
|
4297
|
+
}
|
|
4298
|
+
function failureLogRollback(prog, ip) {
|
|
4299
|
+
return prog[TABLE_RUNTIME]?.failureLogRollbackSites?.has(ip) === true;
|
|
4300
|
+
}
|
|
4293
4301
|
var WIDE_CLASS_PREFIX_LO = 65535;
|
|
4294
4302
|
var WIDE_CLASS_PREFIX_HI = 0;
|
|
4295
4303
|
function validateClassRange(lo, hi) {
|
|
@@ -5728,7 +5736,7 @@ function projectChild(children2, project, type) {
|
|
|
5728
5736
|
}
|
|
5729
5737
|
|
|
5730
5738
|
// src/version.ts
|
|
5731
|
-
var PARSEMAN_VERSION = "0.60.
|
|
5739
|
+
var PARSEMAN_VERSION = "0.60.3";
|
|
5732
5740
|
|
|
5733
5741
|
// src/table/assemble.ts
|
|
5734
5742
|
import { PlainBuf as PlainBuf2, PlainField, PlainLeaf as PlainLeaf8, PlainNode as PlainNode2, PlainSpan as PlainSpan9 } from "../cst/plain.js";
|
|
@@ -7667,6 +7675,13 @@ if(ctx._errors!==undefined&&ctx._errors.length!==${t}er)ctx._errors.length=${t}e
|
|
|
7667
7675
|
if (!s.fd && !s.er) return `if(${t}n)rollbackTriviaAt(ctx,${t}raw,${t}tl,${t}lv,undefined,undefined,${t}lg,${t}rt)`;
|
|
7668
7676
|
return `if(${t}n){rollbackTriviaAt(ctx,${t}raw,${t}tl,${t}lv,${s.fd ? `${t}fd` : "undefined"},${s.er ? `${t}er` : "undefined"},${t}lg,${t}rt)}`;
|
|
7669
7677
|
}
|
|
7678
|
+
function emitLogMark(t) {
|
|
7679
|
+
return `const ${t}lg=ctx._triviaLog!==undefined?ctx._triviaLog.length:0,${t}rt=ctx._rootTriviaLog!==undefined?ctx._rootTriviaLog.length:0`;
|
|
7680
|
+
}
|
|
7681
|
+
function emitLogRollback(t) {
|
|
7682
|
+
return `{const g=ctx._triviaLog;if(g!==undefined)while(g.length>${t}lg)g.pop()}
|
|
7683
|
+
{const r=ctx._rootTriviaLog;if(r!==undefined)while(r.length>${t}rt)r.pop()}`;
|
|
7684
|
+
}
|
|
7670
7685
|
function emitTerm(callee, dst, t, l, skip, miss) {
|
|
7671
7686
|
const fast = `const ${t}v=${callee}(input,cur,ctx)
|
|
7672
7687
|
if(${t}v===FAIL)return FAIL
|
|
@@ -7750,6 +7765,7 @@ function emitAssemblySource(t, prog, cfg, extraIps = [], staticBuild = false, se
|
|
|
7750
7765
|
const { code, k, fx, disp, dsp, triviaLabelled } = t;
|
|
7751
7766
|
const swapLegal = !cfg.trackLines;
|
|
7752
7767
|
const hostCst = cfg.hostCst;
|
|
7768
|
+
const LOGS = (prog.triviaSpecs?.length ?? 0) > 0 || cfg.inheritedTrivia === true;
|
|
7753
7769
|
const REC = prog.rec === 1 && cfg.tolerant;
|
|
7754
7770
|
if (cfg.coverage) throw new Unemittable("a coverage assembly");
|
|
7755
7771
|
const roots = [...Object.values(prog.rules), ...extraIps];
|
|
@@ -8518,12 +8534,13 @@ return v
|
|
|
8518
8534
|
case OP_ATTEMPT: {
|
|
8519
8535
|
const child = link(code[ip + 1]);
|
|
8520
8536
|
const clean = !REC && failureRollbackClean(prog, ip);
|
|
8537
|
+
const logs = clean && LOGS && failureLogRollback(prog, ip);
|
|
8521
8538
|
const p = tmp();
|
|
8522
8539
|
return `${head}
|
|
8523
|
-
${clean ? "" : emitMark(p, L.buf, L.raw, sinks)}
|
|
8540
|
+
${clean ? logs ? emitLogMark(p) : "" : emitMark(p, L.buf, L.raw, sinks)}
|
|
8524
8541
|
const v=${child}(input,pos,ctx)
|
|
8525
8542
|
if(v!==FAIL)return v
|
|
8526
|
-
${clean ? "" : emitRollback(p, L.buf, L.raw, sinks)}
|
|
8543
|
+
${clean ? logs ? emitLogRollback(p) : "" : emitRollback(p, L.buf, L.raw, sinks)}
|
|
8527
8544
|
${code[ip + 2] === 1 ? "ctx._fc=false" : "if(ctx._fc===true)return FAIL"}
|
|
8528
8545
|
ctx._fe=pos
|
|
8529
8546
|
return FAIL
|
|
@@ -8549,6 +8566,7 @@ return FAIL
|
|
|
8549
8566
|
${lookaheadMiss(code[ip + 1], "EC.e=pos;return null")}${emitMark(p, L.buf, L.raw, sinks)}
|
|
8550
8567
|
${cfg.probe ? "const pb=ctx._probe?.best\n" : ""}const v=${child}(input,pos,ctx)
|
|
8551
8568
|
${emitRollback(p, L.buf, L.raw, sinks)}
|
|
8569
|
+
ctx._fc=false
|
|
8552
8570
|
${cfg.probe ? "if(ctx._probe!==undefined)ctx._probe.best=pb??null\n" : ""}if(v===FAIL){EC.e=pos;return null}
|
|
8553
8571
|
ctx._fe=pos
|
|
8554
8572
|
ctx._fx=${xf}
|
|
@@ -8573,6 +8591,7 @@ return null
|
|
|
8573
8591
|
${lookaheadMiss(code[ip + 1], `ctx._fe=pos;ctx._fx=${xf};return FAIL`)}${emitMark(p, L.buf, L.raw, sinks)}
|
|
8574
8592
|
${cfg.probe ? "const pb=ctx._probe?.best\n" : ""}const v=${child}(input,pos,ctx)
|
|
8575
8593
|
${emitRollback(p, L.buf, L.raw, sinks)}
|
|
8594
|
+
ctx._fc=false
|
|
8576
8595
|
${cfg.probe ? "if(ctx._probe!==undefined)ctx._probe.best=pb??null\n" : ""}if(v===FAIL){ctx._fe=pos;ctx._fx=${xf};return FAIL}
|
|
8577
8596
|
EC.e=pos
|
|
8578
8597
|
return null
|
|
@@ -8581,14 +8600,15 @@ return null
|
|
|
8581
8600
|
case OP_OPT: {
|
|
8582
8601
|
const child = link(code[ip + 1]);
|
|
8583
8602
|
const clean = !REC && failureRollbackClean(prog, ip);
|
|
8603
|
+
const logs = clean && LOGS && failureLogRollback(prog, ip);
|
|
8584
8604
|
const p = tmp();
|
|
8585
8605
|
return `${head}
|
|
8586
|
-
${lookaheadMiss(code[ip + 1], "EC.e=pos;return null")}${clean ? "" : emitMark(p, L.buf, L.raw, sinks)}
|
|
8606
|
+
${lookaheadMiss(code[ip + 1], "EC.e=pos;return null")}${clean ? logs ? emitLogMark(p) : "" : emitMark(p, L.buf, L.raw, sinks)}
|
|
8587
8607
|
ctx._fc=false
|
|
8588
8608
|
const v=${child}(input,pos,ctx)
|
|
8589
8609
|
if(v===FAIL){
|
|
8590
8610
|
if(ctx._fc===true)return FAIL
|
|
8591
|
-
${clean ? "" : emitRollback(p, L.buf, L.raw, sinks)}
|
|
8611
|
+
${clean ? logs ? emitLogRollback(p) : "" : emitRollback(p, L.buf, L.raw, sinks)}
|
|
8592
8612
|
EC.e=pos
|
|
8593
8613
|
return null
|
|
8594
8614
|
}
|
|
@@ -8738,6 +8758,10 @@ return FAIL
|
|
|
8738
8758
|
const encodedRollbackMask = choiceRollbackMask(prog, ip) ?? -1;
|
|
8739
8759
|
const rollbackMask = REC ? -1 : encodedRollbackMask;
|
|
8740
8760
|
const hasRollback = rollbackMask !== 0;
|
|
8761
|
+
const logMask = rollbackMask === -1 || !LOGS ? 0 : choiceLogRollbackMask(prog, ip);
|
|
8762
|
+
const choiceMark = hasRollback ? emitMark(p, L.buf, L.raw, sinks) : "";
|
|
8763
|
+
const armMark = (i) => !hasRollback && (logMask & 1 << i) !== 0 ? `${emitLogMark(p)}
|
|
8764
|
+
` : "";
|
|
8741
8765
|
const startFailureExact = arms.every((_arm, i) => {
|
|
8742
8766
|
const terminal = leadingScalarTerminal(code, code[base + i], 0, false);
|
|
8743
8767
|
if (terminal < 0) return false;
|
|
@@ -8749,7 +8773,7 @@ return FAIL
|
|
|
8749
8773
|
if (op2 === OP_LIT) return typeof spec === "string" && spec.length > 0;
|
|
8750
8774
|
return op2 === OP_RX && spec instanceof RegExp && !regexCanMatchEmpty(spec.source);
|
|
8751
8775
|
});
|
|
8752
|
-
const rollbackFor = (i) => rollbackMask === -1 || (rollbackMask & 1 << i) !== 0 ? emitRollback(p, L.buf, L.raw, sinks) : "";
|
|
8776
|
+
const rollbackFor = (i) => rollbackMask === -1 || (rollbackMask & 1 << i) !== 0 ? emitRollback(p, L.buf, L.raw, sinks) : (logMask & 1 << i) === 0 ? "" : hasRollback ? emitRollback(p, L.buf, L.raw, sinks) : emitLogRollback(p);
|
|
8753
8777
|
if (choiceCannotCommit(prog, ip) && !startFailureExact) {
|
|
8754
8778
|
const deepAt = Array.from({ length: n }, () => tmp());
|
|
8755
8779
|
const deepFx = Array.from({ length: n }, () => tmp());
|
|
@@ -8775,7 +8799,7 @@ ${remember2(i, "at", pretest.sequence.expected.map((value, at) => `${decision}==
|
|
|
8775
8799
|
}`;
|
|
8776
8800
|
return `${decision === "" ? "" : `let ${decision}=${pretest?.sequence === void 0 ? -1 : 0}
|
|
8777
8801
|
`}if(${gate}){
|
|
8778
|
-
ctx._fc=false
|
|
8802
|
+
${armMark(i)}ctx._fc=false
|
|
8779
8803
|
{const v=${arm}(input,pos,ctx)
|
|
8780
8804
|
if(v!==FAIL)return v}
|
|
8781
8805
|
{const at=ctx._fe??pos
|
|
@@ -8794,7 +8818,7 @@ ctx._fe=pos;ctx._fx=acc??${choiceFx}
|
|
|
8794
8818
|
return FAIL`;
|
|
8795
8819
|
return `${head}
|
|
8796
8820
|
const c=${directAsciiMask ? "input.charCodeAt(pos)" : "lead(input,pos)"}
|
|
8797
|
-
${
|
|
8821
|
+
${choiceMark}
|
|
8798
8822
|
${deepAt.map((at, i) => `let ${at},${deepFx[i]}`).join("\n")}
|
|
8799
8823
|
${maskable ? `if(c<128){
|
|
8800
8824
|
const bits=${maskName}[${directAsciiMask ? "c" : "c<0?128:c"}]
|
|
@@ -8841,7 +8865,7 @@ if(at===best${startFailureExact ? "&&at>pos" : ""})acc=_accSet(${pretest.sequenc
|
|
|
8841
8865
|
}`;
|
|
8842
8866
|
return `${decision === "" ? "" : `let ${decision}=${pretest?.sequence === void 0 ? -1 : 0}
|
|
8843
8867
|
`}if((bits&${1 << i})!==0${condition}){
|
|
8844
|
-
ctx._fc=false
|
|
8868
|
+
${armMark(i)}ctx._fc=false
|
|
8845
8869
|
{const v=${arm}(input,pos,ctx)
|
|
8846
8870
|
if(v!==FAIL)return v}
|
|
8847
8871
|
${startFailureExact ? "" : `if(best===pos)acc=${catchName}(${i},prev,acc)
|
|
@@ -8872,7 +8896,7 @@ if(at===best${startFailureExact ? "&&at>pos" : ""})acc=_accSet(${pretest.token.e
|
|
|
8872
8896
|
}${startFailureExact ? "" : `else if(best===pos)acc=_accSet(${expected[i]},acc)`}`;
|
|
8873
8897
|
return `${decision === "" ? "" : `let ${decision}=${pretest?.sequence === void 0 ? -1 : 0}
|
|
8874
8898
|
`}if((${gateRefs[i]}===null||classHas(${gateRefs[i]},c))${condition}){
|
|
8875
|
-
ctx._fc=false
|
|
8899
|
+
${armMark(i)}ctx._fc=false
|
|
8876
8900
|
{const v=${arm}(input,pos,ctx)
|
|
8877
8901
|
if(v!==FAIL)return v}
|
|
8878
8902
|
{const at=ctx._fe??pos
|
|
@@ -8884,7 +8908,7 @@ ${rollbackFor(i)}
|
|
|
8884
8908
|
}).join("\n");
|
|
8885
8909
|
return `${head}
|
|
8886
8910
|
const c=${directAsciiMask ? "input.charCodeAt(pos)" : "lead(input,pos)"}
|
|
8887
|
-
${
|
|
8911
|
+
${choiceMark}
|
|
8888
8912
|
let acc
|
|
8889
8913
|
let best=pos
|
|
8890
8914
|
${maskable ? `if(c<128){
|
|
@@ -9737,11 +9761,11 @@ function linkMatcher(m) {
|
|
|
9737
9761
|
}
|
|
9738
9762
|
var NO_COVERAGE = (_id) => {
|
|
9739
9763
|
};
|
|
9740
|
-
function cfgKeyOf(hostCst, trackLines, tolerant, coverage, probe, hostReadsChildren = true) {
|
|
9741
|
-
return (hostCst ? 1 : 0) | (trackLines ? 2 : 0) | (tolerant ? 4 : 0) | (coverage ? 8 : 0) | (probe ? 16 : 0) | (hostReadsChildren ? 0 : 32);
|
|
9764
|
+
function cfgKeyOf(hostCst, trackLines, tolerant, coverage, probe, hostReadsChildren = true, inheritedTrivia = false) {
|
|
9765
|
+
return (hostCst ? 1 : 0) | (trackLines ? 2 : 0) | (tolerant ? 4 : 0) | (coverage ? 8 : 0) | (probe ? 16 : 0) | (hostReadsChildren ? 0 : 32) | (inheritedTrivia ? 64 : 0);
|
|
9742
9766
|
}
|
|
9743
9767
|
function cfgKey(c) {
|
|
9744
|
-
return cfgKeyOf(c.hostCst, c.trackLines, c.tolerant, c.coverage, c.probe, c.hostReadsChildren);
|
|
9768
|
+
return cfgKeyOf(c.hostCst, c.trackLines, c.tolerant, c.coverage, c.probe, c.hostReadsChildren, c.inheritedTrivia);
|
|
9745
9769
|
}
|
|
9746
9770
|
function assertFactoryArity(pre) {
|
|
9747
9771
|
if (pre.arity === EMITTED_PARAMS.length) return;
|
|
@@ -11116,6 +11140,7 @@ function assemble(t, prog, cfg) {
|
|
|
11116
11140
|
const probeBest = PROBE ? ctx._probe?.best : void 0;
|
|
11117
11141
|
const v = child(input, pos, ctx);
|
|
11118
11142
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
11143
|
+
ctx._fc = false;
|
|
11119
11144
|
if (PROBE && ctx._probe !== void 0) ctx._probe.best = probeBest ?? null;
|
|
11120
11145
|
if (v === FAIL) {
|
|
11121
11146
|
EC.e = pos;
|
|
@@ -11161,6 +11186,7 @@ function assemble(t, prog, cfg) {
|
|
|
11161
11186
|
const probeBest = PROBE ? ctx._probe?.best : void 0;
|
|
11162
11187
|
const v = child(input, pos, ctx);
|
|
11163
11188
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
11189
|
+
ctx._fc = false;
|
|
11164
11190
|
if (PROBE && ctx._probe !== void 0) ctx._probe.best = probeBest ?? null;
|
|
11165
11191
|
if (v === FAIL) {
|
|
11166
11192
|
ctx._fe = pos;
|
|
@@ -13019,7 +13045,7 @@ function assemble(t, prog, cfg) {
|
|
|
13019
13045
|
if (emitted !== void 0) throw new ServedByBuild();
|
|
13020
13046
|
if (prog.asm !== void 0) {
|
|
13021
13047
|
throw new Unemittable(
|
|
13022
|
-
`option set ${cfgKey(cfg)} (hostCst=${cfg.hostCst} trackLines=${cfg.trackLines} tolerant=${cfg.tolerant} coverage=${cfg.coverage} probe=${cfg.probe}), which this build did not pre-compile. The Function constructor is NOT used for an artifact that carries assemblies \u2014 see \`EmitOptions.assemblies\` to add this option set to the build`
|
|
13048
|
+
`option set ${cfgKey(cfg)} (hostCst=${cfg.hostCst} trackLines=${cfg.trackLines} tolerant=${cfg.tolerant} coverage=${cfg.coverage} probe=${cfg.probe} inheritedTrivia=${cfg.inheritedTrivia === true}), which this build did not pre-compile. The Function constructor is NOT used for an artifact that carries assemblies \u2014 see \`EmitOptions.assemblies\` to add this option set to the build`
|
|
13023
13049
|
);
|
|
13024
13050
|
}
|
|
13025
13051
|
if (!EMIT_ENABLED) throw new Unemittable("PM_TABLE_EMIT=0 (measurement toggle)");
|
|
@@ -13218,7 +13244,9 @@ function countedPiece(piece, ip) {
|
|
|
13218
13244
|
var AssemblyCache = class {
|
|
13219
13245
|
t;
|
|
13220
13246
|
prog;
|
|
13221
|
-
byCfg = Array.from({ length:
|
|
13247
|
+
byCfg = Array.from({ length: 128 });
|
|
13248
|
+
/** Whether this program installs no trivia of its own (`RunCfg.inheritedTrivia`). */
|
|
13249
|
+
noOwnTrivia;
|
|
13222
13250
|
/**
|
|
13223
13251
|
* Monomorphic predicate inline cache. An assembly depends on the predicate
|
|
13224
13252
|
* FUNCTION and the scalar cfg key, not on the host object that carries it, so
|
|
@@ -13231,6 +13259,7 @@ var AssemblyCache = class {
|
|
|
13231
13259
|
constructor(prog, resolved = resolveTable(prog)) {
|
|
13232
13260
|
this.prog = prog;
|
|
13233
13261
|
this.t = resolved;
|
|
13262
|
+
this.noOwnTrivia = prog.triviaSpecs === void 0 || prog.triviaSpecs.length === 0;
|
|
13234
13263
|
}
|
|
13235
13264
|
for(cfg) {
|
|
13236
13265
|
const key = cfgKey(cfg);
|
|
@@ -13294,13 +13323,14 @@ var AssemblyCache = class {
|
|
|
13294
13323
|
const tolerant = ctx._tolerant === true;
|
|
13295
13324
|
const coverage = ctx._grammarCoverage !== void 0;
|
|
13296
13325
|
const probe = ctx._probe !== void 0;
|
|
13297
|
-
const
|
|
13326
|
+
const inheritedTrivia = this.noOwnTrivia && ctx.trivia !== void 0;
|
|
13327
|
+
const key = cfgKeyOf(hostCst, trackLines, tolerant, coverage, probe, hostReadsChildren, inheritedTrivia);
|
|
13298
13328
|
let cache = this.byCfg;
|
|
13299
13329
|
if (hostCaptureTrivia !== void 0) {
|
|
13300
13330
|
if (this.hostPredicate === hostCaptureTrivia) {
|
|
13301
13331
|
cache = this.hostAssemblies;
|
|
13302
13332
|
} else {
|
|
13303
|
-
cache = Array.from({ length:
|
|
13333
|
+
cache = Array.from({ length: 128 });
|
|
13304
13334
|
this.hostPredicate = hostCaptureTrivia;
|
|
13305
13335
|
this.hostAssemblies = cache;
|
|
13306
13336
|
}
|
|
@@ -13314,7 +13344,8 @@ var AssemblyCache = class {
|
|
|
13314
13344
|
trackLines,
|
|
13315
13345
|
tolerant,
|
|
13316
13346
|
coverage,
|
|
13317
|
-
probe
|
|
13347
|
+
probe,
|
|
13348
|
+
inheritedTrivia
|
|
13318
13349
|
});
|
|
13319
13350
|
cache[key] = made;
|
|
13320
13351
|
return made;
|
|
@@ -13634,7 +13665,7 @@ function mayFail(p, seen = /* @__PURE__ */ new Set()) {
|
|
|
13634
13665
|
return true;
|
|
13635
13666
|
}
|
|
13636
13667
|
}
|
|
13637
|
-
function mayLeavePartialCapture(p, seen = /* @__PURE__ */ new Set(), triviaActive = true) {
|
|
13668
|
+
function mayLeavePartialCapture(p, seen = /* @__PURE__ */ new Set(), triviaActive = true, throughNodes = false) {
|
|
13638
13669
|
if (seen.has(p)) return false;
|
|
13639
13670
|
seen.add(p);
|
|
13640
13671
|
const d = p._def;
|
|
@@ -13659,17 +13690,26 @@ function mayLeavePartialCapture(p, seen = /* @__PURE__ */ new Set(), triviaActiv
|
|
|
13659
13690
|
return false;
|
|
13660
13691
|
// A run's prefixes are probed detached; only its body can capture.
|
|
13661
13692
|
case "lines":
|
|
13662
|
-
return mayLeavePartialCapture(d.body, seen, triviaActive);
|
|
13663
|
-
// node() captures into its own
|
|
13664
|
-
// failure
|
|
13693
|
+
return mayLeavePartialCapture(d.body, seen, triviaActive, throughNodes);
|
|
13694
|
+
// node() captures its children into a frame of its own and drops it on
|
|
13695
|
+
// failure. The trivia logs (`_triviaLog`, `_rootTriviaLog`) are not part of
|
|
13696
|
+
// that frame: trivia its body scanned before failing stays recorded. With
|
|
13697
|
+
// `throughNodes` (a program that installs trivia somewhere) a node leaves
|
|
13698
|
+
// what its body leaves; without, it leaves nothing.
|
|
13665
13699
|
case "node":
|
|
13666
|
-
return
|
|
13667
|
-
// choice/firstMatch already roll back each failed arm; on overall
|
|
13668
|
-
// nothing committed remains.
|
|
13700
|
+
return throughNodes && mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes);
|
|
13701
|
+
// choice/firstMatch already roll back each failed arm's captures; on overall
|
|
13702
|
+
// failure nothing committed remains. The trivia logs are the exception: a
|
|
13703
|
+
// choice the table lowers as an exclusive dispatch runs its one selected arm
|
|
13704
|
+
// with no mark of its own (`emit-assembly.ts`, `table.exclusive`), so the
|
|
13705
|
+
// rows that arm's trivia scans recorded stay when it fails. With
|
|
13706
|
+
// `throughNodes` a choice leaves what one of its arms leaves, unless
|
|
13707
|
+
// `throughNodes` is the encoder's answer that this choice marks and restores
|
|
13708
|
+
// each arm it enters.
|
|
13669
13709
|
case "choice":
|
|
13670
|
-
return false;
|
|
13710
|
+
return throughNodes !== false && !(typeof throughNodes === "function" && throughNodes(p)) && d.parsers.some((arm) => mayLeavePartialCapture(arm, new Set(seen), triviaActive, throughNodes));
|
|
13671
13711
|
case "dispatch":
|
|
13672
|
-
return capturesLeaf(d.selector, new Set(seen)) || d.cases.some((x) => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive) || capturesLeaf(x.parser, new Set(seen))) || (d.matchers ? d.matchers.some((x) => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive) || capturesLeaf(x.parser, new Set(seen))) : false) || (d.otherwise ? mayLeavePartialCapture(d.otherwise, new Set(seen), triviaActive) || capturesLeaf(d.otherwise, new Set(seen)) : false);
|
|
13712
|
+
return capturesLeaf(d.selector, new Set(seen)) || d.cases.some((x) => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive, throughNodes) || capturesLeaf(x.parser, new Set(seen))) || (d.matchers ? d.matchers.some((x) => mayLeavePartialCapture(x.parser, new Set(seen), triviaActive, throughNodes) || capturesLeaf(x.parser, new Set(seen))) : false) || (d.otherwise ? mayLeavePartialCapture(d.otherwise, new Set(seen), triviaActive, throughNodes) || capturesLeaf(d.otherwise, new Set(seen)) : false);
|
|
13673
13713
|
case "attempt":
|
|
13674
13714
|
return false;
|
|
13675
13715
|
// optional never fails; many/oneOrMore only "fail" with zero captured items.
|
|
@@ -13711,7 +13751,7 @@ function mayLeavePartialCapture(p, seen = /* @__PURE__ */ new Set(), triviaActiv
|
|
|
13711
13751
|
const part = parts[i];
|
|
13712
13752
|
if (i > 0 && triviaActive) captured = true;
|
|
13713
13753
|
if (captured && mayFail(part)) return true;
|
|
13714
|
-
if (mayLeavePartialCapture(part, seen, triviaActive)) return true;
|
|
13754
|
+
if (mayLeavePartialCapture(part, seen, triviaActive, throughNodes)) return true;
|
|
13715
13755
|
if (capturesLeaf(part) || hasNodeDef(part)) captured = true;
|
|
13716
13756
|
}
|
|
13717
13757
|
return false;
|
|
@@ -13723,12 +13763,12 @@ function mayLeavePartialCapture(p, seen = /* @__PURE__ */ new Set(), triviaActiv
|
|
|
13723
13763
|
case "expect":
|
|
13724
13764
|
case "withCtx":
|
|
13725
13765
|
case "grammar":
|
|
13726
|
-
return mayLeavePartialCapture(d.parser, seen, triviaActive);
|
|
13766
|
+
return mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes);
|
|
13727
13767
|
case "recover":
|
|
13728
|
-
return mayLeavePartialCapture(d.parser, seen, triviaActive);
|
|
13768
|
+
return mayLeavePartialCapture(d.parser, seen, triviaActive, throughNodes);
|
|
13729
13769
|
case "lazy": {
|
|
13730
13770
|
try {
|
|
13731
|
-
return mayLeavePartialCapture(d.thunk(), seen, triviaActive);
|
|
13771
|
+
return mayLeavePartialCapture(d.thunk(), seen, triviaActive, throughNodes);
|
|
13732
13772
|
} catch {
|
|
13733
13773
|
return true;
|
|
13734
13774
|
}
|
|
@@ -14591,6 +14631,32 @@ var Encoder = class {
|
|
|
14591
14631
|
choiceRollbackMasks = /* @__PURE__ */ new Map();
|
|
14592
14632
|
nonCommittingChoiceSites = /* @__PURE__ */ new Set();
|
|
14593
14633
|
failureRollbackCleanSites = /* @__PURE__ */ new Set();
|
|
14634
|
+
/**
|
|
14635
|
+
* THE TRIVIA LOGS A FAILED NODE LEAVES. A node drops its own capture frame when
|
|
14636
|
+
* it fails, but the trivia its body recorded into `_triviaLog`/`_rootTriviaLog`
|
|
14637
|
+
* is not part of that frame. So a child the census above counts as clean can
|
|
14638
|
+
* still leave trivia rows when it reaches a node whose body can fail after a
|
|
14639
|
+
* trivia scan (`mayLeavePartialCapture`'s `throughNodes`). These are the arms
|
|
14640
|
+
* and sites that need only the two logs restored. A program with no trivia of
|
|
14641
|
+
* its own records rows only under trivia its caller supplies, so its emitted
|
|
14642
|
+
* assembly takes these marks only for such a parse (`RunCfg.inheritedTrivia`).
|
|
14643
|
+
*/
|
|
14644
|
+
choiceLogRollbackMasks = /* @__PURE__ */ new Map();
|
|
14645
|
+
failureLogRollbackSites = /* @__PURE__ */ new Set();
|
|
14646
|
+
/**
|
|
14647
|
+
* HOW EACH CHOICE WAS LOWERED, for the census above. A choice on the ordered
|
|
14648
|
+
* path whose arms cannot commit a failure restores the logs after every arm
|
|
14649
|
+
* it enters (its full mark, or its own two-log mark), so it leaves no rows.
|
|
14650
|
+
* An exclusive dispatch runs its one arm with no mark, and an ordered choice
|
|
14651
|
+
* returns a committed arm's failure before restoring, so either leaves what an
|
|
14652
|
+
* arm leaves. A choice in neither set, or in both, is taken to leave rows. Both
|
|
14653
|
+
* sets are complete only once every rule is encoded, so the trivia-log census
|
|
14654
|
+
* runs then (`logCensus`).
|
|
14655
|
+
*/
|
|
14656
|
+
restoringChoices = /* @__PURE__ */ new Set();
|
|
14657
|
+
leakingChoices = /* @__PURE__ */ new Set();
|
|
14658
|
+
logCensus = [];
|
|
14659
|
+
restoresArms = (choice2) => this.restoringChoices.has(choice2) && !this.leakingChoices.has(choice2);
|
|
14594
14660
|
/**
|
|
14595
14661
|
* `reachesSideWriter`'s answers, shared by every `failureNeedsRollback` call
|
|
14596
14662
|
* for the lifetime of this `Encoder`. Every entry is exact — it depends only on
|
|
@@ -15165,11 +15231,19 @@ var Encoder = class {
|
|
|
15165
15231
|
* not run repeat recovery, but these rows can still publish through a caller's
|
|
15166
15232
|
* context.
|
|
15167
15233
|
*/
|
|
15168
|
-
failureNeedsRollback(p, autoNot) {
|
|
15234
|
+
failureNeedsRollback(p, autoNot, throughNodes) {
|
|
15169
15235
|
const refName = p._ruleName;
|
|
15170
15236
|
const winner = refName === void 0 ? void 0 : this.winners?.[refName];
|
|
15171
15237
|
const root = winner !== void 0 && !winnerWrapsReference2(winner, p) ? winner : p;
|
|
15172
|
-
return mayLeavePartialCapture(root, /* @__PURE__ */ new Set(), true) || this.reachesSideWriter(root) || (autoNot?.length ?? 0) > 0 && capturesLeaf(root);
|
|
15238
|
+
return mayLeavePartialCapture(root, /* @__PURE__ */ new Set(), true, throughNodes) || this.reachesSideWriter(root) || (autoNot?.length ?? 0) > 0 && capturesLeaf(root);
|
|
15239
|
+
}
|
|
15240
|
+
/** The rollback census of an `optional()` or `attempt()` row at `ip` over `child`. */
|
|
15241
|
+
censusTransaction(child, ip) {
|
|
15242
|
+
if (this.failureNeedsRollback(child, void 0, false)) return;
|
|
15243
|
+
this.failureRollbackCleanSites.add(ip);
|
|
15244
|
+
this.logCensus.push(() => {
|
|
15245
|
+
if (this.failureNeedsRollback(child, void 0, this.restoresArms)) this.failureLogRollbackSites.add(ip);
|
|
15246
|
+
});
|
|
15173
15247
|
}
|
|
15174
15248
|
/**
|
|
15175
15249
|
* Whether a field, recovered error, interpreted scanner or unresolvable shape
|
|
@@ -15791,13 +15865,11 @@ var Encoder = class {
|
|
|
15791
15865
|
}
|
|
15792
15866
|
const dispIdx = this.disp.length;
|
|
15793
15867
|
this.disp.push(classes);
|
|
15868
|
+
const exclusive = dispatchIsExclusive(classes, this.cc);
|
|
15794
15869
|
let rollbackMask = kids.length > 31 ? -1 : 0;
|
|
15795
15870
|
if (rollbackMask === 0) {
|
|
15796
15871
|
for (let i = 0; i < arms.length; i++) {
|
|
15797
|
-
|
|
15798
|
-
if (this.failureNeedsRollback(arms[i], d.autoNot[src])) {
|
|
15799
|
-
rollbackMask |= 1 << i;
|
|
15800
|
-
}
|
|
15872
|
+
if (this.failureNeedsRollback(arms[i], d.autoNot[order[i]], false)) rollbackMask |= 1 << i;
|
|
15801
15873
|
}
|
|
15802
15874
|
}
|
|
15803
15875
|
const head = this.emitHead(OP_CHOICE, 3 + 2 * kids.length);
|
|
@@ -15809,9 +15881,19 @@ var Encoder = class {
|
|
|
15809
15881
|
this.code[head + 4 + kids.length + i] = this.expected(deriveExpected(arms[i]));
|
|
15810
15882
|
}
|
|
15811
15883
|
this.choiceRollbackMasks.set(head, rollbackMask);
|
|
15812
|
-
if (
|
|
15813
|
-
|
|
15884
|
+
if (rollbackMask !== -1) {
|
|
15885
|
+
const full = rollbackMask;
|
|
15886
|
+
this.logCensus.push(() => {
|
|
15887
|
+
let logMask = 0;
|
|
15888
|
+
for (let i = 0; i < arms.length; i++) {
|
|
15889
|
+
if ((full & 1 << i) === 0 && this.failureNeedsRollback(arms[i], d.autoNot[order[i]], this.restoresArms)) logMask |= 1 << i;
|
|
15890
|
+
}
|
|
15891
|
+
if (logMask !== 0) this.choiceLogRollbackMasks.set(head, logMask);
|
|
15892
|
+
});
|
|
15814
15893
|
}
|
|
15894
|
+
const nonCommitting = arms.every((arm) => !mayCommitFailure(arm, rr, this.commitFailureMemo));
|
|
15895
|
+
if (nonCommitting) this.nonCommittingChoiceSites.add(head);
|
|
15896
|
+
(!exclusive && nonCommitting ? this.restoringChoices : this.leakingChoices).add(p);
|
|
15815
15897
|
return head;
|
|
15816
15898
|
}
|
|
15817
15899
|
case "many":
|
|
@@ -15847,7 +15929,7 @@ var Encoder = class {
|
|
|
15847
15929
|
}
|
|
15848
15930
|
case "optional": {
|
|
15849
15931
|
const head = this.emit(OP_OPT, this.lookaheadGate(d.parser, this.node(d.parser).ip));
|
|
15850
|
-
|
|
15932
|
+
this.censusTransaction(d.parser, head);
|
|
15851
15933
|
return head;
|
|
15852
15934
|
}
|
|
15853
15935
|
case "transform": {
|
|
@@ -16018,7 +16100,7 @@ var Encoder = class {
|
|
|
16018
16100
|
// lowering was correct only for a choice arm.
|
|
16019
16101
|
case "attempt": {
|
|
16020
16102
|
const inner = this.emit(OP_ATTEMPT, this.node(d.parser).ip, d.contain === true ? 1 : 0);
|
|
16021
|
-
|
|
16103
|
+
this.censusTransaction(d.parser, inner);
|
|
16022
16104
|
const fs = this.gateFirstSet(d.parser, d.guarded === true, false);
|
|
16023
16105
|
if (fs.kind === "any" || matchesEmpty(d.parser, /* @__PURE__ */ new Set(), this.refResolver())) return inner;
|
|
16024
16106
|
const cls = this.charClass(fs);
|
|
@@ -16182,6 +16264,7 @@ var Encoder = class {
|
|
|
16182
16264
|
finish() {
|
|
16183
16265
|
if (this.code.length === 0) this.emit(OP_EMPTY);
|
|
16184
16266
|
this.collapseIndirection();
|
|
16267
|
+
for (const census of this.logCensus) census();
|
|
16185
16268
|
return ownTableProgram({
|
|
16186
16269
|
code: this.code,
|
|
16187
16270
|
k: this.k,
|
|
@@ -16206,6 +16289,8 @@ var Encoder = class {
|
|
|
16206
16289
|
}, void 0, {
|
|
16207
16290
|
choiceRollbackMasks: this.choiceRollbackMasks,
|
|
16208
16291
|
failureRollbackCleanSites: this.failureRollbackCleanSites,
|
|
16292
|
+
choiceLogRollbackMasks: this.choiceLogRollbackMasks,
|
|
16293
|
+
failureLogRollbackSites: this.failureLogRollbackSites,
|
|
16209
16294
|
nonCommittingChoiceSites: this.nonCommittingChoiceSites
|
|
16210
16295
|
});
|
|
16211
16296
|
}
|