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/index.js
CHANGED
|
@@ -6938,6 +6938,22 @@ var Encoder = class {
|
|
|
6938
6938
|
choiceRollbackMasks = /* @__PURE__ */ new Map();
|
|
6939
6939
|
nonCommittingChoiceSites = /* @__PURE__ */ new Set();
|
|
6940
6940
|
failureRollbackCleanSites = /* @__PURE__ */ new Set();
|
|
6941
|
+
/**
|
|
6942
|
+
* `hasSideWriter` memo for `failureNeedsRollback`, shared across every call
|
|
6943
|
+
* for the lifetime of this `Encoder`. A cached entry is written only when
|
|
6944
|
+
* `complete` is true, which means the answer is a path-independent fact
|
|
6945
|
+
* about that combinator node — it does not depend on which root's traversal
|
|
6946
|
+
* asked, only on the node's own reachable subgraph. Scoping the memo per call
|
|
6947
|
+
* (as a local inside `failureNeedsRollback`) was correct but discarded that
|
|
6948
|
+
* fact after every arm, so a grammar with many ordered-choice arms / optional
|
|
6949
|
+
* / attempt sites re-walked the SAME shared rule graph from scratch for each
|
|
6950
|
+
* site — O(sites × graph size) instead of O(graph size). Measured on the
|
|
6951
|
+
* scss-parser grammar (composed CSS-base superset, the deepest/largest of the
|
|
6952
|
+
* four grammars): 47-50s for one `compileRuleMap` with the per-call memo,
|
|
6953
|
+
* versus the whole macro transform completing in under a second once this
|
|
6954
|
+
* memo is hoisted here.
|
|
6955
|
+
*/
|
|
6956
|
+
sideWriterMemo = /* @__PURE__ */ new Map();
|
|
6941
6957
|
labels = void 0;
|
|
6942
6958
|
/** Trivia table in scope at the row being encoded — codegen's `ctx.activeTrivia`. */
|
|
6943
6959
|
activeTrivia = void 0;
|
|
@@ -7363,13 +7379,13 @@ var Encoder = class {
|
|
|
7363
7379
|
const refName = p._ruleName;
|
|
7364
7380
|
const winner = refName === void 0 ? void 0 : this.winners?.[refName];
|
|
7365
7381
|
const root = winner !== void 0 && !winnerWrapsReference2(winner, p) ? winner : p;
|
|
7366
|
-
const sideWriterMemo =
|
|
7367
|
-
const
|
|
7382
|
+
const sideWriterMemo = this.sideWriterMemo;
|
|
7383
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7384
|
+
const hasSideWriter = (current) => {
|
|
7368
7385
|
const cached = sideWriterMemo.get(current);
|
|
7369
7386
|
if (cached !== void 0) return { found: cached, complete: true };
|
|
7370
7387
|
if (seen.has(current)) return { found: false, complete: false };
|
|
7371
|
-
|
|
7372
|
-
next.add(current);
|
|
7388
|
+
seen.add(current);
|
|
7373
7389
|
const def = current._def;
|
|
7374
7390
|
let result;
|
|
7375
7391
|
switch (def.tag) {
|
|
@@ -7384,11 +7400,11 @@ var Encoder = class {
|
|
|
7384
7400
|
const name = current._ruleName;
|
|
7385
7401
|
const resolvedWinner = name === void 0 ? void 0 : this.winners?.[name];
|
|
7386
7402
|
if (resolvedWinner !== void 0 && !winnerWrapsReference2(resolvedWinner, current)) {
|
|
7387
|
-
result = hasSideWriter(resolvedWinner
|
|
7403
|
+
result = hasSideWriter(resolvedWinner);
|
|
7388
7404
|
break;
|
|
7389
7405
|
}
|
|
7390
7406
|
try {
|
|
7391
|
-
result = hasSideWriter(def.thunk()
|
|
7407
|
+
result = hasSideWriter(def.thunk());
|
|
7392
7408
|
} catch {
|
|
7393
7409
|
result = { found: true, complete: true };
|
|
7394
7410
|
}
|
|
@@ -7398,7 +7414,7 @@ var Encoder = class {
|
|
|
7398
7414
|
let complete = true;
|
|
7399
7415
|
result = { found: false, complete: true };
|
|
7400
7416
|
for (const child of childrenOf2(def)) {
|
|
7401
|
-
const childResult = hasSideWriter(child
|
|
7417
|
+
const childResult = hasSideWriter(child);
|
|
7402
7418
|
if (childResult.found) {
|
|
7403
7419
|
result = { found: true, complete: true };
|
|
7404
7420
|
break;
|
|
@@ -7408,6 +7424,7 @@ var Encoder = class {
|
|
|
7408
7424
|
if (!result.found) result = { found: false, complete };
|
|
7409
7425
|
}
|
|
7410
7426
|
}
|
|
7427
|
+
seen.delete(current);
|
|
7411
7428
|
if (result.found || result.complete) sideWriterMemo.set(current, result.found);
|
|
7412
7429
|
return result;
|
|
7413
7430
|
};
|
|
@@ -17089,7 +17106,7 @@ function compileRuleMap(ruleMap, opts = {}) {
|
|
|
17089
17106
|
}
|
|
17090
17107
|
|
|
17091
17108
|
// src/version.ts
|
|
17092
|
-
var PARSEMAN_VERSION = "0.50.
|
|
17109
|
+
var PARSEMAN_VERSION = "0.50.1";
|
|
17093
17110
|
|
|
17094
17111
|
// src/compiler/compile-linkable-table.ts
|
|
17095
17112
|
function isLocal(rule) {
|