parseman 0.44.0 → 0.46.0
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/choice-cost-gate.d.ts +158 -0
- package/dist/analysis/choice-cost-gate.d.ts.map +1 -0
- package/dist/analysis/choice-cost-render.d.ts +88 -0
- package/dist/analysis/choice-cost-render.d.ts.map +1 -0
- package/dist/analysis/choice-cost.d.ts +383 -0
- package/dist/analysis/choice-cost.d.ts.map +1 -0
- package/dist/analysis/corpus.d.ts +73 -0
- package/dist/analysis/corpus.d.ts.map +1 -0
- package/dist/analysis/diagnose-render.d.ts +65 -0
- package/dist/analysis/diagnose-render.d.ts.map +1 -0
- package/dist/analysis/diagnose.d.ts +133 -0
- package/dist/analysis/diagnose.d.ts.map +1 -0
- package/dist/analysis/diagnostics.cjs +11272 -0
- package/dist/analysis/diagnostics.cjs.map +7 -0
- package/dist/analysis/diagnostics.d.ts +27 -0
- package/dist/analysis/diagnostics.d.ts.map +1 -0
- package/dist/analysis/diagnostics.js +11249 -0
- package/dist/analysis/diagnostics.js.map +7 -0
- package/dist/analysis/fix-render.d.ts +43 -0
- package/dist/analysis/fix-render.d.ts.map +1 -0
- package/dist/analysis/fix.d.ts +172 -0
- package/dist/analysis/fix.d.ts.map +1 -0
- package/dist/analysis/gating.d.ts +17 -9
- package/dist/analysis/gating.d.ts.map +1 -1
- package/dist/analysis/grammar.d.ts.map +1 -1
- package/dist/analysis/rebuild.d.ts +61 -0
- package/dist/analysis/rebuild.d.ts.map +1 -0
- package/dist/analysis/terminal.d.ts +142 -0
- package/dist/analysis/terminal.d.ts.map +1 -0
- package/dist/cli/index.cjs +12507 -0
- package/dist/cli/index.cjs.map +7 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +12484 -0
- package/dist/cli/index.js.map +7 -0
- package/dist/combinators/choice.d.ts.map +1 -1
- package/dist/combinators/dispatch.d.ts +19 -1
- package/dist/combinators/dispatch.d.ts.map +1 -1
- package/dist/combinators/expect.d.ts.map +1 -1
- package/dist/combinators/first-set.d.ts.map +1 -1
- package/dist/combinators/node.d.ts +19 -0
- package/dist/combinators/node.d.ts.map +1 -1
- package/dist/compiler/build-arity.d.ts +28 -0
- package/dist/compiler/build-arity.d.ts.map +1 -1
- package/dist/compiler/codegen.d.ts +80 -60
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/compiler/degradation.d.ts +123 -0
- package/dist/compiler/degradation.d.ts.map +1 -0
- package/dist/compiler/fields.d.ts.map +1 -1
- package/dist/compiler/grammar-coverage-ids.d.ts.map +1 -1
- package/dist/compiler/inline-build.d.ts.map +1 -1
- package/dist/compiler/ir-serialize.d.ts.map +1 -1
- package/dist/compiler/linker.d.ts +45 -7
- package/dist/compiler/linker.d.ts.map +1 -1
- package/dist/compiler/module-hoist.d.ts +106 -0
- package/dist/compiler/module-hoist.d.ts.map +1 -0
- package/dist/coverage.d.ts +13 -0
- package/dist/coverage.d.ts.map +1 -1
- package/dist/cst/reflection.d.ts.map +1 -1
- package/dist/functional/run.d.ts.map +1 -1
- package/dist/index.cjs +1846 -610
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +11 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1846 -610
- package/dist/index.js.map +4 -4
- package/dist/language-service/index.cjs +40 -30
- package/dist/language-service/index.cjs.map +3 -3
- package/dist/language-service/index.js +40 -30
- package/dist/language-service/index.js.map +3 -3
- package/dist/oracle/digest.d.ts +132 -6
- package/dist/oracle/digest.d.ts.map +1 -1
- package/dist/oracle/index.cjs +136 -305
- package/dist/oracle/index.cjs.map +4 -4
- package/dist/oracle/index.d.ts +43 -31
- package/dist/oracle/index.d.ts.map +1 -1
- package/dist/oracle/index.js +136 -305
- package/dist/oracle/index.js.map +4 -4
- package/dist/plugin/evaluator.d.ts +3 -0
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/free-identifiers.d.ts +23 -0
- package/dist/plugin/free-identifiers.d.ts.map +1 -0
- package/dist/plugin/index.cjs +1529 -763
- package/dist/plugin/index.cjs.map +4 -4
- package/dist/plugin/index.d.ts +18 -0
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +1529 -763
- package/dist/plugin/index.js.map +4 -4
- package/dist/plugin/reducer-resolver.d.ts +57 -0
- package/dist/plugin/reducer-resolver.d.ts.map +1 -0
- package/dist/run/index.cjs +33 -30
- package/dist/run/index.cjs.map +2 -2
- package/dist/run/index.js +33 -30
- package/dist/run/index.js.map +2 -2
- package/dist/spec/index.cjs +222 -34
- package/dist/spec/index.cjs.map +4 -4
- package/dist/spec/index.js +222 -34
- package/dist/spec/index.js.map +4 -4
- package/dist/spec/model.d.ts.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +23 -4
- package/dist/combinators/guard.d.ts +0 -8
- package/dist/combinators/guard.d.ts.map +0 -1
- package/dist/cst/offset-model.d.ts +0 -119
- package/dist/cst/offset-model.d.ts.map +0 -1
- package/dist/oracle/corpus.d.ts +0 -32
- package/dist/oracle/corpus.d.ts.map +0 -1
- package/dist/oracle/identity.d.ts +0 -117
- package/dist/oracle/identity.d.ts.map +0 -1
|
@@ -351,6 +351,35 @@ function assertHostModeCompatible(mode, build, hostBranchElided = true) {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
// src/functional/run.ts
|
|
354
|
+
var SELECT_EXAMPLE = "run(entry, input, { rootTrivia: { select: ['blockComment', 'lineComment'] } })";
|
|
355
|
+
var REMOVED_RUN_RESULT_FIELDS = [
|
|
356
|
+
[
|
|
357
|
+
"triviaMap",
|
|
358
|
+
`It was a dense root-trivia index built on every parse; root trivia is now an OPT-IN sparse capture, because most grammars paid for an index they never read. Migration: name the trivia labels your grammar defines \u2014 ${SELECT_EXAMPLE} \u2014 and read \`RunResult.rootTrivia\`, whose \`.index\` carries the labels and gap lookups \`triviaMap\` exposed.`
|
|
359
|
+
],
|
|
360
|
+
[
|
|
361
|
+
"triviaLog",
|
|
362
|
+
`It was the flat \`start, end[, kindIndex]\` log every other trivia view was derived from, and it is no longer allocated at all \u2014 not empty, absent. Migration: request the labels you need \u2014 ${SELECT_EXAMPLE} \u2014 and read \`RunResult.rootTrivia.rows\`. Do NOT reuse a stride-2/3 reader: rows are a different width and a different unit (one row per SELECTED marker, not one per trivia chunk), so an old loop reads confidently wrong offsets rather than failing.`
|
|
363
|
+
],
|
|
364
|
+
[
|
|
365
|
+
"triviaKindLabels",
|
|
366
|
+
`It was already optional, so nothing ever flagged its disappearance \u2014 and \`triviaKindMask(undefined, \u2026)\` means "capture everything", so reading it now silently WIDENS capture instead of erroring. Migration: request labels \u2014 ${SELECT_EXAMPLE} \u2014 then the set you asked for is \`RunResult.rootTrivia.select\` and the resolved table is \`RunResult.rootTrivia.index.labels\`.`
|
|
367
|
+
]
|
|
368
|
+
];
|
|
369
|
+
function guardRemovedFields(result) {
|
|
370
|
+
for (const [name, detail] of REMOVED_RUN_RESULT_FIELDS) {
|
|
371
|
+
Object.defineProperty(result, name, {
|
|
372
|
+
configurable: true,
|
|
373
|
+
enumerable: false,
|
|
374
|
+
get() {
|
|
375
|
+
throw new TypeError(
|
|
376
|
+
`RunResult.${name} was REMOVED in parseman 0.44.0 and has no default replacement. ${detail}`
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
return result;
|
|
382
|
+
}
|
|
354
383
|
var invoke = (r, input, pos, ctx) => typeof r === "function" ? r(input, pos, ctx) : r.parse(input, pos, ctx);
|
|
355
384
|
function triviaKindLabelsFromRunnable(r) {
|
|
356
385
|
if (!r) return void 0;
|
|
@@ -453,37 +482,11 @@ function runOnce(entry, input, options, phase, profileState) {
|
|
|
453
482
|
unconsumedFrom
|
|
454
483
|
};
|
|
455
484
|
}
|
|
456
|
-
function clonePassState(state) {
|
|
457
|
-
if (state === null || typeof state !== "object") return state;
|
|
458
|
-
return Array.isArray(state) ? [...state] : { ...state };
|
|
459
|
-
}
|
|
460
|
-
function profilePass(entry, input, options, phase) {
|
|
461
|
-
const state = { phase, nodes: 0, childSlots: 0, rawSlots: 0, triviaSlots: 0, fieldSlots: 0, hostCalls: 0 };
|
|
462
|
-
const passOptions = options.state === void 0 ? options : { ...options, state: clonePassState(options.state) };
|
|
463
|
-
const start = performance.now();
|
|
464
|
-
const result = runOnce(entry, input, passOptions, phase, state);
|
|
465
|
-
const { phase: _phase, ...counts } = state;
|
|
466
|
-
return { result, profile: { ms: performance.now() - start, ...counts } };
|
|
467
|
-
}
|
|
468
485
|
function run(entry, input, options = {}) {
|
|
469
|
-
if (!options.profile) return runOnce(entry, input, options);
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const recognizer = profilePass(entry, input, options, "recognizer");
|
|
474
|
-
const capture = profilePass(entry, input, options, "capture");
|
|
475
|
-
const host = profilePass(entry, input, options, "host");
|
|
476
|
-
if (recognizer.result.ok !== host.result.ok || capture.result.ok !== host.result.ok || recognizer.result.unconsumedFrom !== host.result.unconsumedFrom || capture.result.unconsumedFrom !== host.result.unconsumedFrom) {
|
|
477
|
-
throw new Error("run({ profile: true }) changed recognition; the grammar is not profile-safe");
|
|
478
|
-
}
|
|
479
|
-
return {
|
|
480
|
-
...host.result,
|
|
481
|
-
profile: {
|
|
482
|
-
recognizer: recognizer.profile,
|
|
483
|
-
structuralCapture: capture.profile,
|
|
484
|
-
hostConstruction: host.profile
|
|
485
|
-
}
|
|
486
|
-
};
|
|
486
|
+
if (!options.profile) return guardRemovedFields(runOnce(entry, input, options));
|
|
487
|
+
throw new TypeError(
|
|
488
|
+
"run({ profile: true }) is unavailable: profiling counters are no longer compiled into parser artifacts, and the interpreter does not implement them yet. Profiling is moving to interpreted mode."
|
|
489
|
+
);
|
|
487
490
|
}
|
|
488
491
|
|
|
489
492
|
// src/combinators/completions.ts
|
|
@@ -526,6 +529,13 @@ var SELECTED_ROOT_FINISH = [
|
|
|
526
529
|
` }`
|
|
527
530
|
].join("\n");
|
|
528
531
|
|
|
532
|
+
// src/compiler/inline-build.ts
|
|
533
|
+
var ANN = String.raw`\s*\??\s*(?::[^,)=]+)?`;
|
|
534
|
+
var ANY_P = String.raw`\w+${ANN}`;
|
|
535
|
+
var MK_BUILD_RE = new RegExp(
|
|
536
|
+
String.raw`^\(\s*(\w+)${ANN}\s*,\s*${ANY_P}\s*,\s*(\w+)${ANN}\s*,\s*(\w+)${ANN}\s*,\s*(\w+)${ANN}\s*\)\s*=>\s*mk\s*\(\s*(['"])([^'"]+)\5\s*,\s*\1\s*,\s*\3\s*,\s*\2\s*,\s*\4\s*\)\s*$`
|
|
537
|
+
);
|
|
538
|
+
|
|
529
539
|
// src/compiler/linker.ts
|
|
530
540
|
function normalizeCstCollapse(collapse) {
|
|
531
541
|
if (collapse === true) return () => true;
|