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.
@@ -1 +1 @@
1
- {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/table/exec.ts"],"names":[],"mappings":"AA6CA,OAAO,EAEL,KAAK,cAAc,EACF,KAAK,YAAY,EAAE,KAAK,SAAS,EACnD,MAAM,cAAc,CAAA;AA4BrB;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,+EAA+E;IAC/E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAChC;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,sFAAsF;IACtF,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAA;CAC+H,CAAA;AAUrJ,wBAAgB,kBAAkB,IAAI,IAAI,CASzC;AAwlDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,GAAG,cAAc;AACrC;;;;;;;;GAQG;AACH,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,EACjC,gBAAgB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CA8B3B"}
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/table/exec.ts"],"names":[],"mappings":"AA6CA,OAAO,EAEL,KAAK,cAAc,EACF,KAAK,YAAY,EAAE,KAAK,SAAS,EACnD,MAAM,cAAc,CAAA;AA4BrB;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,+EAA+E;IAC/E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAChC;;;;;;;;;;;OAWG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,sFAAsF;IACtF,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAA;CAC+H,CAAA;AAUrJ,wBAAgB,kBAAkB,IAAI,IAAI,CASzC;AAwlDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,GAAG,cAAc;AACrC;;;;;;;;GAQG;AACH,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,EACjC,gBAAgB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAiC3B"}
@@ -2800,14 +2800,8 @@ function choice(...args) {
2800
2800
  if (result.committed) return { ok: false, expected, span: { start: pos, end: pos }, committed: true };
2801
2801
  return { ok: false, expected, span: { start: pos, end: pos } };
2802
2802
  }
2803
- return {
2804
- ok: false,
2805
- expected: parsers.flatMap((p) => {
2806
- const r = p.parse(input, pos, ctx);
2807
- return r.ok ? [] : r.expected;
2808
- }),
2809
- span: { start: pos, end: pos }
2810
- };
2803
+ if (ctx._probe !== void 0 || ctx._tolerant) for (const p of parsers) p.parse(input, pos, ctx);
2804
+ return { ok: false, expected: [...scalarExpected], span: { start: pos, end: pos } };
2811
2805
  }
2812
2806
  if (strategy?.tag === "greedyClassify") {
2813
2807
  const superResult = parsers[strategy.superIndex].parse(input, pos, ctx);
@@ -11592,7 +11586,8 @@ function tableRules(source, metadataOrEntry = {}) {
11592
11586
  scanSkipFor: (ri, ctx) => {
11593
11587
  const a = cache.forCtx(ctx);
11594
11588
  selected = a;
11595
- return a.scanSkip[skipOf?.[ri] ?? -1];
11589
+ const slot = skipOf?.[ri];
11590
+ return slot === void 0 || slot < 0 ? void 0 : a.scanSkip[slot];
11596
11591
  }
11597
11592
  }, artifactMetadata, resolved);
11598
11593
  if (entry === void 0) return map;
@@ -15745,8 +15740,11 @@ function compileImpl(combinator, mapFnSources, opts = {}) {
15745
15740
  // falls back to regex-scanning generated hooks; a table has no hooks to scan,
15746
15741
  // so this is the channel.
15747
15742
  ...plan === void 0 ? {} : { coverageDefinitions: plan.definitions },
15748
- parse(input, pos = 0) {
15749
- return runOnce(input, pos, createParseContext());
15743
+ // The same three arguments as a combinator's own `parse`, so a compiled
15744
+ // parser runs where a combinator does. A caller probing many positions
15745
+ // passes one context and pays for none per call.
15746
+ parse(input, pos = 0, ctx) {
15747
+ return runOnce(input, pos, ctx ?? createParseContext());
15750
15748
  },
15751
15749
  parseWithContext(input, parseCtx, pos = 0) {
15752
15750
  return runOnce(input, pos, parseCtx);