parseman 0.50.0 → 0.50.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 +24 -7
- package/dist/analysis/diagnostics.js.map +1 -1
- package/dist/cli/index.js +24 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.js +25 -8
- package/dist/plugin/index.js.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/index.js +24 -7
- 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 +30 -10
- package/src/version.ts +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -7078,6 +7078,22 @@ var Encoder = class {
|
|
|
7078
7078
|
choiceRollbackMasks = /* @__PURE__ */ new Map();
|
|
7079
7079
|
nonCommittingChoiceSites = /* @__PURE__ */ new Set();
|
|
7080
7080
|
failureRollbackCleanSites = /* @__PURE__ */ new Set();
|
|
7081
|
+
/**
|
|
7082
|
+
* `hasSideWriter` memo for `failureNeedsRollback`, shared across every call
|
|
7083
|
+
* for the lifetime of this `Encoder`. A cached entry is written only when
|
|
7084
|
+
* `complete` is true, which means the answer is a path-independent fact
|
|
7085
|
+
* about that combinator node — it does not depend on which root's traversal
|
|
7086
|
+
* asked, only on the node's own reachable subgraph. Scoping the memo per call
|
|
7087
|
+
* (as a local inside `failureNeedsRollback`) was correct but discarded that
|
|
7088
|
+
* fact after every arm, so a grammar with many ordered-choice arms / optional
|
|
7089
|
+
* / attempt sites re-walked the SAME shared rule graph from scratch for each
|
|
7090
|
+
* site — O(sites × graph size) instead of O(graph size). Measured on the
|
|
7091
|
+
* scss-parser grammar (composed CSS-base superset, the deepest/largest of the
|
|
7092
|
+
* four grammars): 47-50s for one `compileRuleMap` with the per-call memo,
|
|
7093
|
+
* versus the whole macro transform completing in under a second once this
|
|
7094
|
+
* memo is hoisted here.
|
|
7095
|
+
*/
|
|
7096
|
+
sideWriterMemo = /* @__PURE__ */ new Map();
|
|
7081
7097
|
labels = void 0;
|
|
7082
7098
|
/** Trivia table in scope at the row being encoded — codegen's `ctx.activeTrivia`. */
|
|
7083
7099
|
activeTrivia = void 0;
|
|
@@ -7503,13 +7519,13 @@ var Encoder = class {
|
|
|
7503
7519
|
const refName = p._ruleName;
|
|
7504
7520
|
const winner = refName === void 0 ? void 0 : this.winners?.[refName];
|
|
7505
7521
|
const root = winner !== void 0 && !winnerWrapsReference2(winner, p) ? winner : p;
|
|
7506
|
-
const sideWriterMemo =
|
|
7507
|
-
const
|
|
7522
|
+
const sideWriterMemo = this.sideWriterMemo;
|
|
7523
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7524
|
+
const hasSideWriter = (current) => {
|
|
7508
7525
|
const cached = sideWriterMemo.get(current);
|
|
7509
7526
|
if (cached !== void 0) return { found: cached, complete: true };
|
|
7510
7527
|
if (seen.has(current)) return { found: false, complete: false };
|
|
7511
|
-
|
|
7512
|
-
next.add(current);
|
|
7528
|
+
seen.add(current);
|
|
7513
7529
|
const def = current._def;
|
|
7514
7530
|
let result;
|
|
7515
7531
|
switch (def.tag) {
|
|
@@ -7524,11 +7540,11 @@ var Encoder = class {
|
|
|
7524
7540
|
const name = current._ruleName;
|
|
7525
7541
|
const resolvedWinner = name === void 0 ? void 0 : this.winners?.[name];
|
|
7526
7542
|
if (resolvedWinner !== void 0 && !winnerWrapsReference2(resolvedWinner, current)) {
|
|
7527
|
-
result = hasSideWriter(resolvedWinner
|
|
7543
|
+
result = hasSideWriter(resolvedWinner);
|
|
7528
7544
|
break;
|
|
7529
7545
|
}
|
|
7530
7546
|
try {
|
|
7531
|
-
result = hasSideWriter(def.thunk()
|
|
7547
|
+
result = hasSideWriter(def.thunk());
|
|
7532
7548
|
} catch {
|
|
7533
7549
|
result = { found: true, complete: true };
|
|
7534
7550
|
}
|
|
@@ -7538,7 +7554,7 @@ var Encoder = class {
|
|
|
7538
7554
|
let complete = true;
|
|
7539
7555
|
result = { found: false, complete: true };
|
|
7540
7556
|
for (const child of childrenOf(def)) {
|
|
7541
|
-
const childResult = hasSideWriter(child
|
|
7557
|
+
const childResult = hasSideWriter(child);
|
|
7542
7558
|
if (childResult.found) {
|
|
7543
7559
|
result = { found: true, complete: true };
|
|
7544
7560
|
break;
|
|
@@ -7548,6 +7564,7 @@ var Encoder = class {
|
|
|
7548
7564
|
if (!result.found) result = { found: false, complete };
|
|
7549
7565
|
}
|
|
7550
7566
|
}
|
|
7567
|
+
seen.delete(current);
|
|
7551
7568
|
if (result.found || result.complete) sideWriterMemo.set(current, result.found);
|
|
7552
7569
|
return result;
|
|
7553
7570
|
};
|