parseman 0.51.1 → 0.51.2
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 +48 -15
- package/dist/analysis/diagnostics.js.map +1 -1
- package/dist/cli/index.js +50 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/combinators/token.d.ts +8 -8
- package/dist/combinators/token.d.ts.map +1 -1
- package/dist/coverage.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -19
- package/dist/index.js.map +1 -1
- package/dist/plugin/evaluator.d.ts.map +1 -1
- package/dist/plugin/index.js +53 -20
- package/dist/plugin/index.js.map +1 -1
- package/dist/spec/index.js +27 -5
- package/dist/spec/index.js.map +1 -1
- package/dist/table/assemble.d.ts.map +1 -1
- package/dist/table/emit-assembly.d.ts.map +1 -1
- package/dist/table/encode-baseline.d.ts.map +1 -1
- package/dist/table/exec-baseline.d.ts.map +1 -1
- package/dist/table/exec.d.ts.map +1 -1
- package/dist/table/index.js +373 -362
- package/dist/table/index.js.map +2 -2
- package/dist/table/ops.d.ts +2 -0
- package/dist/table/ops.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/analysis/duplication.ts +1 -1
- package/src/analysis/rebuild.ts +2 -2
- package/src/combinators/token.ts +46 -3
- package/src/compiler/ir-serialize.ts +4 -4
- package/src/coverage.ts +2 -3
- package/src/index.ts +1 -1
- package/src/plugin/evaluator.ts +7 -4
- package/src/table/assemble.ts +8 -3
- package/src/table/child-slots.ts +2 -2
- package/src/table/emit-assembly.ts +5 -3
- package/src/table/encode-baseline.ts +3 -2
- package/src/table/encode.ts +3 -3
- package/src/table/exec-baseline.ts +30 -4
- package/src/table/exec.ts +8 -3
- package/src/table/ops.ts +3 -1
- package/src/table/scalar-terminal.ts +5 -5
- package/src/table/site-labels.ts +2 -2
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
package/dist/spec/index.js
CHANGED
|
@@ -4933,6 +4933,12 @@ function field(name, combinator) {
|
|
|
4933
4933
|
}
|
|
4934
4934
|
|
|
4935
4935
|
// src/combinators/token.ts
|
|
4936
|
+
function semanticLeafValue(_ctx, _input, _start, _end, value) {
|
|
4937
|
+
return value;
|
|
4938
|
+
}
|
|
4939
|
+
function sourceLeafValue(ctx, input, start, end, value) {
|
|
4940
|
+
return cstOutputHost(ctx.build) ? input.slice(start, end) : value;
|
|
4941
|
+
}
|
|
4936
4942
|
function token(root) {
|
|
4937
4943
|
const meta = {
|
|
4938
4944
|
firstSet: root._meta.firstSet,
|
|
@@ -4985,7 +4991,8 @@ function token(root) {
|
|
|
4985
4991
|
}
|
|
4986
4992
|
};
|
|
4987
4993
|
}
|
|
4988
|
-
function
|
|
4994
|
+
function makeLeaf(root, fn, sourceCstValue) {
|
|
4995
|
+
const cstValue = sourceCstValue ? sourceLeafValue : semanticLeafValue;
|
|
4989
4996
|
const meta = {
|
|
4990
4997
|
firstSet: root._meta.firstSet,
|
|
4991
4998
|
canMatchNewline: root._meta.canMatchNewline,
|
|
@@ -4994,7 +5001,12 @@ function leaf(root, fn) {
|
|
|
4994
5001
|
return {
|
|
4995
5002
|
_tag: "leaf",
|
|
4996
5003
|
_meta: meta,
|
|
4997
|
-
_def: {
|
|
5004
|
+
_def: {
|
|
5005
|
+
tag: "leaf",
|
|
5006
|
+
parser: root,
|
|
5007
|
+
fn,
|
|
5008
|
+
...sourceCstValue ? { cstValue: "source" } : {}
|
|
5009
|
+
},
|
|
4998
5010
|
parse(input, pos, ctx) {
|
|
4999
5011
|
const savedBuf = ctx._cstBuf;
|
|
5000
5012
|
const savedChildren = ctx._cstChildren;
|
|
@@ -5022,11 +5034,21 @@ function leaf(root, fn) {
|
|
|
5022
5034
|
}
|
|
5023
5035
|
if (!result.ok) return result;
|
|
5024
5036
|
const value = fn(result.value, result.span);
|
|
5025
|
-
if (wasCapturing) pushCstLeaf(ctx, {
|
|
5037
|
+
if (wasCapturing) pushCstLeaf(ctx, {
|
|
5038
|
+
_tag: "leaf",
|
|
5039
|
+
value: cstValue(ctx, input, pos, result.span.end, value),
|
|
5040
|
+
span: result.span
|
|
5041
|
+
});
|
|
5026
5042
|
return { ok: true, value, span: result.span };
|
|
5027
5043
|
}
|
|
5028
5044
|
};
|
|
5029
5045
|
}
|
|
5046
|
+
function leaf(root, fn) {
|
|
5047
|
+
return makeLeaf(root, fn, false);
|
|
5048
|
+
}
|
|
5049
|
+
function sourceLeaf(root, fn) {
|
|
5050
|
+
return makeLeaf(root, fn, true);
|
|
5051
|
+
}
|
|
5030
5052
|
|
|
5031
5053
|
// src/combinators/scanTo.ts
|
|
5032
5054
|
function resolveScanSkip(explicitSkip, raw, ctx) {
|
|
@@ -5311,7 +5333,7 @@ function evalRuleMapIR(ir) {
|
|
|
5311
5333
|
if (recognitionOnly) t._def.recognitionOnly = true;
|
|
5312
5334
|
return t;
|
|
5313
5335
|
};
|
|
5314
|
-
const _lf = (child, src) => {
|
|
5336
|
+
const _lf = (child, src, source = false) => {
|
|
5315
5337
|
let fn2;
|
|
5316
5338
|
try {
|
|
5317
5339
|
fn2 = (0, eval)(`(${src})`);
|
|
@@ -5320,7 +5342,7 @@ function evalRuleMapIR(ir) {
|
|
|
5320
5342
|
throw new Error("IR leaf fn not materialized");
|
|
5321
5343
|
};
|
|
5322
5344
|
}
|
|
5323
|
-
const l = leaf(child, fn2);
|
|
5345
|
+
const l = source ? sourceLeaf(child, fn2) : leaf(child, fn2);
|
|
5324
5346
|
l._def.fnSrc = src;
|
|
5325
5347
|
return l;
|
|
5326
5348
|
};
|