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
package/dist/plugin/index.js
CHANGED
|
@@ -6858,19 +6858,11 @@ var Encoder = class {
|
|
|
6858
6858
|
nonCommittingChoiceSites = /* @__PURE__ */ new Set();
|
|
6859
6859
|
failureRollbackCleanSites = /* @__PURE__ */ new Set();
|
|
6860
6860
|
/**
|
|
6861
|
-
* `
|
|
6862
|
-
* for the lifetime of this `Encoder`.
|
|
6863
|
-
*
|
|
6864
|
-
*
|
|
6865
|
-
*
|
|
6866
|
-
* (as a local inside `failureNeedsRollback`) was correct but discarded that
|
|
6867
|
-
* fact after every arm, so a grammar with many ordered-choice arms / optional
|
|
6868
|
-
* / attempt sites re-walked the SAME shared rule graph from scratch for each
|
|
6869
|
-
* site — O(sites × graph size) instead of O(graph size). Measured on the
|
|
6870
|
-
* scss-parser grammar (composed CSS-base superset, the deepest/largest of the
|
|
6871
|
-
* four grammars): 47-50s for one `compileRuleMap` with the per-call memo,
|
|
6872
|
-
* versus the whole macro transform completing in under a second once this
|
|
6873
|
-
* memo is hoisted here.
|
|
6861
|
+
* `reachesSideWriter`'s answers, shared by every `failureNeedsRollback` call
|
|
6862
|
+
* for the lifetime of this `Encoder`. Every entry is exact — it depends only on
|
|
6863
|
+
* the node's own reachable subgraph, never on which root's walk asked — so each
|
|
6864
|
+
* combinator is walked once per encode however many choice arms, optionals and
|
|
6865
|
+
* attempt sites reach it.
|
|
6874
6866
|
*/
|
|
6875
6867
|
sideWriterMemo = /* @__PURE__ */ new Map();
|
|
6876
6868
|
labels = void 0;
|
|
@@ -7303,63 +7295,96 @@ var Encoder = class {
|
|
|
7303
7295
|
* writer census covers the side sinks that proof deliberately does not model:
|
|
7304
7296
|
* fields, recovered errors, and interpreted scanners. Strict assemblies do
|
|
7305
7297
|
* not run repeat recovery, but these rows can still publish through a caller's
|
|
7306
|
-
* context.
|
|
7307
|
-
* discover a writer the first traversal did not already reach.
|
|
7298
|
+
* context.
|
|
7308
7299
|
*/
|
|
7309
7300
|
failureNeedsRollback(p, autoNot) {
|
|
7310
7301
|
const refName = p._ruleName;
|
|
7311
7302
|
const winner = refName === void 0 ? void 0 : this.winners?.[refName];
|
|
7312
7303
|
const root = winner !== void 0 && !winnerWrapsReference2(winner, p) ? winner : p;
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7304
|
+
return mayLeavePartialCapture(root, /* @__PURE__ */ new Set(), true) || this.reachesSideWriter(root) || (autoNot?.length ?? 0) > 0 && capturesLeaf(root);
|
|
7305
|
+
}
|
|
7306
|
+
/**
|
|
7307
|
+
* Whether a field, recovered error, interpreted scanner or unresolvable shape
|
|
7308
|
+
* is reachable from `root` — the writer census of `failureNeedsRollback`.
|
|
7309
|
+
*
|
|
7310
|
+
* Reachability over a cyclic graph, decided with Tarjan's strongly connected
|
|
7311
|
+
* components so that every node the walk enters leaves with its exact answer
|
|
7312
|
+
* memoized: the members of one component reach each other, so they share one
|
|
7313
|
+
* answer, settled when the walk returns to the component's first node. A DFS
|
|
7314
|
+
* that instead cuts a cycle at its own ancestor path learns nothing it can
|
|
7315
|
+
* keep about a node whose walk hit the cut, and re-walks that node along
|
|
7316
|
+
* every path that reaches it — exponential over recursive value rules (linking
|
|
7317
|
+
* jess's SCSS grammar cost ~290G instructions). This walk enters each node
|
|
7318
|
+
* once per `Encoder`.
|
|
7319
|
+
*/
|
|
7320
|
+
reachesSideWriter(root) {
|
|
7321
|
+
const memo = this.sideWriterMemo;
|
|
7322
|
+
const known = memo.get(root);
|
|
7323
|
+
if (known !== void 0) return known;
|
|
7324
|
+
const order = /* @__PURE__ */ new Map();
|
|
7325
|
+
const low = [];
|
|
7326
|
+
const found = [];
|
|
7327
|
+
const stack = [];
|
|
7328
|
+
const visit = (node2) => {
|
|
7329
|
+
const at = low.length;
|
|
7330
|
+
order.set(node2, at);
|
|
7331
|
+
low.push(at);
|
|
7332
|
+
found.push(false);
|
|
7333
|
+
stack.push(node2);
|
|
7334
|
+
const next = this.sideWriterSuccessors(node2);
|
|
7335
|
+
if (next === true) found[at] = true;
|
|
7336
|
+
else {
|
|
7337
|
+
for (const child of next) {
|
|
7338
|
+
const hit = memo.get(child);
|
|
7339
|
+
if (hit !== void 0) {
|
|
7340
|
+
if (hit) found[at] = true;
|
|
7341
|
+
continue;
|
|
7341
7342
|
}
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
result = { found: false, complete: true };
|
|
7347
|
-
for (const child of childrenOf2(def)) {
|
|
7348
|
-
const childResult = hasSideWriter(child);
|
|
7349
|
-
if (childResult.found) {
|
|
7350
|
-
result = { found: true, complete: true };
|
|
7351
|
-
break;
|
|
7352
|
-
}
|
|
7353
|
-
complete &&= childResult.complete;
|
|
7343
|
+
const seen = order.get(child);
|
|
7344
|
+
if (seen !== void 0) {
|
|
7345
|
+
if (seen < low[at]) low[at] = seen;
|
|
7346
|
+
continue;
|
|
7354
7347
|
}
|
|
7355
|
-
|
|
7348
|
+
const k = visit(child);
|
|
7349
|
+
if (low[k] < low[at]) low[at] = low[k];
|
|
7350
|
+
if (found[k]) found[at] = true;
|
|
7356
7351
|
}
|
|
7357
7352
|
}
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7353
|
+
if (low[at] === at) {
|
|
7354
|
+
const answer = found[at];
|
|
7355
|
+
let member;
|
|
7356
|
+
do {
|
|
7357
|
+
member = stack.pop();
|
|
7358
|
+
memo.set(member, answer);
|
|
7359
|
+
} while (member !== node2);
|
|
7360
|
+
}
|
|
7361
|
+
return at;
|
|
7361
7362
|
};
|
|
7362
|
-
return
|
|
7363
|
+
return found[visit(root)];
|
|
7364
|
+
}
|
|
7365
|
+
/** The census's edges out of `node`, or `true` when `node` is itself a writer. */
|
|
7366
|
+
sideWriterSuccessors(node2) {
|
|
7367
|
+
const def = node2._def;
|
|
7368
|
+
switch (def.tag) {
|
|
7369
|
+
case "field":
|
|
7370
|
+
case "expect":
|
|
7371
|
+
case "recover":
|
|
7372
|
+
case "scanTo":
|
|
7373
|
+
case "unknown":
|
|
7374
|
+
return true;
|
|
7375
|
+
case "lazy": {
|
|
7376
|
+
const name = node2._ruleName;
|
|
7377
|
+
const winner = name === void 0 ? void 0 : this.winners?.[name];
|
|
7378
|
+
if (winner !== void 0 && !winnerWrapsReference2(winner, node2)) return [winner];
|
|
7379
|
+
try {
|
|
7380
|
+
return [def.thunk()];
|
|
7381
|
+
} catch {
|
|
7382
|
+
return true;
|
|
7383
|
+
}
|
|
7384
|
+
}
|
|
7385
|
+
default:
|
|
7386
|
+
return childrenOf2(def);
|
|
7387
|
+
}
|
|
7363
7388
|
}
|
|
7364
7389
|
/** A first set becomes a char class string, or −1 for `any`. */
|
|
7365
7390
|
charClass(fs3) {
|
|
@@ -17327,7 +17352,7 @@ function fieldOptionsSrc(def) {
|
|
|
17327
17352
|
}
|
|
17328
17353
|
|
|
17329
17354
|
// src/version.ts
|
|
17330
|
-
var PARSEMAN_VERSION = "0.55.
|
|
17355
|
+
var PARSEMAN_VERSION = "0.55.1";
|
|
17331
17356
|
|
|
17332
17357
|
// src/compiler/compile-linkable-table.ts
|
|
17333
17358
|
function isLocal(rule) {
|