parseman 0.55.2 → 0.55.4

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.
@@ -3585,14 +3585,8 @@ function choice(...args) {
3585
3585
  if (result.committed) return { ok: false, expected, span: { start: pos, end: pos }, committed: true };
3586
3586
  return { ok: false, expected, span: { start: pos, end: pos } };
3587
3587
  }
3588
- return {
3589
- ok: false,
3590
- expected: parsers.flatMap((p) => {
3591
- const r = p.parse(input, pos, ctx);
3592
- return r.ok ? [] : r.expected;
3593
- }),
3594
- span: { start: pos, end: pos }
3595
- };
3588
+ if (ctx._probe !== void 0 || ctx._tolerant) for (const p of parsers) p.parse(input, pos, ctx);
3589
+ return { ok: false, expected: [...scalarExpected], span: { start: pos, end: pos } };
3596
3590
  }
3597
3591
  if (strategy?.tag === "greedyClassify") {
3598
3592
  const superResult = parsers[strategy.superIndex].parse(input, pos, ctx);
@@ -14992,7 +14986,8 @@ function tableRules(source, metadataOrEntry = {}) {
14992
14986
  scanSkipFor: (ri, ctx) => {
14993
14987
  const a = cache.forCtx(ctx);
14994
14988
  selected = a;
14995
- return a.scanSkip[skipOf?.[ri] ?? -1];
14989
+ const slot = skipOf?.[ri];
14990
+ return slot === void 0 || slot < 0 ? void 0 : a.scanSkip[slot];
14996
14991
  }
14997
14992
  }, artifactMetadata, resolved);
14998
14993
  if (entry === void 0) return map;
@@ -16901,8 +16896,11 @@ function compileImpl(combinator, mapFnSources, opts = {}) {
16901
16896
  // falls back to regex-scanning generated hooks; a table has no hooks to scan,
16902
16897
  // so this is the channel.
16903
16898
  ...plan === void 0 ? {} : { coverageDefinitions: plan.definitions },
16904
- parse(input, pos = 0) {
16905
- return runOnce(input, pos, createParseContext());
16899
+ // The same three arguments as a combinator's own `parse`, so a compiled
16900
+ // parser runs where a combinator does. A caller probing many positions
16901
+ // passes one context and pays for none per call.
16902
+ parse(input, pos = 0, ctx) {
16903
+ return runOnce(input, pos, ctx ?? createParseContext());
16906
16904
  },
16907
16905
  parseWithContext(input, parseCtx, pos = 0) {
16908
16906
  return runOnce(input, pos, parseCtx);
@@ -17357,7 +17355,7 @@ function fieldOptionsSrc(def) {
17357
17355
  }
17358
17356
 
17359
17357
  // src/version.ts
17360
- var PARSEMAN_VERSION = "0.55.2";
17358
+ var PARSEMAN_VERSION = "0.55.4";
17361
17359
 
17362
17360
  // src/compiler/compile-linkable-table.ts
17363
17361
  function isLocal(rule) {