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.
- package/dist/analysis/diagnostics.js +19 -45
- package/dist/analysis/diagnostics.js.map +1 -1
- package/dist/cli/index.js +19 -45
- package/dist/cli/index.js.map +1 -1
- package/dist/combinators/choice.d.ts +0 -5
- package/dist/combinators/choice.d.ts.map +1 -1
- package/dist/combinators/scanTo.d.ts +1 -16
- package/dist/combinators/scanTo.d.ts.map +1 -1
- package/dist/compiler/ir-serialize.d.ts.map +1 -1
- package/dist/compiler/linker.d.ts +0 -3
- package/dist/compiler/linker.d.ts.map +1 -1
- package/dist/compiler/token-alphabet.d.ts +5 -25
- package/dist/compiler/token-alphabet.d.ts.map +1 -1
- package/dist/compiler/token-capability.js.map +1 -1
- package/dist/compiler/token-dispatch.d.ts +8 -79
- package/dist/compiler/token-dispatch.d.ts.map +1 -1
- package/dist/cst/root-trivia-scope.d.ts +0 -3
- package/dist/cst/root-trivia-scope.d.ts.map +1 -1
- package/dist/cst/trivia-entries.d.ts +0 -2
- package/dist/cst/trivia-entries.d.ts.map +1 -1
- package/dist/cst/trivia-kinds.d.ts +0 -5
- package/dist/cst/trivia-kinds.d.ts.map +1 -1
- package/dist/index.js +20 -46
- package/dist/index.js.map +1 -1
- package/dist/language-service/index.js.map +1 -1
- package/dist/plugin/index.js +20 -46
- package/dist/plugin/index.js.map +1 -1
- package/dist/run/index.js.map +1 -1
- package/dist/spec/index.js.map +1 -1
- package/dist/spec/model.d.ts +0 -8
- package/dist/spec/model.d.ts.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/index.js +19 -45
- package/dist/table/index.js.map +1 -1
- package/dist/table/program.d.ts +0 -1
- package/dist/table/program.d.ts.map +1 -1
- package/dist/table/scalar-terminal.d.ts +0 -7
- package/dist/table/scalar-terminal.d.ts.map +1 -1
- package/dist/table/scan-shapes.d.ts +0 -8
- package/dist/table/scan-shapes.d.ts.map +1 -1
- package/dist/table/site-labels.d.ts +0 -2
- package/dist/table/site-labels.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/combinators/choice.ts +1 -1
- package/src/combinators/scanTo.ts +1 -1
- package/src/compiler/ir-serialize.ts +2 -1
- package/src/compiler/linker.ts +1 -1
- package/src/compiler/token-alphabet.ts +14 -10
- package/src/compiler/token-dispatch.ts +10 -313
- package/src/compiler/token-scanner.ts +2 -2
- package/src/cst/root-trivia-scope.ts +1 -1
- package/src/cst/trivia-entries.ts +1 -1
- package/src/cst/trivia-kinds.ts +1 -1
- package/src/spec/model.ts +1 -1
- package/src/table/encode.ts +16 -39
- package/src/table/program.ts +1 -1
- package/src/table/scalar-terminal.ts +1 -1
- package/src/table/scan-shapes.ts +15 -46
- package/src/table/site-labels.ts +1 -1
- package/src/version.ts +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -7597,18 +7597,10 @@ var Encoder = class {
|
|
|
7597
7597
|
/** TOKEN bodies are an all-program decision. A complete occurrence inside an
|
|
7598
7598
|
* otherwise incomplete final graph stays on CHARACTER with every sibling. */
|
|
7599
7599
|
selectLexicalBodies;
|
|
7600
|
-
/**
|
|
7601
|
-
* Decides the extra operands laid down below. ALWAYS TRUE — see
|
|
7602
|
-
* `TableSettings.recovery`. Kept as a field rather than folded away because it
|
|
7603
|
-
* is what every emit site reads, and the emit sites are where the shape of the
|
|
7604
|
-
* row is stated.
|
|
7605
|
-
*/
|
|
7606
|
-
rec;
|
|
7607
7600
|
constructor(settings, selectLexicalBodies) {
|
|
7608
7601
|
this.settings = settings;
|
|
7609
7602
|
this.track = settings.trackLines === true;
|
|
7610
7603
|
this.selectLexicalBodies = selectLexicalBodies;
|
|
7611
|
-
this.rec = true;
|
|
7612
7604
|
this.plan = settings.coverage;
|
|
7613
7605
|
this.cov = settings.coverage === void 0 ? void 0 : settings.coverage.definitions.map((d) => [d.id, covKindCode(d.kind)]);
|
|
7614
7606
|
this.covIndex = new Map((this.cov ?? []).map((d, i) => [d[0], i]));
|
|
@@ -8110,12 +8102,10 @@ var Encoder = class {
|
|
|
8110
8102
|
}
|
|
8111
8103
|
case "sequence": {
|
|
8112
8104
|
const kids = d.parsers.map((c) => this.node(c).ip);
|
|
8113
|
-
const head = this.emitHead(d.valueUnused ? OP_SEQV : OP_SEQ, 1 +
|
|
8105
|
+
const head = this.emitHead(d.valueUnused ? OP_SEQV : OP_SEQ, 1 + 2 * kids.length);
|
|
8114
8106
|
this.code[head + 1] = kids.length;
|
|
8115
8107
|
for (let i = 0; i < kids.length; i++) this.code[head + 2 + i] = kids[i];
|
|
8116
|
-
|
|
8117
|
-
for (let i = 0; i < kids.length; i++) this.code[head + 2 + kids.length + i] = this.followClass(d.parsers, i);
|
|
8118
|
-
}
|
|
8108
|
+
for (let i = 0; i < kids.length; i++) this.code[head + 2 + kids.length + i] = this.followClass(d.parsers, i);
|
|
8119
8109
|
return head;
|
|
8120
8110
|
}
|
|
8121
8111
|
case "choice": {
|
|
@@ -8217,25 +8207,22 @@ var Encoder = class {
|
|
|
8217
8207
|
const itemClass = matchesEmpty(d.parser, /* @__PURE__ */ new Set(), rr) ? -1 : this.charClass(firstSetOf(d.parser, /* @__PURE__ */ new Set(), rr, this.activeTrivia));
|
|
8218
8208
|
const op = d.valueUnused ? OP_REPV : OP_REP;
|
|
8219
8209
|
const min = d.tag === "many" ? 0 : d.min;
|
|
8220
|
-
return this.
|
|
8210
|
+
return this.emit(op, child, min, d.max ?? -1, -1, 0, this.expected(deriveExpected(d.parser)), itemClass);
|
|
8221
8211
|
}
|
|
8222
8212
|
case "sepBy": {
|
|
8223
8213
|
const child = this.node(d.parser).ip;
|
|
8224
8214
|
const sep = this.node(d.separator).ip;
|
|
8225
8215
|
const flags = (d.trailing === "allow" ? 1 : 0) | (d.keepSeparators === true ? 2 : 0) | (d.min >= 2 ? 4 : 0);
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
);
|
|
8237
|
-
}
|
|
8238
|
-
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);
|
|
8216
|
+
return this.emit(
|
|
8217
|
+
OP_REP,
|
|
8218
|
+
child,
|
|
8219
|
+
d.min,
|
|
8220
|
+
d.max ?? -1,
|
|
8221
|
+
sep,
|
|
8222
|
+
flags,
|
|
8223
|
+
this.expected(deriveExpected(d.parser)),
|
|
8224
|
+
this.charClass(firstSetOf(d.separator, /* @__PURE__ */ new Set(), this.refResolver(), this.activeTrivia))
|
|
8225
|
+
);
|
|
8239
8226
|
}
|
|
8240
8227
|
case "optional": {
|
|
8241
8228
|
const head = this.emit(OP_OPT, this.lookaheadGate(d.parser, this.node(d.parser).ip));
|
|
@@ -8246,14 +8233,12 @@ var Encoder = class {
|
|
|
8246
8233
|
const inner = d.parser._def;
|
|
8247
8234
|
if (inner.tag === "sequence" && !this.memo.has(d.parser) && !this.pending.has(d.parser)) {
|
|
8248
8235
|
const kids = inner.parsers.map((c) => this.node(c).ip);
|
|
8249
|
-
const head = this.emitHead(OP_SEQX, 2 +
|
|
8236
|
+
const head = this.emitHead(OP_SEQX, 2 + 2 * kids.length);
|
|
8250
8237
|
const projection = directArrayProjection(d.fn, d.fnSrc, kids.length);
|
|
8251
8238
|
this.code[head + 1] = projection === null ? this.fn(d.fn, d.fnSrc ?? null) : ~projection;
|
|
8252
8239
|
this.code[head + 2] = kids.length;
|
|
8253
8240
|
for (let i = 0; i < kids.length; i++) this.code[head + 3 + i] = kids[i];
|
|
8254
|
-
|
|
8255
|
-
for (let i = 0; i < kids.length; i++) this.code[head + 3 + kids.length + i] = this.followClass(inner.parsers, i);
|
|
8256
|
-
}
|
|
8241
|
+
for (let i = 0; i < kids.length; i++) this.code[head + 3 + kids.length + i] = this.followClass(inner.parsers, i);
|
|
8257
8242
|
return head;
|
|
8258
8243
|
}
|
|
8259
8244
|
const child = this.node(d.parser).ip;
|
|
@@ -8576,7 +8561,7 @@ var Encoder = class {
|
|
|
8576
8561
|
...this.settings.hostMode === void 0 ? {} : { hostMode: this.settings.hostMode },
|
|
8577
8562
|
...this.runtimeOnly.size === 0 ? {} : { runtimeOnly: [...this.runtimeOnly].sort() },
|
|
8578
8563
|
...this.triviaSpecs.length === 0 ? {} : { triviaSpecs: this.triviaSpecs },
|
|
8579
|
-
|
|
8564
|
+
rec: 1,
|
|
8580
8565
|
...this.cov === void 0 ? {} : { cov: this.cov },
|
|
8581
8566
|
lines: this.track ? 1 : 0
|
|
8582
8567
|
}, void 0, {
|
|
@@ -9340,7 +9325,6 @@ function caseFoldLiteralOrAlt(source) {
|
|
|
9340
9325
|
}
|
|
9341
9326
|
return { kind: "alt", arms: litArms, disjoint: false, firsts: litArms.map(() => null) };
|
|
9342
9327
|
}
|
|
9343
|
-
var scanToIndexOfEnabled = () => process.env.PARSEMAN_SCANTO === "indexof";
|
|
9344
9328
|
var classCond = (cVar, ranges) => ranges.map(([lo, hi]) => lo === hi ? `${cVar} === ${lo}` : `(${cVar} >= ${lo} && ${cVar} <= ${hi})`).join(" || ");
|
|
9345
9329
|
var litCond = (base, cps, firstVar) => cps.map(
|
|
9346
9330
|
(cp, k) => k === 0 && firstVar ? `${firstVar} === ${cp}` : `input.charCodeAt(${base}${k ? ` + ${k}` : ""}) === ${cp}`
|
|
@@ -9570,13 +9554,7 @@ function emitShapeMatch(shape, start, mint, ind, firstChar) {
|
|
|
9570
9554
|
const j2 = mint("_j");
|
|
9571
9555
|
const openLen2 = shape.open.length;
|
|
9572
9556
|
const openChk2 = openLen2 === 1 ? `${codeAt(start, firstChar)} === ${shape.open[0]}` : litCond(start, shape.open, firstChar);
|
|
9573
|
-
const
|
|
9574
|
-
const scanLine = stopCp !== null && stopCp <= 65535 && scanToIndexOfEnabled() ? (
|
|
9575
|
-
// No temp is minted: a temp would renumber every later variable in the
|
|
9576
|
-
// function and show up as an artifact-size delta that is counter
|
|
9577
|
-
// renumbering rather than this change (the §9.1.4 / §9.2 effect).
|
|
9578
|
-
`${ind} ${j2} = input.indexOf(${JSON.stringify(String.fromCharCode(stopCp))}, ${j2}); if (${j2} < 0) ${j2} = input.length`
|
|
9579
|
-
) : `${ind} while (${j2} < input.length && !(${classCond(`input.charCodeAt(${j2})`, shape.stop)})) ${j2}++`;
|
|
9557
|
+
const scanLine = `${ind} while (${j2} < input.length && !(${classCond(`input.charCodeAt(${j2})`, shape.stop)})) ${j2}++`;
|
|
9580
9558
|
return {
|
|
9581
9559
|
setup: [
|
|
9582
9560
|
`${ind}let ${j2} = ${start}`,
|
|
@@ -9634,11 +9612,7 @@ function emitShapeMatch(shape, start, mint, ind, firstChar) {
|
|
|
9634
9612
|
const closeLen = shape.close.length;
|
|
9635
9613
|
const openChk = openLen === 1 ? `${codeAt(start, firstChar)} === ${shape.open[0]}` : litCond(start, shape.open, firstChar);
|
|
9636
9614
|
const closeChk = litCond(j, shape.close);
|
|
9637
|
-
const
|
|
9638
|
-
const scanLines = scanToIndexOfEnabled() ? [
|
|
9639
|
-
`${ind} ${j} = input.indexOf(${JSON.stringify(closeStr)}, ${j}); if (${j} < 0) ${j} = input.length`,
|
|
9640
|
-
`${ind} if (${j} + ${closeLen} <= input.length) ${endV} = ${j} + ${closeLen}`
|
|
9641
|
-
] : [
|
|
9615
|
+
const scanLines = [
|
|
9642
9616
|
`${ind} while (${j} + ${closeLen - 1} < input.length && !(${closeChk})) ${j}++`,
|
|
9643
9617
|
`${ind} if (${j} + ${closeLen} <= input.length && (${closeChk})) ${endV} = ${j} + ${closeLen}`
|
|
9644
9618
|
];
|
|
@@ -16550,7 +16524,7 @@ function tableRules(source, metadataOrEntry = {}) {
|
|
|
16550
16524
|
}
|
|
16551
16525
|
|
|
16552
16526
|
// src/version.ts
|
|
16553
|
-
var PARSEMAN_VERSION = "0.59.
|
|
16527
|
+
var PARSEMAN_VERSION = "0.59.1";
|
|
16554
16528
|
|
|
16555
16529
|
// src/table/emit.ts
|
|
16556
16530
|
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`)});`;
|