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":"choice.d.ts","sourceRoot":"","sources":["../../src/combinators/choice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAC+B,QAAQ,EAClD,MAAM,aAAa,CAAA;AAMpB,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;AACvH,KAAK,SAAS,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI;KACrE,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,MAAM,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEjD,wBAAgB,MAAM,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EACxH,GAAG,IAAI,EAAE,CAAC,GACT,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CA8M1B;AAgID;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAWrF;AA6CD,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,OA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C,GAAG,IAAI,CAWrF;AA6CD,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAKzE;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMhG"}
package/dist/index.js CHANGED
@@ -3048,14 +3048,8 @@ function choice(...args) {
3048
3048
  if (result.committed) return { ok: false, expected, span: { start: pos, end: pos }, committed: true };
3049
3049
  return { ok: false, expected, span: { start: pos, end: pos } };
3050
3050
  }
3051
- return {
3052
- ok: false,
3053
- expected: parsers.flatMap((p) => {
3054
- const r = p.parse(input, pos, ctx);
3055
- return r.ok ? [] : r.expected;
3056
- }),
3057
- span: { start: pos, end: pos }
3058
- };
3051
+ if (ctx._probe !== void 0 || ctx._tolerant) for (const p of parsers) p.parse(input, pos, ctx);
3052
+ return { ok: false, expected: [...scalarExpected], span: { start: pos, end: pos } };
3059
3053
  }
3060
3054
  if (strategy?.tag === "greedyClassify") {
3061
3055
  const superResult = parsers[strategy.superIndex].parse(input, pos, ctx);
@@ -15409,7 +15403,8 @@ function tableRules(source, metadataOrEntry = {}) {
15409
15403
  scanSkipFor: (ri, ctx) => {
15410
15404
  const a = cache.forCtx(ctx);
15411
15405
  selected = a;
15412
- return a.scanSkip[skipOf?.[ri] ?? -1];
15406
+ const slot = skipOf?.[ri];
15407
+ return slot === void 0 || slot < 0 ? void 0 : a.scanSkip[slot];
15413
15408
  }
15414
15409
  }, artifactMetadata, resolved);
15415
15410
  if (entry === void 0) return map;
@@ -17318,8 +17313,11 @@ function compileImpl(combinator, mapFnSources, opts = {}) {
17318
17313
  // falls back to regex-scanning generated hooks; a table has no hooks to scan,
17319
17314
  // so this is the channel.
17320
17315
  ...plan === void 0 ? {} : { coverageDefinitions: plan.definitions },
17321
- parse(input, pos = 0) {
17322
- return runOnce2(input, pos, createParseContext());
17316
+ // The same three arguments as a combinator's own `parse`, so a compiled
17317
+ // parser runs where a combinator does. A caller probing many positions
17318
+ // passes one context and pays for none per call.
17319
+ parse(input, pos = 0, ctx) {
17320
+ return runOnce2(input, pos, ctx ?? createParseContext());
17323
17321
  },
17324
17322
  parseWithContext(input, parseCtx, pos = 0) {
17325
17323
  return runOnce2(input, pos, parseCtx);
@@ -17771,7 +17769,7 @@ function fieldOptionsSrc(def) {
17771
17769
  }
17772
17770
 
17773
17771
  // src/version.ts
17774
- var PARSEMAN_VERSION = "0.55.2";
17772
+ var PARSEMAN_VERSION = "0.55.4";
17775
17773
 
17776
17774
  // src/compiler/compile-linkable-table.ts
17777
17775
  function isLocal(rule) {