parseman 0.54.0 → 0.55.0
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 +17 -1
- package/dist/analysis/diagnostics.js.map +2 -2
- package/dist/cli/index.js +17 -1
- package/dist/cli/index.js.map +2 -2
- package/dist/combinators/withCtx.d.ts +22 -7
- package/dist/combinators/withCtx.d.ts.map +1 -1
- package/dist/index.js +36 -11
- package/dist/index.js.map +2 -2
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.js +41 -13
- package/dist/plugin/index.js.map +2 -2
- package/dist/table/assemble.d.ts.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/exec.d.ts.map +1 -1
- package/dist/table/index.js +17 -1
- package/dist/table/index.js.map +2 -2
- package/dist/table/ops.d.ts +3 -1
- package/dist/table/ops.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/combinators/withCtx.ts +61 -28
- package/src/plugin/evaluator.ts +12 -2
- package/src/table/assemble.ts +11 -1
- package/src/table/encode.ts +5 -0
- package/src/table/exec.ts +2 -1
- package/src/table/ops.ts +3 -1
- package/src/types.ts +2 -0
- package/src/version.ts +1 -1
|
@@ -7243,6 +7243,9 @@ var Encoder = class {
|
|
|
7243
7243
|
this.expected([adjacencyExpected(d)])
|
|
7244
7244
|
);
|
|
7245
7245
|
case "withCtx": {
|
|
7246
|
+
if (typeof d.extra === "function") {
|
|
7247
|
+
return this.emit(OP_WITHCTX, ~this.fn(d.extra, d.extraSrc ?? null), this.node(d.parser).ip);
|
|
7248
|
+
}
|
|
7246
7249
|
if (!emittableConst(d.extra)) {
|
|
7247
7250
|
this.runtimeOnly.add("withCtx(extra) \u2014 the state object is not serialisable");
|
|
7248
7251
|
}
|
|
@@ -12586,8 +12589,21 @@ function assemble(t2, prog, cfg) {
|
|
|
12586
12589
|
};
|
|
12587
12590
|
}
|
|
12588
12591
|
case OP_WITHCTX: {
|
|
12589
|
-
const
|
|
12592
|
+
const ki = code[ip + 1];
|
|
12590
12593
|
const child = link(code[ip + 2]);
|
|
12594
|
+
if (ki < 0) {
|
|
12595
|
+
const derive2 = fns[~ki];
|
|
12596
|
+
return (input, pos, ctx) => {
|
|
12597
|
+
const saved = ctx.state;
|
|
12598
|
+
ctx.state = derive2(saved);
|
|
12599
|
+
try {
|
|
12600
|
+
return child(input, pos, ctx);
|
|
12601
|
+
} finally {
|
|
12602
|
+
ctx.state = saved;
|
|
12603
|
+
}
|
|
12604
|
+
};
|
|
12605
|
+
}
|
|
12606
|
+
const extra = k[ki];
|
|
12591
12607
|
return (input, pos, ctx) => {
|
|
12592
12608
|
const saved = ctx.state;
|
|
12593
12609
|
ctx.state = extra;
|