parseman 0.48.0 → 0.49.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 +158 -51
- package/dist/analysis/diagnostics.js.map +2 -2
- package/dist/cli/index.js +160 -52
- package/dist/cli/index.js.map +2 -2
- package/dist/combinators/choice.d.ts.map +1 -1
- package/dist/compiler/ir-serialize.d.ts.map +1 -1
- package/dist/compiler/linker.d.ts.map +1 -1
- package/dist/index.js +169 -55
- package/dist/index.js.map +2 -2
- package/dist/language-service/index.js.map +1 -1
- package/dist/plugin/direct-builder-static.d.ts +20 -0
- package/dist/plugin/direct-builder-static.d.ts.map +1 -1
- package/dist/plugin/evaluator.d.ts +13 -0
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +365 -71
- package/dist/plugin/index.js.map +2 -2
- package/dist/spec/index.js +12 -2
- 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/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/combinators/choice.ts +10 -1
- package/src/compiler/ir-serialize.ts +15 -3
- package/src/compiler/linker.ts +14 -1
- package/src/plugin/direct-builder-static.ts +116 -12
- package/src/plugin/evaluator.ts +50 -2
- package/src/plugin/index.ts +140 -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/types.ts +1 -1
- 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
|
};
|
|
@@ -4941,7 +4950,7 @@ function evalRuleMapIR(ir) {
|
|
|
4941
4950
|
l._def.fnSrc = src;
|
|
4942
4951
|
return l;
|
|
4943
4952
|
};
|
|
4944
|
-
const _nd = (type, child, src, opts, staticError, sigSrc) => {
|
|
4953
|
+
const _nd = (type, child, src, opts, staticError, sigSrc, buildImports) => {
|
|
4945
4954
|
if (staticError !== void 0 && staticError.length > 0) {
|
|
4946
4955
|
throw new Error(`IR direct node builder for ${type} must be macro-static and self-contained; unsupported binding(s): ${staticError.join(", ")}`);
|
|
4947
4956
|
}
|
|
@@ -4951,6 +4960,7 @@ function evalRuleMapIR(ir) {
|
|
|
4951
4960
|
n._def.buildSrc = src;
|
|
4952
4961
|
if (staticError !== void 0) n._def.buildStaticError = staticError;
|
|
4953
4962
|
if (sigSrc !== void 0) n._def.buildSigSrc = sigSrc;
|
|
4963
|
+
if (buildImports !== void 0) n._def.buildImports = buildImports;
|
|
4954
4964
|
return n;
|
|
4955
4965
|
};
|
|
4956
4966
|
const _gch = (items) => {
|