parseman 0.55.0 → 0.55.1
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/diagnostics.js +85 -60
- package/dist/analysis/diagnostics.js.map +1 -1
- package/dist/cli/index.js +85 -60
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +86 -61
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.js +86 -61
- package/dist/plugin/index.js.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/index.js +85 -60
- package/dist/table/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/table/encode.ts +89 -65
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/table/encode.ts"],"names":[],"mappings":"AAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;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":"AAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CACxC,CAAA;AA2wDD,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/index.js
CHANGED
|
@@ -12421,19 +12421,11 @@ var Encoder = class {
|
|
|
12421
12421
|
nonCommittingChoiceSites = /* @__PURE__ */ new Set();
|
|
12422
12422
|
failureRollbackCleanSites = /* @__PURE__ */ new Set();
|
|
12423
12423
|
/**
|
|
12424
|
-
* `
|
|
12425
|
-
* for the lifetime of this `Encoder`.
|
|
12426
|
-
*
|
|
12427
|
-
*
|
|
12428
|
-
*
|
|
12429
|
-
* (as a local inside `failureNeedsRollback`) was correct but discarded that
|
|
12430
|
-
* fact after every arm, so a grammar with many ordered-choice arms / optional
|
|
12431
|
-
* / attempt sites re-walked the SAME shared rule graph from scratch for each
|
|
12432
|
-
* site — O(sites × graph size) instead of O(graph size). Measured on the
|
|
12433
|
-
* scss-parser grammar (composed CSS-base superset, the deepest/largest of the
|
|
12434
|
-
* four grammars): 47-50s for one `compileRuleMap` with the per-call memo,
|
|
12435
|
-
* versus the whole macro transform completing in under a second once this
|
|
12436
|
-
* memo is hoisted here.
|
|
12424
|
+
* `reachesSideWriter`'s answers, shared by every `failureNeedsRollback` call
|
|
12425
|
+
* for the lifetime of this `Encoder`. Every entry is exact — it depends only on
|
|
12426
|
+
* the node's own reachable subgraph, never on which root's walk asked — so each
|
|
12427
|
+
* combinator is walked once per encode however many choice arms, optionals and
|
|
12428
|
+
* attempt sites reach it.
|
|
12437
12429
|
*/
|
|
12438
12430
|
sideWriterMemo = /* @__PURE__ */ new Map();
|
|
12439
12431
|
labels = void 0;
|
|
@@ -12866,63 +12858,96 @@ var Encoder = class {
|
|
|
12866
12858
|
* writer census covers the side sinks that proof deliberately does not model:
|
|
12867
12859
|
* fields, recovered errors, and interpreted scanners. Strict assemblies do
|
|
12868
12860
|
* not run repeat recovery, but these rows can still publish through a caller's
|
|
12869
|
-
* context.
|
|
12870
|
-
* discover a writer the first traversal did not already reach.
|
|
12861
|
+
* context.
|
|
12871
12862
|
*/
|
|
12872
12863
|
failureNeedsRollback(p, autoNot) {
|
|
12873
12864
|
const refName = p._ruleName;
|
|
12874
12865
|
const winner = refName === void 0 ? void 0 : this.winners?.[refName];
|
|
12875
12866
|
const root = winner !== void 0 && !winnerWrapsReference2(winner, p) ? winner : p;
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12895
|
-
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12867
|
+
return mayLeavePartialCapture(root, /* @__PURE__ */ new Set(), true) || this.reachesSideWriter(root) || (autoNot?.length ?? 0) > 0 && capturesLeaf(root);
|
|
12868
|
+
}
|
|
12869
|
+
/**
|
|
12870
|
+
* Whether a field, recovered error, interpreted scanner or unresolvable shape
|
|
12871
|
+
* is reachable from `root` — the writer census of `failureNeedsRollback`.
|
|
12872
|
+
*
|
|
12873
|
+
* Reachability over a cyclic graph, decided with Tarjan's strongly connected
|
|
12874
|
+
* components so that every node the walk enters leaves with its exact answer
|
|
12875
|
+
* memoized: the members of one component reach each other, so they share one
|
|
12876
|
+
* answer, settled when the walk returns to the component's first node. A DFS
|
|
12877
|
+
* that instead cuts a cycle at its own ancestor path learns nothing it can
|
|
12878
|
+
* keep about a node whose walk hit the cut, and re-walks that node along
|
|
12879
|
+
* every path that reaches it — exponential over recursive value rules (linking
|
|
12880
|
+
* jess's SCSS grammar cost ~290G instructions). This walk enters each node
|
|
12881
|
+
* once per `Encoder`.
|
|
12882
|
+
*/
|
|
12883
|
+
reachesSideWriter(root) {
|
|
12884
|
+
const memo = this.sideWriterMemo;
|
|
12885
|
+
const known = memo.get(root);
|
|
12886
|
+
if (known !== void 0) return known;
|
|
12887
|
+
const order = /* @__PURE__ */ new Map();
|
|
12888
|
+
const low = [];
|
|
12889
|
+
const found = [];
|
|
12890
|
+
const stack = [];
|
|
12891
|
+
const visit = (node) => {
|
|
12892
|
+
const at = low.length;
|
|
12893
|
+
order.set(node, at);
|
|
12894
|
+
low.push(at);
|
|
12895
|
+
found.push(false);
|
|
12896
|
+
stack.push(node);
|
|
12897
|
+
const next = this.sideWriterSuccessors(node);
|
|
12898
|
+
if (next === true) found[at] = true;
|
|
12899
|
+
else {
|
|
12900
|
+
for (const child of next) {
|
|
12901
|
+
const hit = memo.get(child);
|
|
12902
|
+
if (hit !== void 0) {
|
|
12903
|
+
if (hit) found[at] = true;
|
|
12904
|
+
continue;
|
|
12904
12905
|
}
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
result = { found: false, complete: true };
|
|
12910
|
-
for (const child of childrenOf(def)) {
|
|
12911
|
-
const childResult = hasSideWriter(child);
|
|
12912
|
-
if (childResult.found) {
|
|
12913
|
-
result = { found: true, complete: true };
|
|
12914
|
-
break;
|
|
12915
|
-
}
|
|
12916
|
-
complete &&= childResult.complete;
|
|
12906
|
+
const seen = order.get(child);
|
|
12907
|
+
if (seen !== void 0) {
|
|
12908
|
+
if (seen < low[at]) low[at] = seen;
|
|
12909
|
+
continue;
|
|
12917
12910
|
}
|
|
12918
|
-
|
|
12911
|
+
const k = visit(child);
|
|
12912
|
+
if (low[k] < low[at]) low[at] = low[k];
|
|
12913
|
+
if (found[k]) found[at] = true;
|
|
12919
12914
|
}
|
|
12920
12915
|
}
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12916
|
+
if (low[at] === at) {
|
|
12917
|
+
const answer = found[at];
|
|
12918
|
+
let member;
|
|
12919
|
+
do {
|
|
12920
|
+
member = stack.pop();
|
|
12921
|
+
memo.set(member, answer);
|
|
12922
|
+
} while (member !== node);
|
|
12923
|
+
}
|
|
12924
|
+
return at;
|
|
12924
12925
|
};
|
|
12925
|
-
return
|
|
12926
|
+
return found[visit(root)];
|
|
12927
|
+
}
|
|
12928
|
+
/** The census's edges out of `node`, or `true` when `node` is itself a writer. */
|
|
12929
|
+
sideWriterSuccessors(node) {
|
|
12930
|
+
const def = node._def;
|
|
12931
|
+
switch (def.tag) {
|
|
12932
|
+
case "field":
|
|
12933
|
+
case "expect":
|
|
12934
|
+
case "recover":
|
|
12935
|
+
case "scanTo":
|
|
12936
|
+
case "unknown":
|
|
12937
|
+
return true;
|
|
12938
|
+
case "lazy": {
|
|
12939
|
+
const name = node._ruleName;
|
|
12940
|
+
const winner = name === void 0 ? void 0 : this.winners?.[name];
|
|
12941
|
+
if (winner !== void 0 && !winnerWrapsReference2(winner, node)) return [winner];
|
|
12942
|
+
try {
|
|
12943
|
+
return [def.thunk()];
|
|
12944
|
+
} catch {
|
|
12945
|
+
return true;
|
|
12946
|
+
}
|
|
12947
|
+
}
|
|
12948
|
+
default:
|
|
12949
|
+
return childrenOf(def);
|
|
12950
|
+
}
|
|
12926
12951
|
}
|
|
12927
12952
|
/** A first set becomes a char class string, or −1 for `any`. */
|
|
12928
12953
|
charClass(fs) {
|