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/cli/index.js
CHANGED
|
@@ -3815,6 +3815,7 @@ function choice(...args) {
|
|
|
3815
3815
|
},
|
|
3816
3816
|
parse(input, pos, ctx) {
|
|
3817
3817
|
const expected = [];
|
|
3818
|
+
let expectedAt = pos;
|
|
3818
3819
|
if (disjoint) {
|
|
3819
3820
|
const code = pos < input.length ? input.codePointAt(pos) : -1;
|
|
3820
3821
|
let idx = code >= 0 && code < 128 ? asciiDispatch[code] : -1;
|
|
@@ -3872,7 +3873,12 @@ function choice(...args) {
|
|
|
3872
3873
|
const result = parsers[i].parse(input, pos, ctx);
|
|
3873
3874
|
if (!result.ok) {
|
|
3874
3875
|
rollbackTrivia(ctx, mark);
|
|
3875
|
-
|
|
3876
|
+
const at = result.span.start;
|
|
3877
|
+
if (at > expectedAt) {
|
|
3878
|
+
expectedAt = at;
|
|
3879
|
+
expected.length = 0;
|
|
3880
|
+
}
|
|
3881
|
+
if (at === expectedAt) expected.push(...result.expected);
|
|
3876
3882
|
if (result.committed) return { ok: false, expected, span: result.span, committed: true };
|
|
3877
3883
|
continue;
|
|
3878
3884
|
}
|
|
@@ -3883,6 +3889,9 @@ function choice(...args) {
|
|
|
3883
3889
|
}
|
|
3884
3890
|
return result;
|
|
3885
3891
|
}
|
|
3892
|
+
if (expected.length === 0) {
|
|
3893
|
+
for (const parser2 of parsers) expected.push(...deriveExpected(parser2));
|
|
3894
|
+
}
|
|
3886
3895
|
return { ok: false, expected, span: { start: pos, end: pos } };
|
|
3887
3896
|
}
|
|
3888
3897
|
};
|
|
@@ -5844,24 +5853,43 @@ function choiceNode(arms, classes, armExpected, choiceExpected) {
|
|
|
5844
5853
|
};
|
|
5845
5854
|
for (let i = arms.length - 1; i >= 0; i--) {
|
|
5846
5855
|
const arm = arms[i], cls = classes[i], staticExpected = armExpected[i], next = tail;
|
|
5847
|
-
tail = (input, pos, ctx, lead2, acc) => {
|
|
5856
|
+
tail = (input, pos, ctx, lead2, acc, best) => {
|
|
5848
5857
|
if (cls !== void 0 && !classHas(cls, lead2)) {
|
|
5849
|
-
return next(
|
|
5858
|
+
return next(
|
|
5859
|
+
input,
|
|
5860
|
+
pos,
|
|
5861
|
+
ctx,
|
|
5862
|
+
lead2,
|
|
5863
|
+
best === pos ? appendExpected(acc, staticExpected) : acc,
|
|
5864
|
+
best
|
|
5865
|
+
);
|
|
5850
5866
|
}
|
|
5851
5867
|
ctx._fc = false;
|
|
5852
5868
|
const end = arm.run(input, pos, ctx);
|
|
5853
5869
|
if (end >= 0) return end;
|
|
5854
|
-
const
|
|
5870
|
+
const at = ctx._fe ?? pos;
|
|
5871
|
+
if (at > best) {
|
|
5872
|
+
best = at;
|
|
5873
|
+
acc = void 0;
|
|
5874
|
+
}
|
|
5875
|
+
const nextAcc = at === best ? appendExpected(acc, ctx._fx) : acc;
|
|
5855
5876
|
if (committed(ctx)) {
|
|
5856
5877
|
if (nextAcc !== void 0) ctx._fx = nextAcc;
|
|
5857
5878
|
return -1;
|
|
5858
5879
|
}
|
|
5859
|
-
return next(input, pos, ctx, lead2, nextAcc);
|
|
5880
|
+
return next(input, pos, ctx, lead2, nextAcc, best);
|
|
5860
5881
|
};
|
|
5861
5882
|
}
|
|
5862
5883
|
return {
|
|
5863
5884
|
match: matchTail,
|
|
5864
|
-
run: (input, pos, ctx) => tail(
|
|
5885
|
+
run: (input, pos, ctx) => tail(
|
|
5886
|
+
input,
|
|
5887
|
+
pos,
|
|
5888
|
+
ctx,
|
|
5889
|
+
pos < input.length ? input.codePointAt(pos) : -1,
|
|
5890
|
+
void 0,
|
|
5891
|
+
pos
|
|
5892
|
+
)
|
|
5865
5893
|
};
|
|
5866
5894
|
}
|
|
5867
5895
|
function notNode(body, failure) {
|
|
@@ -9952,9 +9980,11 @@ ${catchCases}
|
|
|
9952
9980
|
ctx._fc=false
|
|
9953
9981
|
{const v=${arm}(input,pos,ctx)
|
|
9954
9982
|
if(v!==FAIL)return v}
|
|
9955
|
-
acc=${catchName}(${i},prev,acc)
|
|
9983
|
+
if(best===pos)acc=${catchName}(${i},prev,acc)
|
|
9956
9984
|
prev=${i + 1}
|
|
9957
|
-
|
|
9985
|
+
{const at=ctx._fe??pos
|
|
9986
|
+
if(at>best){best=at;acc=undefined}
|
|
9987
|
+
if(at===best)acc=_accSet(ctx._fx,acc)}
|
|
9958
9988
|
if(ctx._fc===true){if(acc!==undefined)ctx._fx=acc;return FAIL}
|
|
9959
9989
|
${emitRollback(p, L.buf, sinks)}
|
|
9960
9990
|
}`;
|
|
@@ -9963,19 +9993,22 @@ ${emitRollback(p, L.buf, sinks)}
|
|
|
9963
9993
|
ctx._fc=false
|
|
9964
9994
|
{const v=${arm}(input,pos,ctx)
|
|
9965
9995
|
if(v!==FAIL)return v}
|
|
9966
|
-
|
|
9996
|
+
{const at=ctx._fe??pos
|
|
9997
|
+
if(at>best){best=at;acc=undefined}
|
|
9998
|
+
if(at===best)acc=_accSet(ctx._fx,acc)}
|
|
9967
9999
|
if(ctx._fc===true){if(acc!==undefined)ctx._fx=acc;return FAIL}
|
|
9968
10000
|
${emitRollback(p, L.buf, sinks)}
|
|
9969
|
-
}else acc=_accSet(${expected[i]},acc)`).join("\n");
|
|
10001
|
+
}else if(best===pos)acc=_accSet(${expected[i]},acc)`).join("\n");
|
|
9970
10002
|
return `${head}
|
|
9971
10003
|
const c=lead(input,pos)
|
|
9972
10004
|
${emitMark(p, L.buf, sinks)}
|
|
9973
10005
|
let acc
|
|
10006
|
+
let best=pos
|
|
9974
10007
|
${maskable ? `if(c<128){
|
|
9975
10008
|
const bits=${maskName}[c<0?128:c]
|
|
9976
10009
|
let prev=0
|
|
9977
10010
|
${maskArms}
|
|
9978
|
-
acc=${catchName}(${n},prev,acc)
|
|
10011
|
+
if(best===pos)acc=${catchName}(${n},prev,acc)
|
|
9979
10012
|
ctx._fe=pos;ctx._fx=acc??${choiceFx}
|
|
9980
10013
|
return FAIL
|
|
9981
10014
|
}
|
|
@@ -10956,14 +10989,19 @@ function assemble(t2, prog, cfg) {
|
|
|
10956
10989
|
};
|
|
10957
10990
|
}
|
|
10958
10991
|
function maskedChoiceBlock(start, a0, a1, a2, a3, through, next, total, choiceFx) {
|
|
10959
|
-
return (input, pos, ctx, bits, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev) => {
|
|
10992
|
+
return (input, pos, ctx, bits, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev, best) => {
|
|
10960
10993
|
if ((bits & 1 << start) !== 0) {
|
|
10961
10994
|
ctx._fc = false;
|
|
10962
10995
|
const v = a0(input, pos, ctx);
|
|
10963
10996
|
if (v !== FAIL) return v;
|
|
10964
|
-
acc = through(start, prev, acc);
|
|
10997
|
+
if (best === pos) acc = through(start, prev, acc);
|
|
10965
10998
|
prev = start + 1;
|
|
10966
|
-
|
|
10999
|
+
const at = ctx._fe ?? pos;
|
|
11000
|
+
if (at > best) {
|
|
11001
|
+
best = at;
|
|
11002
|
+
acc = void 0;
|
|
11003
|
+
}
|
|
11004
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
10967
11005
|
if (committed3(ctx)) {
|
|
10968
11006
|
if (acc !== void 0) ctx._fx = acc;
|
|
10969
11007
|
return FAIL;
|
|
@@ -10974,9 +11012,14 @@ function assemble(t2, prog, cfg) {
|
|
|
10974
11012
|
ctx._fc = false;
|
|
10975
11013
|
const v = a1(input, pos, ctx);
|
|
10976
11014
|
if (v !== FAIL) return v;
|
|
10977
|
-
acc = through(start + 1, prev, acc);
|
|
11015
|
+
if (best === pos) acc = through(start + 1, prev, acc);
|
|
10978
11016
|
prev = start + 2;
|
|
10979
|
-
|
|
11017
|
+
const at = ctx._fe ?? pos;
|
|
11018
|
+
if (at > best) {
|
|
11019
|
+
best = at;
|
|
11020
|
+
acc = void 0;
|
|
11021
|
+
}
|
|
11022
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
10980
11023
|
if (committed3(ctx)) {
|
|
10981
11024
|
if (acc !== void 0) ctx._fx = acc;
|
|
10982
11025
|
return FAIL;
|
|
@@ -10987,9 +11030,14 @@ function assemble(t2, prog, cfg) {
|
|
|
10987
11030
|
ctx._fc = false;
|
|
10988
11031
|
const v = a2(input, pos, ctx);
|
|
10989
11032
|
if (v !== FAIL) return v;
|
|
10990
|
-
acc = through(start + 2, prev, acc);
|
|
11033
|
+
if (best === pos) acc = through(start + 2, prev, acc);
|
|
10991
11034
|
prev = start + 3;
|
|
10992
|
-
|
|
11035
|
+
const at = ctx._fe ?? pos;
|
|
11036
|
+
if (at > best) {
|
|
11037
|
+
best = at;
|
|
11038
|
+
acc = void 0;
|
|
11039
|
+
}
|
|
11040
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
10993
11041
|
if (committed3(ctx)) {
|
|
10994
11042
|
if (acc !== void 0) ctx._fx = acc;
|
|
10995
11043
|
return FAIL;
|
|
@@ -11000,9 +11048,14 @@ function assemble(t2, prog, cfg) {
|
|
|
11000
11048
|
ctx._fc = false;
|
|
11001
11049
|
const v = a3(input, pos, ctx);
|
|
11002
11050
|
if (v !== FAIL) return v;
|
|
11003
|
-
acc = through(start + 3, prev, acc);
|
|
11051
|
+
if (best === pos) acc = through(start + 3, prev, acc);
|
|
11004
11052
|
prev = start + 4;
|
|
11005
|
-
|
|
11053
|
+
const at = ctx._fe ?? pos;
|
|
11054
|
+
if (at > best) {
|
|
11055
|
+
best = at;
|
|
11056
|
+
acc = void 0;
|
|
11057
|
+
}
|
|
11058
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
11006
11059
|
if (committed3(ctx)) {
|
|
11007
11060
|
if (acc !== void 0) ctx._fx = acc;
|
|
11008
11061
|
return FAIL;
|
|
@@ -11010,23 +11063,28 @@ function assemble(t2, prog, cfg) {
|
|
|
11010
11063
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
11011
11064
|
}
|
|
11012
11065
|
if (next !== void 0) {
|
|
11013
|
-
return next(input, pos, ctx, bits, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev);
|
|
11066
|
+
return next(input, pos, ctx, bits, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev, best);
|
|
11014
11067
|
}
|
|
11015
|
-
acc = through(total, prev, acc);
|
|
11068
|
+
if (best === pos) acc = through(total, prev, acc);
|
|
11016
11069
|
ctx._fe = pos;
|
|
11017
11070
|
ctx._fx = acc ?? choiceFx;
|
|
11018
11071
|
return FAIL;
|
|
11019
11072
|
};
|
|
11020
11073
|
}
|
|
11021
11074
|
function generalChoiceBlock(start, a0, a1, a2, a3, g0, g1, g2, g3, through, next, total, choiceFx) {
|
|
11022
|
-
return (input, pos, ctx, c, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev) => {
|
|
11075
|
+
return (input, pos, ctx, c, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev, best) => {
|
|
11023
11076
|
if (g0 === null || classHas2(g0, c)) {
|
|
11024
11077
|
ctx._fc = false;
|
|
11025
11078
|
const v = a0(input, pos, ctx);
|
|
11026
11079
|
if (v !== FAIL) return v;
|
|
11027
|
-
acc = through(start, prev, acc);
|
|
11080
|
+
if (best === pos) acc = through(start, prev, acc);
|
|
11028
11081
|
prev = start + 1;
|
|
11029
|
-
|
|
11082
|
+
const at = ctx._fe ?? pos;
|
|
11083
|
+
if (at > best) {
|
|
11084
|
+
best = at;
|
|
11085
|
+
acc = void 0;
|
|
11086
|
+
}
|
|
11087
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
11030
11088
|
if (committed3(ctx)) {
|
|
11031
11089
|
if (acc !== void 0) ctx._fx = acc;
|
|
11032
11090
|
return FAIL;
|
|
@@ -11037,9 +11095,14 @@ function assemble(t2, prog, cfg) {
|
|
|
11037
11095
|
ctx._fc = false;
|
|
11038
11096
|
const v = a1(input, pos, ctx);
|
|
11039
11097
|
if (v !== FAIL) return v;
|
|
11040
|
-
acc = through(start + 1, prev, acc);
|
|
11098
|
+
if (best === pos) acc = through(start + 1, prev, acc);
|
|
11041
11099
|
prev = start + 2;
|
|
11042
|
-
|
|
11100
|
+
const at = ctx._fe ?? pos;
|
|
11101
|
+
if (at > best) {
|
|
11102
|
+
best = at;
|
|
11103
|
+
acc = void 0;
|
|
11104
|
+
}
|
|
11105
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
11043
11106
|
if (committed3(ctx)) {
|
|
11044
11107
|
if (acc !== void 0) ctx._fx = acc;
|
|
11045
11108
|
return FAIL;
|
|
@@ -11050,9 +11113,14 @@ function assemble(t2, prog, cfg) {
|
|
|
11050
11113
|
ctx._fc = false;
|
|
11051
11114
|
const v = a2(input, pos, ctx);
|
|
11052
11115
|
if (v !== FAIL) return v;
|
|
11053
|
-
acc = through(start + 2, prev, acc);
|
|
11116
|
+
if (best === pos) acc = through(start + 2, prev, acc);
|
|
11054
11117
|
prev = start + 3;
|
|
11055
|
-
|
|
11118
|
+
const at = ctx._fe ?? pos;
|
|
11119
|
+
if (at > best) {
|
|
11120
|
+
best = at;
|
|
11121
|
+
acc = void 0;
|
|
11122
|
+
}
|
|
11123
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
11056
11124
|
if (committed3(ctx)) {
|
|
11057
11125
|
if (acc !== void 0) ctx._fx = acc;
|
|
11058
11126
|
return FAIL;
|
|
@@ -11063,9 +11131,14 @@ function assemble(t2, prog, cfg) {
|
|
|
11063
11131
|
ctx._fc = false;
|
|
11064
11132
|
const v = a3(input, pos, ctx);
|
|
11065
11133
|
if (v !== FAIL) return v;
|
|
11066
|
-
acc = through(start + 3, prev, acc);
|
|
11134
|
+
if (best === pos) acc = through(start + 3, prev, acc);
|
|
11067
11135
|
prev = start + 4;
|
|
11068
|
-
|
|
11136
|
+
const at = ctx._fe ?? pos;
|
|
11137
|
+
if (at > best) {
|
|
11138
|
+
best = at;
|
|
11139
|
+
acc = void 0;
|
|
11140
|
+
}
|
|
11141
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
11069
11142
|
if (committed3(ctx)) {
|
|
11070
11143
|
if (acc !== void 0) ctx._fx = acc;
|
|
11071
11144
|
return FAIL;
|
|
@@ -11073,9 +11146,9 @@ function assemble(t2, prog, cfg) {
|
|
|
11073
11146
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
11074
11147
|
}
|
|
11075
11148
|
if (next !== void 0) {
|
|
11076
|
-
return next(input, pos, ctx, c, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev);
|
|
11149
|
+
return next(input, pos, ctx, c, need, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot, acc, prev, best);
|
|
11077
11150
|
}
|
|
11078
|
-
acc = through(total, prev, acc);
|
|
11151
|
+
if (best === pos) acc = through(total, prev, acc);
|
|
11079
11152
|
ctx._fe = pos;
|
|
11080
11153
|
ctx._fx = acc ?? choiceFx;
|
|
11081
11154
|
return FAIL;
|
|
@@ -12431,6 +12504,7 @@ function assemble(t2, prog, cfg) {
|
|
|
12431
12504
|
const mLog = need ? ctx._triviaLog?.length ?? 0 : 0;
|
|
12432
12505
|
const mRoot = need ? ctx._rootTriviaLog?.length ?? 0 : 0;
|
|
12433
12506
|
let acc;
|
|
12507
|
+
let best = pos;
|
|
12434
12508
|
if (c < 128) {
|
|
12435
12509
|
const bits = mask[c < 0 ? 128 : c];
|
|
12436
12510
|
let prev = 0;
|
|
@@ -12439,7 +12513,12 @@ function assemble(t2, prog, cfg) {
|
|
|
12439
12513
|
const v = a0(input, pos, ctx);
|
|
12440
12514
|
if (v !== FAIL) return v;
|
|
12441
12515
|
prev = 1;
|
|
12442
|
-
|
|
12516
|
+
const at = ctx._fe ?? pos;
|
|
12517
|
+
if (at > best) {
|
|
12518
|
+
best = at;
|
|
12519
|
+
acc = void 0;
|
|
12520
|
+
}
|
|
12521
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12443
12522
|
if (committed3(ctx)) {
|
|
12444
12523
|
if (acc !== void 0) ctx._fx = acc;
|
|
12445
12524
|
return FAIL;
|
|
@@ -12450,9 +12529,14 @@ function assemble(t2, prog, cfg) {
|
|
|
12450
12529
|
ctx._fc = false;
|
|
12451
12530
|
const v = a1(input, pos, ctx);
|
|
12452
12531
|
if (v !== FAIL) return v;
|
|
12453
|
-
if (prev < 1) acc = accSet(e0, acc);
|
|
12532
|
+
if (best === pos && prev < 1) acc = accSet(e0, acc);
|
|
12454
12533
|
prev = 2;
|
|
12455
|
-
|
|
12534
|
+
const at = ctx._fe ?? pos;
|
|
12535
|
+
if (at > best) {
|
|
12536
|
+
best = at;
|
|
12537
|
+
acc = void 0;
|
|
12538
|
+
}
|
|
12539
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12456
12540
|
if (committed3(ctx)) {
|
|
12457
12541
|
if (acc !== void 0) ctx._fx = acc;
|
|
12458
12542
|
return FAIL;
|
|
@@ -12463,19 +12547,24 @@ function assemble(t2, prog, cfg) {
|
|
|
12463
12547
|
ctx._fc = false;
|
|
12464
12548
|
const v = a2(input, pos, ctx);
|
|
12465
12549
|
if (v !== FAIL) return v;
|
|
12466
|
-
if (prev < 1) acc = accSet(e0, acc);
|
|
12467
|
-
if (prev < 2) acc = accSet(e1, acc);
|
|
12550
|
+
if (best === pos && prev < 1) acc = accSet(e0, acc);
|
|
12551
|
+
if (best === pos && prev < 2) acc = accSet(e1, acc);
|
|
12468
12552
|
prev = 3;
|
|
12469
|
-
|
|
12553
|
+
const at = ctx._fe ?? pos;
|
|
12554
|
+
if (at > best) {
|
|
12555
|
+
best = at;
|
|
12556
|
+
acc = void 0;
|
|
12557
|
+
}
|
|
12558
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12470
12559
|
if (committed3(ctx)) {
|
|
12471
12560
|
if (acc !== void 0) ctx._fx = acc;
|
|
12472
12561
|
return FAIL;
|
|
12473
12562
|
}
|
|
12474
12563
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
12475
12564
|
}
|
|
12476
|
-
if (prev < 1) acc = accSet(e0, acc);
|
|
12477
|
-
if (prev < 2) acc = accSet(e1, acc);
|
|
12478
|
-
if (n === 3 && prev < 3) acc = accSet(e2, acc);
|
|
12565
|
+
if (best === pos && prev < 1) acc = accSet(e0, acc);
|
|
12566
|
+
if (best === pos && prev < 2) acc = accSet(e1, acc);
|
|
12567
|
+
if (best === pos && n === 3 && prev < 3) acc = accSet(e2, acc);
|
|
12479
12568
|
ctx._fe = pos;
|
|
12480
12569
|
ctx._fx = acc ?? choiceFx;
|
|
12481
12570
|
return FAIL;
|
|
@@ -12484,36 +12573,51 @@ function assemble(t2, prog, cfg) {
|
|
|
12484
12573
|
ctx._fc = false;
|
|
12485
12574
|
const v = a0(input, pos, ctx);
|
|
12486
12575
|
if (v !== FAIL) return v;
|
|
12487
|
-
|
|
12576
|
+
const at = ctx._fe ?? pos;
|
|
12577
|
+
if (at > best) {
|
|
12578
|
+
best = at;
|
|
12579
|
+
acc = void 0;
|
|
12580
|
+
}
|
|
12581
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12488
12582
|
if (committed3(ctx)) {
|
|
12489
12583
|
if (acc !== void 0) ctx._fx = acc;
|
|
12490
12584
|
return FAIL;
|
|
12491
12585
|
}
|
|
12492
12586
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
12493
|
-
} else acc = accSet(e0, acc);
|
|
12587
|
+
} else if (best === pos) acc = accSet(e0, acc);
|
|
12494
12588
|
if (g1 === null || classHas2(g1, c)) {
|
|
12495
12589
|
ctx._fc = false;
|
|
12496
12590
|
const v = a1(input, pos, ctx);
|
|
12497
12591
|
if (v !== FAIL) return v;
|
|
12498
|
-
|
|
12592
|
+
const at = ctx._fe ?? pos;
|
|
12593
|
+
if (at > best) {
|
|
12594
|
+
best = at;
|
|
12595
|
+
acc = void 0;
|
|
12596
|
+
}
|
|
12597
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12499
12598
|
if (committed3(ctx)) {
|
|
12500
12599
|
if (acc !== void 0) ctx._fx = acc;
|
|
12501
12600
|
return FAIL;
|
|
12502
12601
|
}
|
|
12503
12602
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
12504
|
-
} else acc = accSet(e1, acc);
|
|
12603
|
+
} else if (best === pos) acc = accSet(e1, acc);
|
|
12505
12604
|
if (n === 3) {
|
|
12506
12605
|
if (g2 === null || classHas2(g2, c)) {
|
|
12507
12606
|
ctx._fc = false;
|
|
12508
12607
|
const v = a2(input, pos, ctx);
|
|
12509
12608
|
if (v !== FAIL) return v;
|
|
12510
|
-
|
|
12609
|
+
const at = ctx._fe ?? pos;
|
|
12610
|
+
if (at > best) {
|
|
12611
|
+
best = at;
|
|
12612
|
+
acc = void 0;
|
|
12613
|
+
}
|
|
12614
|
+
if (at === best) acc = accSet(ctx._fx, acc);
|
|
12511
12615
|
if (committed3(ctx)) {
|
|
12512
12616
|
if (acc !== void 0) ctx._fx = acc;
|
|
12513
12617
|
return FAIL;
|
|
12514
12618
|
}
|
|
12515
12619
|
if (need) rollbackTriviaAt(ctx, mRaw, mTl, mLv, mFl, mEr, mLog, mRoot);
|
|
12516
|
-
} else acc = accSet(e2, acc);
|
|
12620
|
+
} else if (best === pos) acc = accSet(e2, acc);
|
|
12517
12621
|
}
|
|
12518
12622
|
ctx._fe = pos;
|
|
12519
12623
|
ctx._fx = acc ?? choiceFx;
|
|
@@ -12611,7 +12715,8 @@ function assemble(t2, prog, cfg) {
|
|
|
12611
12715
|
mLog,
|
|
12612
12716
|
mRoot,
|
|
12613
12717
|
void 0,
|
|
12614
|
-
0
|
|
12718
|
+
0,
|
|
12719
|
+
pos
|
|
12615
12720
|
);
|
|
12616
12721
|
}
|
|
12617
12722
|
return general(
|
|
@@ -12628,7 +12733,8 @@ function assemble(t2, prog, cfg) {
|
|
|
12628
12733
|
mLog,
|
|
12629
12734
|
mRoot,
|
|
12630
12735
|
void 0,
|
|
12631
|
-
0
|
|
12736
|
+
0,
|
|
12737
|
+
pos
|
|
12632
12738
|
);
|
|
12633
12739
|
};
|
|
12634
12740
|
}
|
|
@@ -12656,7 +12762,8 @@ function assemble(t2, prog, cfg) {
|
|
|
12656
12762
|
mLog,
|
|
12657
12763
|
mRoot,
|
|
12658
12764
|
void 0,
|
|
12659
|
-
0
|
|
12765
|
+
0,
|
|
12766
|
+
pos
|
|
12660
12767
|
);
|
|
12661
12768
|
};
|
|
12662
12769
|
}
|