parseman 0.18.0 → 0.18.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/combinators/map.d.ts.map +1 -1
- package/dist/compiler/codegen.d.ts.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +16 -3
- package/dist/index.js.map +2 -2
- package/dist/plugin/index.cjs +16 -3
- package/dist/plugin/index.cjs.map +2 -2
- package/dist/plugin/index.js +16 -3
- package/dist/plugin/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1450,7 +1450,11 @@ function label(name, combinator) {
|
|
|
1450
1450
|
_tag: combinator._tag,
|
|
1451
1451
|
_meta: combinator._meta,
|
|
1452
1452
|
_def: { tag: "label", label: name, parser: combinator },
|
|
1453
|
-
parse
|
|
1453
|
+
parse(input, pos, ctx) {
|
|
1454
|
+
const result = combinator.parse(input, pos, ctx);
|
|
1455
|
+
if (!result.ok) return { ...result, expected: [name] };
|
|
1456
|
+
return result;
|
|
1457
|
+
}
|
|
1454
1458
|
};
|
|
1455
1459
|
}
|
|
1456
1460
|
|
|
@@ -4508,8 +4512,17 @@ function emitDispatch(p, ctx, pos) {
|
|
|
4508
4512
|
return emit(def.parser, ctx, pos);
|
|
4509
4513
|
case "token":
|
|
4510
4514
|
return emitToken(def, ctx, pos);
|
|
4511
|
-
case "label":
|
|
4512
|
-
|
|
4515
|
+
case "label": {
|
|
4516
|
+
const inner = emitFallible(def.parser, ctx, pos);
|
|
4517
|
+
return {
|
|
4518
|
+
stmts: [
|
|
4519
|
+
...inner.stmts,
|
|
4520
|
+
...emitIfFail(ctx, `!${inner.okVar}`, failBody(ctx, JSON.stringify(def.label), "_ctx._fe"))
|
|
4521
|
+
],
|
|
4522
|
+
valueVar: inner.valVar,
|
|
4523
|
+
endVar: inner.endVar
|
|
4524
|
+
};
|
|
4525
|
+
}
|
|
4513
4526
|
case "grammar": {
|
|
4514
4527
|
const savedTrivia = ctx.activeTrivia;
|
|
4515
4528
|
const savedKindLabels = ctx.triviaKindLabels;
|