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/plugin/index.js
CHANGED
|
@@ -1454,7 +1454,11 @@ function label(name, combinator) {
|
|
|
1454
1454
|
_tag: combinator._tag,
|
|
1455
1455
|
_meta: combinator._meta,
|
|
1456
1456
|
_def: { tag: "label", label: name, parser: combinator },
|
|
1457
|
-
parse
|
|
1457
|
+
parse(input, pos, ctx) {
|
|
1458
|
+
const result = combinator.parse(input, pos, ctx);
|
|
1459
|
+
if (!result.ok) return { ...result, expected: [name] };
|
|
1460
|
+
return result;
|
|
1461
|
+
}
|
|
1458
1462
|
};
|
|
1459
1463
|
}
|
|
1460
1464
|
|
|
@@ -4497,8 +4501,17 @@ function emitDispatch(p, ctx, pos) {
|
|
|
4497
4501
|
return emit(def.parser, ctx, pos);
|
|
4498
4502
|
case "token":
|
|
4499
4503
|
return emitToken(def, ctx, pos);
|
|
4500
|
-
case "label":
|
|
4501
|
-
|
|
4504
|
+
case "label": {
|
|
4505
|
+
const inner = emitFallible(def.parser, ctx, pos);
|
|
4506
|
+
return {
|
|
4507
|
+
stmts: [
|
|
4508
|
+
...inner.stmts,
|
|
4509
|
+
...emitIfFail(ctx, `!${inner.okVar}`, failBody(ctx, JSON.stringify(def.label), "_ctx._fe"))
|
|
4510
|
+
],
|
|
4511
|
+
valueVar: inner.valVar,
|
|
4512
|
+
endVar: inner.endVar
|
|
4513
|
+
};
|
|
4514
|
+
}
|
|
4502
4515
|
case "grammar": {
|
|
4503
4516
|
const savedTrivia = ctx.activeTrivia;
|
|
4504
4517
|
const savedKindLabels = ctx.triviaKindLabels;
|