parseman 0.48.0 → 0.48.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 +158 -51
- package/dist/analysis/diagnostics.js.map +2 -2
- package/dist/cli/index.js +158 -51
- package/dist/cli/index.js.map +2 -2
- package/dist/combinators/choice.d.ts.map +1 -1
- package/dist/index.js +159 -52
- package/dist/index.js.map +2 -2
- package/dist/plugin/index.js +159 -52
- package/dist/plugin/index.js.map +2 -2
- package/dist/spec/index.js +10 -1
- package/dist/spec/index.js.map +2 -2
- package/dist/table/assemble.d.ts.map +1 -1
- package/dist/table/emit-assembly.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 +158 -51
- package/dist/table/index.js.map +1 -1
- package/dist/table/lex-program.d.ts.map +1 -1
- package/dist/table/ops.d.ts +4 -4
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/combinators/choice.ts +10 -1
- package/src/table/assemble.ts +82 -59
- package/src/table/emit-assembly.ts +10 -5
- package/src/table/encode.ts +6 -10
- package/src/table/exec.ts +13 -18
- package/src/table/lex-program.ts +15 -6
- package/src/table/ops.ts +4 -4
- package/src/version.ts +1 -1
package/dist/spec/index.js
CHANGED
|
@@ -3348,6 +3348,7 @@ function choice(...args) {
|
|
|
3348
3348
|
},
|
|
3349
3349
|
parse(input, pos, ctx) {
|
|
3350
3350
|
const expected = [];
|
|
3351
|
+
let expectedAt = pos;
|
|
3351
3352
|
if (disjoint) {
|
|
3352
3353
|
const code = pos < input.length ? input.codePointAt(pos) : -1;
|
|
3353
3354
|
let idx = code >= 0 && code < 128 ? asciiDispatch[code] : -1;
|
|
@@ -3405,7 +3406,12 @@ function choice(...args) {
|
|
|
3405
3406
|
const result = parsers[i].parse(input, pos, ctx);
|
|
3406
3407
|
if (!result.ok) {
|
|
3407
3408
|
rollbackTrivia(ctx, mark);
|
|
3408
|
-
|
|
3409
|
+
const at = result.span.start;
|
|
3410
|
+
if (at > expectedAt) {
|
|
3411
|
+
expectedAt = at;
|
|
3412
|
+
expected.length = 0;
|
|
3413
|
+
}
|
|
3414
|
+
if (at === expectedAt) expected.push(...result.expected);
|
|
3409
3415
|
if (result.committed) return { ok: false, expected, span: result.span, committed: true };
|
|
3410
3416
|
continue;
|
|
3411
3417
|
}
|
|
@@ -3416,6 +3422,9 @@ function choice(...args) {
|
|
|
3416
3422
|
}
|
|
3417
3423
|
return result;
|
|
3418
3424
|
}
|
|
3425
|
+
if (expected.length === 0) {
|
|
3426
|
+
for (const parser2 of parsers) expected.push(...deriveExpected(parser2));
|
|
3427
|
+
}
|
|
3419
3428
|
return { ok: false, expected, span: { start: pos, end: pos } };
|
|
3420
3429
|
}
|
|
3421
3430
|
};
|