parseman 0.61.0 → 0.61.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/backtrack.d.ts +50 -0
- package/dist/analysis/backtrack.d.ts.map +1 -0
- package/dist/analysis/diagnostics.d.ts +3 -0
- package/dist/analysis/diagnostics.d.ts.map +1 -1
- package/dist/analysis/diagnostics.js +1116 -123
- package/dist/analysis/diagnostics.js.map +3 -3
- package/dist/analysis/rebuild.d.ts +17 -1
- package/dist/analysis/rebuild.d.ts.map +1 -1
- package/dist/cli/index.js +307 -34
- package/dist/cli/index.js.map +3 -3
- package/dist/combinators/dispatch.d.ts +2 -0
- package/dist/combinators/dispatch.d.ts.map +1 -1
- package/dist/coverage.d.ts.map +1 -1
- package/dist/index.js +31 -25
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.js +21 -15
- package/dist/plugin/index.js.map +2 -2
- package/dist/table/backtrack-probe.d.ts +41 -0
- package/dist/table/backtrack-probe.d.ts.map +1 -0
- package/dist/table/child-slots.d.ts +10 -0
- package/dist/table/child-slots.d.ts.map +1 -1
- package/dist/table/index.js +21 -15
- package/dist/table/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +5 -1
- package/src/analysis/backtrack.ts +249 -0
- package/src/analysis/diagnostics.ts +4 -0
- package/src/analysis/rebuild.ts +63 -11
- package/src/combinators/dispatch.ts +9 -0
- package/src/coverage.ts +2 -14
- package/src/table/backtrack-probe.ts +326 -0
- package/src/table/child-slots.ts +30 -14
- package/src/version.ts +1 -1
package/dist/plugin/index.js
CHANGED
|
@@ -5619,7 +5619,7 @@ function sourceLeaf(root, fn) {
|
|
|
5619
5619
|
}
|
|
5620
5620
|
|
|
5621
5621
|
// src/version.ts
|
|
5622
|
-
var PARSEMAN_VERSION = "0.61.
|
|
5622
|
+
var PARSEMAN_VERSION = "0.61.1";
|
|
5623
5623
|
|
|
5624
5624
|
// src/table/lex-body.ts
|
|
5625
5625
|
function buildLexBodyRecognizer(spec, constants) {
|
|
@@ -10428,6 +10428,12 @@ function emitShapeMatch(shape, start, mint, ind, firstChar) {
|
|
|
10428
10428
|
|
|
10429
10429
|
// src/table/child-slots.ts
|
|
10430
10430
|
function childSlots(code, ip, out) {
|
|
10431
|
+
const from = out.length;
|
|
10432
|
+
if (!childSlotOffsets(code, ip, out)) return false;
|
|
10433
|
+
for (let i = from; i < out.length; i++) out[i] = code[out[i]];
|
|
10434
|
+
return true;
|
|
10435
|
+
}
|
|
10436
|
+
function childSlotOffsets(code, ip, out) {
|
|
10431
10437
|
switch (code[ip]) {
|
|
10432
10438
|
// ZERO-WIDTH / TERMINAL ROWS — no successor. `OP_GUARD` and `OP_ADJ` are both
|
|
10433
10439
|
// childless tests. `OP_LIVE` holds a hand-written combinator in `prog.fns`; its
|
|
@@ -10460,7 +10466,7 @@ function childSlots(code, ip, out) {
|
|
|
10460
10466
|
case OP_COV:
|
|
10461
10467
|
case OP_REJECT:
|
|
10462
10468
|
case OP_GAPGATE:
|
|
10463
|
-
out.push(
|
|
10469
|
+
out.push(ip + 1);
|
|
10464
10470
|
return true;
|
|
10465
10471
|
// Single child at `ip + 2`.
|
|
10466
10472
|
case OP_GATE:
|
|
@@ -10477,55 +10483,55 @@ function childSlots(code, ip, out) {
|
|
|
10477
10483
|
case OP_ARMGATE:
|
|
10478
10484
|
case OP_RGATE:
|
|
10479
10485
|
case OP_RGATE2:
|
|
10480
|
-
out.push(
|
|
10486
|
+
out.push(ip + 2);
|
|
10481
10487
|
return true;
|
|
10482
10488
|
// `STRICT strict tolerant` — both encodings are reachable; an assembly keeps one.
|
|
10483
10489
|
case OP_STRICT:
|
|
10484
|
-
out.push(
|
|
10490
|
+
out.push(ip + 1, ip + 2);
|
|
10485
10491
|
return true;
|
|
10486
10492
|
// `ROUTED fallback` — the operand is an offset or −1. The routed token itself is
|
|
10487
10493
|
// data the enclosing `dispatch()` already consumed, so the only edge is the
|
|
10488
10494
|
// fallback.
|
|
10489
10495
|
case OP_ROUTED:
|
|
10490
|
-
if (code[ip + 1] >= 0) out.push(
|
|
10496
|
+
if (code[ip + 1] >= 0) out.push(ip + 1);
|
|
10491
10497
|
return true;
|
|
10492
10498
|
// `DISPATCH sel d other otherRouted n a1 … an` — the SELECTOR is a child on
|
|
10493
10499
|
// exactly the same footing as the arms: it runs inside whatever node and scope
|
|
10494
10500
|
// this site sits in.
|
|
10495
10501
|
case OP_DISPATCH: {
|
|
10496
|
-
out.push(
|
|
10497
|
-
if (code[ip + 3] >= 0) out.push(
|
|
10502
|
+
out.push(ip + 1);
|
|
10503
|
+
if (code[ip + 3] >= 0) out.push(ip + 3);
|
|
10498
10504
|
const n = code[ip + 5];
|
|
10499
|
-
for (let i = 0; i < n; i++) out.push(
|
|
10505
|
+
for (let i = 0; i < n; i++) out.push(ip + 6 + i);
|
|
10500
10506
|
return true;
|
|
10501
10507
|
}
|
|
10502
10508
|
case OP_SEQ:
|
|
10503
10509
|
case OP_SEQV: {
|
|
10504
10510
|
const n = code[ip + 1];
|
|
10505
|
-
for (let i = 0; i < n; i++) out.push(
|
|
10511
|
+
for (let i = 0; i < n; i++) out.push(ip + 2 + i);
|
|
10506
10512
|
return true;
|
|
10507
10513
|
}
|
|
10508
10514
|
case OP_SEQX: {
|
|
10509
10515
|
const n = code[ip + 2];
|
|
10510
|
-
for (let i = 0; i < n; i++) out.push(
|
|
10516
|
+
for (let i = 0; i < n; i++) out.push(ip + 3 + i);
|
|
10511
10517
|
return true;
|
|
10512
10518
|
}
|
|
10513
10519
|
case OP_CHOICE: {
|
|
10514
10520
|
const n = code[ip + 2];
|
|
10515
|
-
for (let i = 0; i < n; i++) out.push(
|
|
10521
|
+
for (let i = 0; i < n; i++) out.push(ip + 4 + i);
|
|
10516
10522
|
return true;
|
|
10517
10523
|
}
|
|
10518
10524
|
// Arms are stride-2 from `ip + 4` — the gate word sits beside each arm offset.
|
|
10519
10525
|
case OP_GREEDY: {
|
|
10520
|
-
out.push(
|
|
10526
|
+
out.push(ip + 1);
|
|
10521
10527
|
const n = code[ip + 2];
|
|
10522
|
-
for (let i = 0; i < n; i++) out.push(
|
|
10528
|
+
for (let i = 0; i < n; i++) out.push(ip + 4 + 2 * i);
|
|
10523
10529
|
return true;
|
|
10524
10530
|
}
|
|
10525
10531
|
case OP_REP:
|
|
10526
10532
|
case OP_REPV:
|
|
10527
|
-
out.push(
|
|
10528
|
-
if (code[ip + 4] >= 0) out.push(
|
|
10533
|
+
out.push(ip + 1);
|
|
10534
|
+
if (code[ip + 4] >= 0) out.push(ip + 4);
|
|
10529
10535
|
return true;
|
|
10530
10536
|
default:
|
|
10531
10537
|
return false;
|