parseman 0.59.0 → 0.59.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.
Files changed (61) hide show
  1. package/dist/analysis/diagnostics.js +19 -45
  2. package/dist/analysis/diagnostics.js.map +1 -1
  3. package/dist/cli/index.js +19 -45
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/combinators/choice.d.ts +0 -5
  6. package/dist/combinators/choice.d.ts.map +1 -1
  7. package/dist/combinators/scanTo.d.ts +1 -16
  8. package/dist/combinators/scanTo.d.ts.map +1 -1
  9. package/dist/compiler/ir-serialize.d.ts.map +1 -1
  10. package/dist/compiler/linker.d.ts +0 -3
  11. package/dist/compiler/linker.d.ts.map +1 -1
  12. package/dist/compiler/token-alphabet.d.ts +5 -25
  13. package/dist/compiler/token-alphabet.d.ts.map +1 -1
  14. package/dist/compiler/token-capability.js.map +1 -1
  15. package/dist/compiler/token-dispatch.d.ts +8 -79
  16. package/dist/compiler/token-dispatch.d.ts.map +1 -1
  17. package/dist/cst/root-trivia-scope.d.ts +0 -3
  18. package/dist/cst/root-trivia-scope.d.ts.map +1 -1
  19. package/dist/cst/trivia-entries.d.ts +0 -2
  20. package/dist/cst/trivia-entries.d.ts.map +1 -1
  21. package/dist/cst/trivia-kinds.d.ts +0 -5
  22. package/dist/cst/trivia-kinds.d.ts.map +1 -1
  23. package/dist/index.js +20 -46
  24. package/dist/index.js.map +1 -1
  25. package/dist/language-service/index.js.map +1 -1
  26. package/dist/plugin/index.js +20 -46
  27. package/dist/plugin/index.js.map +1 -1
  28. package/dist/run/index.js.map +1 -1
  29. package/dist/spec/index.js.map +1 -1
  30. package/dist/spec/model.d.ts +0 -8
  31. package/dist/spec/model.d.ts.map +1 -1
  32. package/dist/table/encode.d.ts.map +1 -1
  33. package/dist/table/index.js +19 -45
  34. package/dist/table/index.js.map +1 -1
  35. package/dist/table/program.d.ts +0 -1
  36. package/dist/table/program.d.ts.map +1 -1
  37. package/dist/table/scalar-terminal.d.ts +0 -7
  38. package/dist/table/scalar-terminal.d.ts.map +1 -1
  39. package/dist/table/scan-shapes.d.ts +0 -8
  40. package/dist/table/scan-shapes.d.ts.map +1 -1
  41. package/dist/table/site-labels.d.ts +0 -2
  42. package/dist/table/site-labels.d.ts.map +1 -1
  43. package/dist/version.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/src/combinators/choice.ts +1 -1
  46. package/src/combinators/scanTo.ts +1 -1
  47. package/src/compiler/ir-serialize.ts +2 -1
  48. package/src/compiler/linker.ts +1 -1
  49. package/src/compiler/token-alphabet.ts +14 -10
  50. package/src/compiler/token-dispatch.ts +10 -313
  51. package/src/compiler/token-scanner.ts +2 -2
  52. package/src/cst/root-trivia-scope.ts +1 -1
  53. package/src/cst/trivia-entries.ts +1 -1
  54. package/src/cst/trivia-kinds.ts +1 -1
  55. package/src/spec/model.ts +1 -1
  56. package/src/table/encode.ts +16 -39
  57. package/src/table/program.ts +1 -1
  58. package/src/table/scalar-terminal.ts +1 -1
  59. package/src/table/scan-shapes.ts +15 -46
  60. package/src/table/site-labels.ts +1 -1
  61. package/src/version.ts +1 -1
@@ -30,11 +30,6 @@ export type LabeledTriviaSpec = {
30
30
  rootLeaders: readonly CharRange[];
31
31
  rootScan: ((input: string, cur: number) => number) | null;
32
32
  };
33
- /** Strip `label()` wrapper; returns inner parser for matching. */
34
- export declare function peelLabel(p: Combinator<unknown>): {
35
- label: string;
36
- parser: Combinator<unknown>;
37
- } | null;
38
33
  /**
39
34
  * When every trivia arm is `label(name, parser)` inside `oneOrMore(choice(…))`
40
35
  * (or a single labeled arm), return the label table and matchers.
@@ -1 +1 @@
1
- {"version":3,"file":"trivia-kinds.d.ts","sourceRoot":"","sources":["../../src/cst/trivia-kinds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAItE,OAAO,EACwF,KAAK,gBAAgB,EACnH,MAAM,sBA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,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,IAAI,CAmC1F;AAED;;;;;;;;;;;;;;GAcG;AACH;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,EACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAoBR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,KAAK,CAAC,EAAE,OAAO,GACd,MAAM,CAoBR;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACrC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,MAAM,GAAG,SAAS,CAQpB"}
package/dist/index.js CHANGED
@@ -8198,18 +8198,10 @@ var Encoder = class {
8198
8198
  /** TOKEN bodies are an all-program decision. A complete occurrence inside an
8199
8199
  * otherwise incomplete final graph stays on CHARACTER with every sibling. */
8200
8200
  selectLexicalBodies;
8201
- /**
8202
- * Decides the extra operands laid down below. ALWAYS TRUE — see
8203
- * `TableSettings.recovery`. Kept as a field rather than folded away because it
8204
- * is what every emit site reads, and the emit sites are where the shape of the
8205
- * row is stated.
8206
- */
8207
- rec;
8208
8201
  constructor(settings, selectLexicalBodies) {
8209
8202
  this.settings = settings;
8210
8203
  this.track = settings.trackLines === true;
8211
8204
  this.selectLexicalBodies = selectLexicalBodies;
8212
- this.rec = true;
8213
8205
  this.plan = settings.coverage;
8214
8206
  this.cov = settings.coverage === void 0 ? void 0 : settings.coverage.definitions.map((d) => [d.id, covKindCode(d.kind)]);
8215
8207
  this.covIndex = new Map((this.cov ?? []).map((d, i) => [d[0], i]));
@@ -8711,12 +8703,10 @@ var Encoder = class {
8711
8703
  }
8712
8704
  case "sequence": {
8713
8705
  const kids = d.parsers.map((c) => this.node(c).ip);
8714
- const head = this.emitHead(d.valueUnused ? OP_SEQV : OP_SEQ, 1 + kids.length + (this.rec ? kids.length : 0));
8706
+ const head = this.emitHead(d.valueUnused ? OP_SEQV : OP_SEQ, 1 + 2 * kids.length);
8715
8707
  this.code[head + 1] = kids.length;
8716
8708
  for (let i = 0; i < kids.length; i++) this.code[head + 2 + i] = kids[i];
8717
- if (this.rec) {
8718
- for (let i = 0; i < kids.length; i++) this.code[head + 2 + kids.length + i] = this.followClass(d.parsers, i);
8719
- }
8709
+ for (let i = 0; i < kids.length; i++) this.code[head + 2 + kids.length + i] = this.followClass(d.parsers, i);
8720
8710
  return head;
8721
8711
  }
8722
8712
  case "choice": {
@@ -8818,25 +8808,22 @@ var Encoder = class {
8818
8808
  const itemClass = matchesEmpty(d.parser, /* @__PURE__ */ new Set(), rr) ? -1 : this.charClass(firstSetOf(d.parser, /* @__PURE__ */ new Set(), rr, this.activeTrivia));
8819
8809
  const op = d.valueUnused ? OP_REPV : OP_REP;
8820
8810
  const min = d.tag === "many" ? 0 : d.min;
8821
- return this.rec ? this.emit(op, child, min, d.max ?? -1, -1, 0, this.expected(deriveExpected(d.parser)), itemClass) : this.emit(op, child, min, d.max ?? -1, -1, 0);
8811
+ return this.emit(op, child, min, d.max ?? -1, -1, 0, this.expected(deriveExpected(d.parser)), itemClass);
8822
8812
  }
8823
8813
  case "sepBy": {
8824
8814
  const child = this.node(d.parser).ip;
8825
8815
  const sep = this.node(d.separator).ip;
8826
8816
  const flags = (d.trailing === "allow" ? 1 : 0) | (d.keepSeparators === true ? 2 : 0) | (d.min >= 2 ? 4 : 0);
8827
- if (this.rec) {
8828
- return this.emit(
8829
- OP_REP,
8830
- child,
8831
- d.min,
8832
- d.max ?? -1,
8833
- sep,
8834
- flags,
8835
- this.expected(deriveExpected(d.parser)),
8836
- this.charClass(firstSetOf(d.separator, /* @__PURE__ */ new Set(), this.refResolver(), this.activeTrivia))
8837
- );
8838
- }
8839
- return d.min >= 2 ? this.emit(OP_REP, child, d.min, d.max ?? -1, sep, flags, this.expected(deriveExpected(d.parser))) : this.emit(OP_REP, child, d.min, d.max ?? -1, sep, flags);
8817
+ return this.emit(
8818
+ OP_REP,
8819
+ child,
8820
+ d.min,
8821
+ d.max ?? -1,
8822
+ sep,
8823
+ flags,
8824
+ this.expected(deriveExpected(d.parser)),
8825
+ this.charClass(firstSetOf(d.separator, /* @__PURE__ */ new Set(), this.refResolver(), this.activeTrivia))
8826
+ );
8840
8827
  }
8841
8828
  case "optional": {
8842
8829
  const head = this.emit(OP_OPT, this.lookaheadGate(d.parser, this.node(d.parser).ip));
@@ -8847,14 +8834,12 @@ var Encoder = class {
8847
8834
  const inner = d.parser._def;
8848
8835
  if (inner.tag === "sequence" && !this.memo.has(d.parser) && !this.pending.has(d.parser)) {
8849
8836
  const kids = inner.parsers.map((c) => this.node(c).ip);
8850
- const head = this.emitHead(OP_SEQX, 2 + kids.length + (this.rec ? kids.length : 0));
8837
+ const head = this.emitHead(OP_SEQX, 2 + 2 * kids.length);
8851
8838
  const projection = directArrayProjection(d.fn, d.fnSrc, kids.length);
8852
8839
  this.code[head + 1] = projection === null ? this.fn(d.fn, d.fnSrc ?? null) : ~projection;
8853
8840
  this.code[head + 2] = kids.length;
8854
8841
  for (let i = 0; i < kids.length; i++) this.code[head + 3 + i] = kids[i];
8855
- if (this.rec) {
8856
- for (let i = 0; i < kids.length; i++) this.code[head + 3 + kids.length + i] = this.followClass(inner.parsers, i);
8857
- }
8842
+ for (let i = 0; i < kids.length; i++) this.code[head + 3 + kids.length + i] = this.followClass(inner.parsers, i);
8858
8843
  return head;
8859
8844
  }
8860
8845
  const child = this.node(d.parser).ip;
@@ -9177,7 +9162,7 @@ var Encoder = class {
9177
9162
  ...this.settings.hostMode === void 0 ? {} : { hostMode: this.settings.hostMode },
9178
9163
  ...this.runtimeOnly.size === 0 ? {} : { runtimeOnly: [...this.runtimeOnly].sort() },
9179
9164
  ...this.triviaSpecs.length === 0 ? {} : { triviaSpecs: this.triviaSpecs },
9180
- ...this.rec ? { rec: 1 } : {},
9165
+ rec: 1,
9181
9166
  ...this.cov === void 0 ? {} : { cov: this.cov },
9182
9167
  lines: this.track ? 1 : 0
9183
9168
  }, void 0, {
@@ -9944,7 +9929,6 @@ function caseFoldLiteralOrAlt(source) {
9944
9929
  }
9945
9930
  return { kind: "alt", arms: litArms, disjoint: false, firsts: litArms.map(() => null) };
9946
9931
  }
9947
- var scanToIndexOfEnabled = () => process.env.PARSEMAN_SCANTO === "indexof";
9948
9932
  var classCond = (cVar, ranges) => ranges.map(([lo, hi]) => lo === hi ? `${cVar} === ${lo}` : `(${cVar} >= ${lo} && ${cVar} <= ${hi})`).join(" || ");
9949
9933
  var litCond = (base, cps, firstVar) => cps.map(
9950
9934
  (cp, k) => k === 0 && firstVar ? `${firstVar} === ${cp}` : `input.charCodeAt(${base}${k ? ` + ${k}` : ""}) === ${cp}`
@@ -10174,13 +10158,7 @@ function emitShapeMatch(shape, start, mint, ind, firstChar) {
10174
10158
  const j2 = mint("_j");
10175
10159
  const openLen2 = shape.open.length;
10176
10160
  const openChk2 = openLen2 === 1 ? `${codeAt(start, firstChar)} === ${shape.open[0]}` : litCond(start, shape.open, firstChar);
10177
- const stopCp = shape.stop.length === 1 && shape.stop[0][0] === shape.stop[0][1] ? shape.stop[0][0] : null;
10178
- const scanLine = stopCp !== null && stopCp <= 65535 && scanToIndexOfEnabled() ? (
10179
- // No temp is minted: a temp would renumber every later variable in the
10180
- // function and show up as an artifact-size delta that is counter
10181
- // renumbering rather than this change (the §9.1.4 / §9.2 effect).
10182
- `${ind} ${j2} = input.indexOf(${JSON.stringify(String.fromCharCode(stopCp))}, ${j2}); if (${j2} < 0) ${j2} = input.length`
10183
- ) : `${ind} while (${j2} < input.length && !(${classCond(`input.charCodeAt(${j2})`, shape.stop)})) ${j2}++`;
10161
+ const scanLine = `${ind} while (${j2} < input.length && !(${classCond(`input.charCodeAt(${j2})`, shape.stop)})) ${j2}++`;
10184
10162
  return {
10185
10163
  setup: [
10186
10164
  `${ind}let ${j2} = ${start}`,
@@ -10238,11 +10216,7 @@ function emitShapeMatch(shape, start, mint, ind, firstChar) {
10238
10216
  const closeLen = shape.close.length;
10239
10217
  const openChk = openLen === 1 ? `${codeAt(start, firstChar)} === ${shape.open[0]}` : litCond(start, shape.open, firstChar);
10240
10218
  const closeChk = litCond(j, shape.close);
10241
- const closeStr = String.fromCharCode(...shape.close);
10242
- const scanLines = scanToIndexOfEnabled() ? [
10243
- `${ind} ${j} = input.indexOf(${JSON.stringify(closeStr)}, ${j}); if (${j} < 0) ${j} = input.length`,
10244
- `${ind} if (${j} + ${closeLen} <= input.length) ${endV} = ${j} + ${closeLen}`
10245
- ] : [
10219
+ const scanLines = [
10246
10220
  `${ind} while (${j} + ${closeLen - 1} < input.length && !(${closeChk})) ${j}++`,
10247
10221
  `${ind} if (${j} + ${closeLen} <= input.length && (${closeChk})) ${endV} = ${j} + ${closeLen}`
10248
10222
  ];
@@ -17015,7 +16989,7 @@ function tableRules(source, metadataOrEntry = {}) {
17015
16989
  }
17016
16990
 
17017
16991
  // src/version.ts
17018
- var PARSEMAN_VERSION = "0.59.0";
16992
+ var PARSEMAN_VERSION = "0.59.1";
17019
16993
 
17020
16994
  // src/table/emit.ts
17021
16995
  var FACTORY_ARITY_GUARD = `if(arguments.length<${EMITTED_PARAMS.length})throw new Error(${JSON.stringify(`parseman: this parser was printed by parseman ${PARSEMAN_VERSION}; upgrade the parseman runtime to at least that version`)});`;
@@ -19116,7 +19090,7 @@ function serializeRuleMap(ruleMap, scanSkip) {
19116
19090
  return new Serializer(ruleMap, scanSkip ?? []).run();
19117
19091
  } catch (e) {
19118
19092
  if (e instanceof Unserializable) {
19119
- if (process.env.PARSEMAN_IR_DEBUG) console.error(`[ir] fallback: ${e.message}`);
19093
+ if (typeof process !== "undefined" && process.env?.PARSEMAN_IR_DEBUG) console.error(`[ir] fallback: ${e.message}`);
19120
19094
  return null;
19121
19095
  }
19122
19096
  throw e;