@optique/core 1.0.0-dev.1707 → 1.0.0-dev.1711
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/constructs.cjs +24 -24
- package/dist/constructs.js +24 -24
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -517,10 +517,13 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
517
517
|
const emptyCtx = {
|
|
518
518
|
buffer: [],
|
|
519
519
|
optionsTerminated: false,
|
|
520
|
-
usage: []
|
|
520
|
+
usage: [],
|
|
521
|
+
exec,
|
|
522
|
+
dependencyRegistry: exec?.dependencyRegistry
|
|
521
523
|
};
|
|
522
524
|
let candidateIndex = -1;
|
|
523
525
|
let candidateCount = 0;
|
|
526
|
+
let candidateParseResult;
|
|
524
527
|
for (let i$1 = 0; i$1 < syncParsers.length; i$1++) {
|
|
525
528
|
const p = syncParsers[i$1];
|
|
526
529
|
if (p.leadingNames.size > 0 || p.acceptingAnyToken) continue;
|
|
@@ -530,19 +533,16 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
530
533
|
});
|
|
531
534
|
if (!parseResult.success || parseResult.provisional) continue;
|
|
532
535
|
candidateCount++;
|
|
533
|
-
if (candidateIndex < 0)
|
|
536
|
+
if (candidateIndex < 0) {
|
|
537
|
+
candidateIndex = i$1;
|
|
538
|
+
candidateParseResult = parseResult;
|
|
539
|
+
}
|
|
534
540
|
if (candidateCount > 1) break;
|
|
535
541
|
}
|
|
536
|
-
if (candidateCount === 1 && candidateIndex >= 0) {
|
|
542
|
+
if (candidateCount === 1 && candidateIndex >= 0 && candidateParseResult) {
|
|
537
543
|
const p = syncParsers[candidateIndex];
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
state: getAnnotatedChildState(state, p.initialState, p)
|
|
541
|
-
});
|
|
542
|
-
if (parseResult.success) {
|
|
543
|
-
const annotatedState = getAnnotatedChildState(state, parseResult.next.state, p);
|
|
544
|
-
return p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
545
|
-
}
|
|
544
|
+
const annotatedState = getAnnotatedChildState(state, candidateParseResult.next.state, p);
|
|
545
|
+
return p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
546
546
|
}
|
|
547
547
|
return {
|
|
548
548
|
success: false,
|
|
@@ -552,10 +552,13 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
552
552
|
const emptyCtx = {
|
|
553
553
|
buffer: [],
|
|
554
554
|
optionsTerminated: false,
|
|
555
|
-
usage: []
|
|
555
|
+
usage: [],
|
|
556
|
+
exec,
|
|
557
|
+
dependencyRegistry: exec?.dependencyRegistry
|
|
556
558
|
};
|
|
557
559
|
let candidateIndex = -1;
|
|
558
560
|
let candidateCount = 0;
|
|
561
|
+
let candidateParseResult;
|
|
559
562
|
for (let i$1 = 0; i$1 < parsers.length; i$1++) {
|
|
560
563
|
const p = parsers[i$1];
|
|
561
564
|
if (p.leadingNames.size > 0 || p.acceptingAnyToken) continue;
|
|
@@ -565,19 +568,16 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
565
568
|
});
|
|
566
569
|
if (!parseResult.success || parseResult.provisional) continue;
|
|
567
570
|
candidateCount++;
|
|
568
|
-
if (candidateIndex < 0)
|
|
571
|
+
if (candidateIndex < 0) {
|
|
572
|
+
candidateIndex = i$1;
|
|
573
|
+
candidateParseResult = parseResult;
|
|
574
|
+
}
|
|
569
575
|
if (candidateCount > 1) break;
|
|
570
576
|
}
|
|
571
|
-
if (candidateCount === 1 && candidateIndex >= 0 && (parsers[candidateIndex].$mode === "sync" || exec?.phase !== "parse" && exec?.phase !== "suggest")) {
|
|
577
|
+
if (candidateCount === 1 && candidateIndex >= 0 && candidateParseResult && (parsers[candidateIndex].$mode === "sync" || exec?.phase !== "parse" && exec?.phase !== "suggest")) {
|
|
572
578
|
const p = parsers[candidateIndex];
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
state: getAnnotatedChildState(state, p.initialState, p)
|
|
576
|
-
});
|
|
577
|
-
if (parseResult.success) {
|
|
578
|
-
const annotatedState = getAnnotatedChildState(state, parseResult.next.state, p);
|
|
579
|
-
return await p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
580
|
-
}
|
|
579
|
+
const annotatedState = getAnnotatedChildState(state, candidateParseResult.next.state, p);
|
|
580
|
+
return await p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
581
581
|
}
|
|
582
582
|
return {
|
|
583
583
|
success: false,
|
|
@@ -3768,7 +3768,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3768
3768
|
});
|
|
3769
3769
|
if (branchParseResult.success) {
|
|
3770
3770
|
const mergedExec = mergeChildExec(discriminatorExec, branchParseResult.next.exec);
|
|
3771
|
-
const isProvisional = branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && branchParser.leadingNames.size > 0;
|
|
3771
|
+
const isProvisional = branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && (branchParser.leadingNames.size > 0 || branchParser.acceptingAnyToken);
|
|
3772
3772
|
return {
|
|
3773
3773
|
success: true,
|
|
3774
3774
|
...isProvisional ? { provisional: true } : {},
|
|
@@ -3947,7 +3947,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3947
3947
|
const mergedExec = mergeChildExec(discriminatorExec, branchParseResult.next.exec);
|
|
3948
3948
|
return {
|
|
3949
3949
|
success: true,
|
|
3950
|
-
...branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && branchParser.leadingNames.size > 0 ? { provisional: true } : {},
|
|
3950
|
+
...branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && (branchParser.leadingNames.size > 0 || branchParser.acceptingAnyToken) ? { provisional: true } : {},
|
|
3951
3951
|
next: {
|
|
3952
3952
|
...branchParseResult.next,
|
|
3953
3953
|
state: {
|
package/dist/constructs.js
CHANGED
|
@@ -517,10 +517,13 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
517
517
|
const emptyCtx = {
|
|
518
518
|
buffer: [],
|
|
519
519
|
optionsTerminated: false,
|
|
520
|
-
usage: []
|
|
520
|
+
usage: [],
|
|
521
|
+
exec,
|
|
522
|
+
dependencyRegistry: exec?.dependencyRegistry
|
|
521
523
|
};
|
|
522
524
|
let candidateIndex = -1;
|
|
523
525
|
let candidateCount = 0;
|
|
526
|
+
let candidateParseResult;
|
|
524
527
|
for (let i$1 = 0; i$1 < syncParsers.length; i$1++) {
|
|
525
528
|
const p = syncParsers[i$1];
|
|
526
529
|
if (p.leadingNames.size > 0 || p.acceptingAnyToken) continue;
|
|
@@ -530,19 +533,16 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
530
533
|
});
|
|
531
534
|
if (!parseResult.success || parseResult.provisional) continue;
|
|
532
535
|
candidateCount++;
|
|
533
|
-
if (candidateIndex < 0)
|
|
536
|
+
if (candidateIndex < 0) {
|
|
537
|
+
candidateIndex = i$1;
|
|
538
|
+
candidateParseResult = parseResult;
|
|
539
|
+
}
|
|
534
540
|
if (candidateCount > 1) break;
|
|
535
541
|
}
|
|
536
|
-
if (candidateCount === 1 && candidateIndex >= 0) {
|
|
542
|
+
if (candidateCount === 1 && candidateIndex >= 0 && candidateParseResult) {
|
|
537
543
|
const p = syncParsers[candidateIndex];
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
state: getAnnotatedChildState(state, p.initialState, p)
|
|
541
|
-
});
|
|
542
|
-
if (parseResult.success) {
|
|
543
|
-
const annotatedState = getAnnotatedChildState(state, parseResult.next.state, p);
|
|
544
|
-
return p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
545
|
-
}
|
|
544
|
+
const annotatedState = getAnnotatedChildState(state, candidateParseResult.next.state, p);
|
|
545
|
+
return p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
546
546
|
}
|
|
547
547
|
return {
|
|
548
548
|
success: false,
|
|
@@ -552,10 +552,13 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
552
552
|
const emptyCtx = {
|
|
553
553
|
buffer: [],
|
|
554
554
|
optionsTerminated: false,
|
|
555
|
-
usage: []
|
|
555
|
+
usage: [],
|
|
556
|
+
exec,
|
|
557
|
+
dependencyRegistry: exec?.dependencyRegistry
|
|
556
558
|
};
|
|
557
559
|
let candidateIndex = -1;
|
|
558
560
|
let candidateCount = 0;
|
|
561
|
+
let candidateParseResult;
|
|
559
562
|
for (let i$1 = 0; i$1 < parsers.length; i$1++) {
|
|
560
563
|
const p = parsers[i$1];
|
|
561
564
|
if (p.leadingNames.size > 0 || p.acceptingAnyToken) continue;
|
|
@@ -565,19 +568,16 @@ function createExclusiveComplete(parsers, options, noMatchContext, mode) {
|
|
|
565
568
|
});
|
|
566
569
|
if (!parseResult.success || parseResult.provisional) continue;
|
|
567
570
|
candidateCount++;
|
|
568
|
-
if (candidateIndex < 0)
|
|
571
|
+
if (candidateIndex < 0) {
|
|
572
|
+
candidateIndex = i$1;
|
|
573
|
+
candidateParseResult = parseResult;
|
|
574
|
+
}
|
|
569
575
|
if (candidateCount > 1) break;
|
|
570
576
|
}
|
|
571
|
-
if (candidateCount === 1 && candidateIndex >= 0 && (parsers[candidateIndex].$mode === "sync" || exec?.phase !== "parse" && exec?.phase !== "suggest")) {
|
|
577
|
+
if (candidateCount === 1 && candidateIndex >= 0 && candidateParseResult && (parsers[candidateIndex].$mode === "sync" || exec?.phase !== "parse" && exec?.phase !== "suggest")) {
|
|
572
578
|
const p = parsers[candidateIndex];
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
state: getAnnotatedChildState(state, p.initialState, p)
|
|
576
|
-
});
|
|
577
|
-
if (parseResult.success) {
|
|
578
|
-
const annotatedState = getAnnotatedChildState(state, parseResult.next.state, p);
|
|
579
|
-
return await p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
580
|
-
}
|
|
579
|
+
const annotatedState = getAnnotatedChildState(state, candidateParseResult.next.state, p);
|
|
580
|
+
return await p.complete(annotatedState, withChildExecPath(exec, candidateIndex));
|
|
581
581
|
}
|
|
582
582
|
return {
|
|
583
583
|
success: false,
|
|
@@ -3768,7 +3768,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3768
3768
|
});
|
|
3769
3769
|
if (branchParseResult.success) {
|
|
3770
3770
|
const mergedExec = mergeChildExec(discriminatorExec, branchParseResult.next.exec);
|
|
3771
|
-
const isProvisional = branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && branchParser.leadingNames.size > 0;
|
|
3771
|
+
const isProvisional = branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && (branchParser.leadingNames.size > 0 || branchParser.acceptingAnyToken);
|
|
3772
3772
|
return {
|
|
3773
3773
|
success: true,
|
|
3774
3774
|
...isProvisional ? { provisional: true } : {},
|
|
@@ -3947,7 +3947,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
3947
3947
|
const mergedExec = mergeChildExec(discriminatorExec, branchParseResult.next.exec);
|
|
3948
3948
|
return {
|
|
3949
3949
|
success: true,
|
|
3950
|
-
...branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && branchParser.leadingNames.size > 0 ? { provisional: true } : {},
|
|
3950
|
+
...branchParseResult.provisional || discriminatorResult.consumed.length === 0 && branchParseResult.consumed.length === 0 && (branchParser.leadingNames.size > 0 || branchParser.acceptingAnyToken) ? { provisional: true } : {},
|
|
3951
3951
|
next: {
|
|
3952
3952
|
...branchParseResult.next,
|
|
3953
3953
|
state: {
|