@optique/core 1.3.1 → 1.3.3
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 +260 -40
- package/dist/constructs.js +260 -40
- package/dist/doc.cjs +11 -3
- package/dist/doc.js +12 -4
- package/dist/extension.cjs +17 -0
- package/dist/extension.d.cts +13 -1
- package/dist/extension.d.ts +13 -1
- package/dist/extension.js +17 -1
- package/dist/internal/passthrough.cjs +230 -0
- package/dist/internal/passthrough.js +213 -0
- package/dist/message.cjs +32 -5
- package/dist/message.js +33 -6
- package/dist/modifiers.cjs +22 -0
- package/dist/modifiers.js +22 -0
- package/dist/primitives.cjs +45 -9
- package/dist/primitives.js +45 -9
- package/dist/suggestion.cjs +3 -1
- package/dist/suggestion.js +3 -1
- package/dist/terminal-internal.cjs +4 -1
- package/dist/terminal-internal.d.cts +5 -0
- package/dist/terminal-internal.d.ts +5 -0
- package/dist/terminal-internal.js +4 -1
- package/dist/terminal-separators.cjs +13 -0
- package/dist/terminal-separators.js +12 -0
- package/dist/terminal.cjs +4 -1
- package/dist/terminal.js +5 -1
- package/dist/text-layout.cjs +14 -1
- package/dist/text-layout.d.cts +8 -1
- package/dist/text-layout.d.ts +8 -1
- package/dist/text-layout.js +13 -1
- package/package.json +2 -2
package/dist/constructs.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const require_internal_dependency = require('./internal/dependency.cjs');
|
|
|
8
8
|
const require_dependency_runtime = require('./dependency-runtime.cjs');
|
|
9
9
|
const require_internal_parser = require('./internal/parser.cjs');
|
|
10
10
|
const require_annotation_state = require('./annotation-state.cjs');
|
|
11
|
+
const require_passthrough = require('./internal/passthrough.cjs');
|
|
11
12
|
const require_command_alias = require('./internal/command-alias.cjs');
|
|
12
13
|
const require_execution_context = require('./execution-context.cjs');
|
|
13
14
|
const require_phase2_seed = require('./phase2-seed.cjs');
|
|
@@ -603,6 +604,63 @@ function sharedBufferLeadingNames(parsers) {
|
|
|
603
604
|
return names.size === 0 ? EMPTY_LEADING_NAMES : names;
|
|
604
605
|
}
|
|
605
606
|
/**
|
|
607
|
+
* Defers capture until a known option at an equal or higher lane priority
|
|
608
|
+
* has been tried.
|
|
609
|
+
* Other siblings retain their relative order, and explicit priorities win.
|
|
610
|
+
*/
|
|
611
|
+
function orderBeforePassThrough(pairs, context, getParser, getState, passThroughParsers) {
|
|
612
|
+
const token = context.buffer[0];
|
|
613
|
+
if (passThroughParsers.size === 0 || context.optionsTerminated || token == null || token === "--" || !/^[-/+]/.test(token)) return pairs;
|
|
614
|
+
const matches = new Map(pairs.map((pair) => [pair, require_passthrough.getOptionMatch(getParser(pair), getState(pair), token)]));
|
|
615
|
+
const normalizedOptions = /* @__PURE__ */ new Map();
|
|
616
|
+
const captures = new Map(pairs.flatMap((pair) => {
|
|
617
|
+
if (!passThroughParsers.has(getParser(pair))) return [];
|
|
618
|
+
const priority = require_passthrough.getPassThroughPriority(getParser(pair), getState(pair), token);
|
|
619
|
+
const match = matches.get(pair);
|
|
620
|
+
if (match != null && (priority == null || match.priority >= priority)) {
|
|
621
|
+
const unfiltered = require_passthrough.getPassThroughPriority(getParser(pair), getState(pair));
|
|
622
|
+
if (priority == null || unfiltered != null && unfiltered > match.priority) normalizedOptions.set(pair, match.priority);
|
|
623
|
+
return [];
|
|
624
|
+
}
|
|
625
|
+
return priority == null ? [] : [[pair, priority]];
|
|
626
|
+
}));
|
|
627
|
+
const matching = pairs.filter((pair) => !captures.has(pair)).flatMap((pair) => {
|
|
628
|
+
const match = matches.get(pair);
|
|
629
|
+
return match == null ? [] : [match];
|
|
630
|
+
});
|
|
631
|
+
const orderedCaptures = [...captures].sort((a, b) => b[1] - a[1]);
|
|
632
|
+
if (matching.length === 0) {
|
|
633
|
+
let captureIndex = 0;
|
|
634
|
+
return pairs.map((pair) => captures.has(pair) ? orderedCaptures[captureIndex++][0] : pair);
|
|
635
|
+
}
|
|
636
|
+
const matchingPriority = Math.max(...matching.map((match) => match.priority));
|
|
637
|
+
const ordinary = pairs.filter((pair) => !captures.has(pair) && !normalizedOptions.has(pair));
|
|
638
|
+
const positions = new Map(pairs.map((pair, index) => [pair, index]));
|
|
639
|
+
for (const [pair, priority] of [...normalizedOptions].sort((a, b) => b[1] - a[1])) {
|
|
640
|
+
let insertion = ordinary.findIndex((candidate) => {
|
|
641
|
+
const match = matches.get(candidate);
|
|
642
|
+
return match != null && (match.priority < priority || match.priority === priority && positions.get(pair) < positions.get(candidate));
|
|
643
|
+
});
|
|
644
|
+
if (insertion < 0) {
|
|
645
|
+
const lastMatch = ordinary.findLastIndex((candidate) => matches.get(candidate) != null);
|
|
646
|
+
insertion = lastMatch >= 0 ? lastMatch + 1 : ordinary.findIndex((candidate) => positions.get(candidate) > positions.get(pair));
|
|
647
|
+
if (insertion < 0) insertion = ordinary.length;
|
|
648
|
+
}
|
|
649
|
+
ordinary.splice(insertion, 0, pair);
|
|
650
|
+
}
|
|
651
|
+
const first = ordinary.findIndex((pair) => matches.get(pair) != null);
|
|
652
|
+
const last = ordinary.findLastIndex((pair) => matches.get(pair) != null);
|
|
653
|
+
const before = orderedCaptures.filter(([, priority]) => priority > matchingPriority).map(([pair]) => pair);
|
|
654
|
+
const after = orderedCaptures.filter(([, priority]) => priority <= matchingPriority).map(([pair]) => pair);
|
|
655
|
+
return [
|
|
656
|
+
...ordinary.slice(0, first),
|
|
657
|
+
...before,
|
|
658
|
+
...ordinary.slice(first, last + 1),
|
|
659
|
+
...after,
|
|
660
|
+
...ordinary.slice(last + 1)
|
|
661
|
+
];
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
606
664
|
* Internal symbol for exposing field-level parser pairs from `object()`
|
|
607
665
|
* and `merge()` parsers. This allows `merge()` to pre-complete dependency
|
|
608
666
|
* source fields from child parsers before resolving deferred states.
|
|
@@ -1104,6 +1162,7 @@ function preserveExclusiveStateAfterOptionsTerminator(context, result) {
|
|
|
1104
1162
|
success: true,
|
|
1105
1163
|
next: {
|
|
1106
1164
|
...context,
|
|
1165
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
1107
1166
|
buffer: result.next.buffer,
|
|
1108
1167
|
optionsTerminated: true,
|
|
1109
1168
|
state: context.state,
|
|
@@ -1438,6 +1497,7 @@ function or(...args) {
|
|
|
1438
1497
|
success: true,
|
|
1439
1498
|
next: {
|
|
1440
1499
|
...context,
|
|
1500
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
1441
1501
|
buffer: result.next.buffer,
|
|
1442
1502
|
optionsTerminated: result.next.optionsTerminated,
|
|
1443
1503
|
state: createExclusiveState(context.state, i, parser, result),
|
|
@@ -1474,6 +1534,7 @@ function or(...args) {
|
|
|
1474
1534
|
success: true,
|
|
1475
1535
|
next: {
|
|
1476
1536
|
...context,
|
|
1537
|
+
...require_passthrough.getPassThroughFailureHint(replayedResult.next),
|
|
1477
1538
|
buffer: replayedResult.next.buffer,
|
|
1478
1539
|
optionsTerminated: replayedResult.next.optionsTerminated,
|
|
1479
1540
|
state: createExclusiveState(context.state, i, parser, {
|
|
@@ -1493,6 +1554,7 @@ function or(...args) {
|
|
|
1493
1554
|
success: true,
|
|
1494
1555
|
next: {
|
|
1495
1556
|
...context,
|
|
1557
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
1496
1558
|
buffer: result.next.buffer,
|
|
1497
1559
|
optionsTerminated: result.next.optionsTerminated,
|
|
1498
1560
|
state: createExclusiveState(context.state, i, parser, result),
|
|
@@ -1537,6 +1599,7 @@ function or(...args) {
|
|
|
1537
1599
|
provisional: true,
|
|
1538
1600
|
next: {
|
|
1539
1601
|
...context,
|
|
1602
|
+
...require_passthrough.getPassThroughFailureHint(provisionalConsuming.result.next),
|
|
1540
1603
|
buffer: provisionalConsuming.result.next.buffer,
|
|
1541
1604
|
optionsTerminated: provisionalConsuming.result.next.optionsTerminated,
|
|
1542
1605
|
state: createExclusiveState(context.state, provisionalConsuming.index, provisionalConsuming.parser, provisionalConsuming.result),
|
|
@@ -1571,6 +1634,7 @@ function or(...args) {
|
|
|
1571
1634
|
provisional: true,
|
|
1572
1635
|
next: {
|
|
1573
1636
|
...context,
|
|
1637
|
+
...require_passthrough.getPassThroughFailureHint(replayedResult.next),
|
|
1574
1638
|
buffer: replayedResult.next.buffer,
|
|
1575
1639
|
optionsTerminated: replayedResult.next.optionsTerminated,
|
|
1576
1640
|
state: createExclusiveState(context.state, provisionalConsuming.index, provisionalConsuming.parser, {
|
|
@@ -1642,6 +1706,7 @@ function or(...args) {
|
|
|
1642
1706
|
success: true,
|
|
1643
1707
|
next: {
|
|
1644
1708
|
...context,
|
|
1709
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
1645
1710
|
buffer: result.next.buffer,
|
|
1646
1711
|
optionsTerminated: result.next.optionsTerminated,
|
|
1647
1712
|
state: createExclusiveState(context.state, i, parser, result),
|
|
@@ -1680,6 +1745,7 @@ function or(...args) {
|
|
|
1680
1745
|
success: true,
|
|
1681
1746
|
next: {
|
|
1682
1747
|
...context,
|
|
1748
|
+
...require_passthrough.getPassThroughFailureHint(replayedResult.next),
|
|
1683
1749
|
buffer: replayedResult.next.buffer,
|
|
1684
1750
|
optionsTerminated: replayedResult.next.optionsTerminated,
|
|
1685
1751
|
state: createExclusiveState(context.state, i, parser, {
|
|
@@ -1699,6 +1765,7 @@ function or(...args) {
|
|
|
1699
1765
|
success: true,
|
|
1700
1766
|
next: {
|
|
1701
1767
|
...context,
|
|
1768
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
1702
1769
|
buffer: result.next.buffer,
|
|
1703
1770
|
optionsTerminated: result.next.optionsTerminated,
|
|
1704
1771
|
state: createExclusiveState(context.state, i, parser, result),
|
|
@@ -1743,6 +1810,7 @@ function or(...args) {
|
|
|
1743
1810
|
provisional: true,
|
|
1744
1811
|
next: {
|
|
1745
1812
|
...context,
|
|
1813
|
+
...require_passthrough.getPassThroughFailureHint(provisionalConsuming.result.next),
|
|
1746
1814
|
buffer: provisionalConsuming.result.next.buffer,
|
|
1747
1815
|
optionsTerminated: provisionalConsuming.result.next.optionsTerminated,
|
|
1748
1816
|
state: createExclusiveState(context.state, provisionalConsuming.index, provisionalConsuming.parser, provisionalConsuming.result),
|
|
@@ -1777,6 +1845,7 @@ function or(...args) {
|
|
|
1777
1845
|
provisional: true,
|
|
1778
1846
|
next: {
|
|
1779
1847
|
...context,
|
|
1848
|
+
...require_passthrough.getPassThroughFailureHint(replayedResult.next),
|
|
1780
1849
|
buffer: replayedResult.next.buffer,
|
|
1781
1850
|
optionsTerminated: replayedResult.next.optionsTerminated,
|
|
1782
1851
|
state: createExclusiveState(context.state, provisionalConsuming.index, provisionalConsuming.parser, {
|
|
@@ -1863,6 +1932,14 @@ function or(...args) {
|
|
|
1863
1932
|
if (singleDependencyMetadata != null) singleResult.dependencyMetadata = singleDependencyMetadata;
|
|
1864
1933
|
defineExclusiveSchedulingNodes(singleResult, parsers);
|
|
1865
1934
|
require_internal_parser.defineInheritedAnnotationParser(singleResult);
|
|
1935
|
+
require_passthrough.defineOptionMatch(singleResult, (state, token) => require_passthrough.combineOptionMatches(parsers.map((parser, index) => {
|
|
1936
|
+
const active = normalizeExclusiveState(state);
|
|
1937
|
+
return require_passthrough.getOptionMatch(parser, active?.[0] === index && active[1].success ? active[1].next.state : parser.initialState, token);
|
|
1938
|
+
})));
|
|
1939
|
+
require_passthrough.definePassThroughPriority(singleResult, parsers, (state, token) => {
|
|
1940
|
+
const active = normalizeExclusiveState(state);
|
|
1941
|
+
return require_passthrough.combinePassThroughPriorities(parsers.map((parser, index) => require_passthrough.getPassThroughPriority(parser, active?.[0] === index && active[1].success ? active[1].next.state : parser.initialState, token)));
|
|
1942
|
+
});
|
|
1866
1943
|
return require_modifiers.fluent(singleResult);
|
|
1867
1944
|
}
|
|
1868
1945
|
/**
|
|
@@ -1897,24 +1974,27 @@ function createLongestMatch(...args) {
|
|
|
1897
1974
|
return createUnexpectedInputErrorWithScopedSuggestions(defaultMsg, token, parsers, options?.errors?.suggestions);
|
|
1898
1975
|
})()
|
|
1899
1976
|
});
|
|
1900
|
-
const commitLongestMatch = (context, match, optionsTerminatorResult) => {
|
|
1977
|
+
const commitLongestMatch = (context, match, optionsTerminatorResult, consumingFailure) => {
|
|
1901
1978
|
const selectedResult = optionsTerminatorResult == null ? match.result : {
|
|
1902
1979
|
...match.result,
|
|
1903
1980
|
next: {
|
|
1904
1981
|
...match.result.next,
|
|
1982
|
+
...require_passthrough.getPassThroughFailureHint(optionsTerminatorResult.next),
|
|
1905
1983
|
buffer: optionsTerminatorResult.next.buffer,
|
|
1906
1984
|
optionsTerminated: true
|
|
1907
1985
|
},
|
|
1908
1986
|
consumed: [...optionsTerminatorResult.consumed, ...match.result.consumed]
|
|
1909
1987
|
};
|
|
1988
|
+
const next = selectedResult.consumed.length === 0 ? require_passthrough.withPassThroughFailure(selectedResult.next, consumingFailure) : selectedResult.next;
|
|
1910
1989
|
const parser = parsers[match.index];
|
|
1911
|
-
const mergedExec = require_execution_context.mergeChildExec(context.exec,
|
|
1990
|
+
const mergedExec = require_execution_context.mergeChildExec(context.exec, next.exec);
|
|
1912
1991
|
return {
|
|
1913
1992
|
success: true,
|
|
1914
1993
|
next: {
|
|
1915
1994
|
...context,
|
|
1916
|
-
|
|
1917
|
-
|
|
1995
|
+
...require_passthrough.getPassThroughFailureHint(next),
|
|
1996
|
+
buffer: next.buffer,
|
|
1997
|
+
optionsTerminated: next.optionsTerminated,
|
|
1918
1998
|
state: createExclusiveState(context.state, match.index, parser, selectedResult),
|
|
1919
1999
|
...mergedExec != null ? {
|
|
1920
2000
|
exec: mergedExec,
|
|
@@ -1949,6 +2029,7 @@ function createLongestMatch(...args) {
|
|
|
1949
2029
|
let bestMatch = null;
|
|
1950
2030
|
const optionsTerminatorMatches = [];
|
|
1951
2031
|
let error = getInitialError(context);
|
|
2032
|
+
let consumingFailure;
|
|
1952
2033
|
const activeState = normalizeExclusiveState(context.state);
|
|
1953
2034
|
for (let i = 0; i < syncParsers.length; i++) {
|
|
1954
2035
|
const parser = syncParsers[i];
|
|
@@ -1964,6 +2045,7 @@ function createLongestMatch(...args) {
|
|
|
1964
2045
|
continue;
|
|
1965
2046
|
}
|
|
1966
2047
|
if (result.success) {
|
|
2048
|
+
consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, context, result.next);
|
|
1967
2049
|
const consumed = context.buffer.length - result.next.buffer.length;
|
|
1968
2050
|
const bestIsProvisional = bestMatch != null && bestMatch.result.success && !!bestMatch.result.provisional;
|
|
1969
2051
|
if (bestMatch === null || consumed > bestMatch.consumed || consumed === bestMatch.consumed && bestIsProvisional && !result.provisional) bestMatch = {
|
|
@@ -1971,11 +2053,15 @@ function createLongestMatch(...args) {
|
|
|
1971
2053
|
result,
|
|
1972
2054
|
consumed
|
|
1973
2055
|
};
|
|
1974
|
-
} else
|
|
2056
|
+
} else {
|
|
2057
|
+
const match = require_passthrough.getOptionMatch(parser, childContext.state, context.buffer[0]);
|
|
2058
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
2059
|
+
if (error.consumed < result.consumed) error = result;
|
|
2060
|
+
}
|
|
1975
2061
|
}
|
|
1976
2062
|
const optionsTerminatorResolution = resolveLongestMatchOptionsTerminator(context, bestMatch, optionsTerminatorMatches);
|
|
1977
2063
|
if (optionsTerminatorResolution != null) return optionsTerminatorResolution;
|
|
1978
|
-
if (bestMatch != null) return commitLongestMatch(context, bestMatch);
|
|
2064
|
+
if (bestMatch != null) return commitLongestMatch(context, bestMatch, void 0, consumingFailure);
|
|
1979
2065
|
return {
|
|
1980
2066
|
...error,
|
|
1981
2067
|
success: false
|
|
@@ -1985,6 +2071,7 @@ function createLongestMatch(...args) {
|
|
|
1985
2071
|
let bestMatch = null;
|
|
1986
2072
|
const optionsTerminatorMatches = [];
|
|
1987
2073
|
let error = getInitialError(context);
|
|
2074
|
+
let consumingFailure;
|
|
1988
2075
|
const activeState = normalizeExclusiveState(context.state);
|
|
1989
2076
|
for (let i = 0; i < parsers.length; i++) {
|
|
1990
2077
|
const parser = parsers[i];
|
|
@@ -2001,6 +2088,7 @@ function createLongestMatch(...args) {
|
|
|
2001
2088
|
continue;
|
|
2002
2089
|
}
|
|
2003
2090
|
if (result.success) {
|
|
2091
|
+
consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, context, result.next);
|
|
2004
2092
|
const consumed = context.buffer.length - result.next.buffer.length;
|
|
2005
2093
|
const bestIsProvisional = bestMatch != null && bestMatch.result.success && !!bestMatch.result.provisional;
|
|
2006
2094
|
if (bestMatch === null || consumed > bestMatch.consumed || consumed === bestMatch.consumed && bestIsProvisional && !result.provisional) bestMatch = {
|
|
@@ -2008,11 +2096,15 @@ function createLongestMatch(...args) {
|
|
|
2008
2096
|
result,
|
|
2009
2097
|
consumed
|
|
2010
2098
|
};
|
|
2011
|
-
} else
|
|
2099
|
+
} else {
|
|
2100
|
+
const match = require_passthrough.getOptionMatch(parser, childContext.state, context.buffer[0]);
|
|
2101
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
2102
|
+
if (error.consumed < result.consumed) error = result;
|
|
2103
|
+
}
|
|
2012
2104
|
}
|
|
2013
2105
|
const optionsTerminatorResolution = resolveLongestMatchOptionsTerminator(context, bestMatch, optionsTerminatorMatches);
|
|
2014
2106
|
if (optionsTerminatorResolution != null) return optionsTerminatorResolution;
|
|
2015
|
-
if (bestMatch != null) return commitLongestMatch(context, bestMatch);
|
|
2107
|
+
if (bestMatch != null) return commitLongestMatch(context, bestMatch, void 0, consumingFailure);
|
|
2016
2108
|
return {
|
|
2017
2109
|
...error,
|
|
2018
2110
|
success: false
|
|
@@ -2079,6 +2171,14 @@ function createLongestMatch(...args) {
|
|
|
2079
2171
|
if (multiDependencyMetadata != null) multiResult.dependencyMetadata = multiDependencyMetadata;
|
|
2080
2172
|
defineExclusiveSchedulingNodes(multiResult, parsers);
|
|
2081
2173
|
require_internal_parser.defineInheritedAnnotationParser(multiResult);
|
|
2174
|
+
require_passthrough.defineOptionMatch(multiResult, (state, token) => require_passthrough.combineOptionMatches(parsers.map((parser, index) => {
|
|
2175
|
+
const active = normalizeExclusiveState(state);
|
|
2176
|
+
return require_passthrough.getOptionMatch(parser, active?.[0] === index && active[1].success ? active[1].next.state : parser.initialState, token);
|
|
2177
|
+
})));
|
|
2178
|
+
require_passthrough.definePassThroughPriority(multiResult, parsers, (state, token) => {
|
|
2179
|
+
const active = normalizeExclusiveState(state);
|
|
2180
|
+
return require_passthrough.combinePassThroughPriorities(parsers.map((parser, index) => require_passthrough.getPassThroughPriority(parser, active?.[0] === index && active[1].success ? active[1].next.state : parser.initialState, token)));
|
|
2181
|
+
});
|
|
2082
2182
|
return require_modifiers.fluent(multiResult);
|
|
2083
2183
|
}
|
|
2084
2184
|
/**
|
|
@@ -2482,6 +2582,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2482
2582
|
const parserKeys = Reflect.ownKeys(parsers);
|
|
2483
2583
|
const parserPairs = parserKeys.map((k) => [k, parsers[k]]);
|
|
2484
2584
|
parserPairs.sort(([_, parserA], [__, parserB]) => parserB.priority - parserA.priority);
|
|
2585
|
+
const passThroughParsers = new Set(parserPairs.map(([, parser]) => parser).filter((parser) => require_passthrough.hasPassThroughUsage(parser.usage)));
|
|
2485
2586
|
const createInitialState = () => {
|
|
2486
2587
|
const state = {};
|
|
2487
2588
|
for (const key of parserKeys) state[key] = parsers[key].initialState;
|
|
@@ -2531,6 +2632,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2531
2632
|
success: true,
|
|
2532
2633
|
next: {
|
|
2533
2634
|
...context,
|
|
2635
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
2534
2636
|
buffer: result.next.buffer,
|
|
2535
2637
|
optionsTerminated: result.next.optionsTerminated,
|
|
2536
2638
|
state: nextState,
|
|
@@ -2567,16 +2669,19 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2567
2669
|
let anySuccess = false;
|
|
2568
2670
|
const allConsumed = [];
|
|
2569
2671
|
const consumedFields = /* @__PURE__ */ new Set();
|
|
2672
|
+
let consumingFailure;
|
|
2570
2673
|
let madeProgress = true;
|
|
2571
2674
|
while (madeProgress && currentContext.buffer.length > 0) {
|
|
2572
2675
|
madeProgress = false;
|
|
2676
|
+
consumingFailure = void 0;
|
|
2573
2677
|
const getFieldState = createFieldStateGetter(currentContext.state, getObjectParseChildState);
|
|
2574
|
-
for (const [field, parser] of parserPairs) {
|
|
2575
|
-
const result = parser.parse(withChildContext$1(currentContext, field, getFieldState(field, parser), parser));
|
|
2678
|
+
for (const [field, parser] of orderBeforePassThrough(parserPairs, currentContext, ([, parser$1]) => parser$1, ([field$1, parser$1]) => getFieldState(field$1, parser$1), passThroughParsers)) {
|
|
2679
|
+
const result = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, field, getFieldState(field, parser), parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, getFieldState(field, parser), currentContext.buffer[0])));
|
|
2576
2680
|
if (result.success && result.consumed.length > 0) {
|
|
2577
2681
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
2578
2682
|
currentContext = {
|
|
2579
2683
|
...currentContext,
|
|
2684
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
2580
2685
|
buffer: result.next.buffer,
|
|
2581
2686
|
optionsTerminated: result.next.optionsTerminated,
|
|
2582
2687
|
state: {
|
|
@@ -2594,7 +2699,12 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2594
2699
|
madeProgress = true;
|
|
2595
2700
|
consumedFields.add(field);
|
|
2596
2701
|
break;
|
|
2597
|
-
} else if (
|
|
2702
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
2703
|
+
else {
|
|
2704
|
+
const match = require_passthrough.getOptionMatch(parser, getFieldState(field, parser), currentContext.buffer[0]);
|
|
2705
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
2706
|
+
if (error.consumed < result.consumed) error = result;
|
|
2707
|
+
}
|
|
2598
2708
|
}
|
|
2599
2709
|
}
|
|
2600
2710
|
{
|
|
@@ -2604,7 +2714,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2604
2714
|
const typedParser = parser;
|
|
2605
2715
|
if (parser.leadingNames.size > 0 || typedParser.acceptingAnyToken) continue;
|
|
2606
2716
|
const fieldState = getFieldState(field, parser);
|
|
2607
|
-
const result = typedParser.parse(withChildContext$1(currentContext, field, fieldState, parser));
|
|
2717
|
+
const result = typedParser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, field, fieldState, parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, getFieldState(field, parser), currentContext.buffer[0])));
|
|
2608
2718
|
if (result.success && result.consumed.length === 0 && result.next.state !== fieldState) {
|
|
2609
2719
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
2610
2720
|
currentContext = {
|
|
@@ -2624,7 +2734,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2624
2734
|
}
|
|
2625
2735
|
if (anySuccess) return {
|
|
2626
2736
|
success: true,
|
|
2627
|
-
next: currentContext,
|
|
2737
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
2628
2738
|
consumed: allConsumed
|
|
2629
2739
|
};
|
|
2630
2740
|
if (currentContext.buffer.length === 0) {
|
|
@@ -2673,17 +2783,20 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2673
2783
|
let anySuccess = false;
|
|
2674
2784
|
const allConsumed = [];
|
|
2675
2785
|
const consumedFields = /* @__PURE__ */ new Set();
|
|
2786
|
+
let consumingFailure;
|
|
2676
2787
|
let madeProgress = true;
|
|
2677
2788
|
while (madeProgress && currentContext.buffer.length > 0) {
|
|
2678
2789
|
madeProgress = false;
|
|
2790
|
+
consumingFailure = void 0;
|
|
2679
2791
|
const getFieldState = createFieldStateGetter(currentContext.state, getObjectParseChildState);
|
|
2680
|
-
for (const [field, parser] of parserPairs) {
|
|
2681
|
-
const resultOrPromise = parser.parse(withChildContext$1(currentContext, field, getFieldState(field, parser), parser));
|
|
2792
|
+
for (const [field, parser] of orderBeforePassThrough(parserPairs, currentContext, ([, parser$1]) => parser$1, ([field$1, parser$1]) => getFieldState(field$1, parser$1), passThroughParsers)) {
|
|
2793
|
+
const resultOrPromise = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, field, getFieldState(field, parser), parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, getFieldState(field, parser), currentContext.buffer[0])));
|
|
2682
2794
|
const result = await resultOrPromise;
|
|
2683
2795
|
if (result.success && result.consumed.length > 0) {
|
|
2684
2796
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
2685
2797
|
currentContext = {
|
|
2686
2798
|
...currentContext,
|
|
2799
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
2687
2800
|
buffer: result.next.buffer,
|
|
2688
2801
|
optionsTerminated: result.next.optionsTerminated,
|
|
2689
2802
|
state: {
|
|
@@ -2701,7 +2814,12 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2701
2814
|
madeProgress = true;
|
|
2702
2815
|
consumedFields.add(field);
|
|
2703
2816
|
break;
|
|
2704
|
-
} else if (
|
|
2817
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
2818
|
+
else {
|
|
2819
|
+
const match = require_passthrough.getOptionMatch(parser, getFieldState(field, parser), currentContext.buffer[0]);
|
|
2820
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
2821
|
+
if (error.consumed < result.consumed) error = result;
|
|
2822
|
+
}
|
|
2705
2823
|
}
|
|
2706
2824
|
}
|
|
2707
2825
|
{
|
|
@@ -2710,7 +2828,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2710
2828
|
if (consumedFields.has(field)) continue;
|
|
2711
2829
|
if (parser.leadingNames.size > 0 || parser.acceptingAnyToken) continue;
|
|
2712
2830
|
const fieldState = getFieldState(field, parser);
|
|
2713
|
-
const resultOrPromise = parser.parse(withChildContext$1(currentContext, field, fieldState, parser));
|
|
2831
|
+
const resultOrPromise = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, field, fieldState, parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, getFieldState(field, parser), currentContext.buffer[0])));
|
|
2714
2832
|
const result = await resultOrPromise;
|
|
2715
2833
|
if (result.success && result.consumed.length === 0 && result.next.state !== fieldState) {
|
|
2716
2834
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
@@ -2731,7 +2849,7 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
2731
2849
|
}
|
|
2732
2850
|
if (anySuccess) return {
|
|
2733
2851
|
success: true,
|
|
2734
|
-
next: currentContext,
|
|
2852
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
2735
2853
|
consumed: allConsumed
|
|
2736
2854
|
};
|
|
2737
2855
|
if (currentContext.buffer.length === 0) {
|
|
@@ -3093,6 +3211,8 @@ function object(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3093
3211
|
});
|
|
3094
3212
|
require_internal_parser.defineParseLanes(objectParser, objectParseLanes);
|
|
3095
3213
|
require_internal_parser.defineInheritedAnnotationParser(objectParser);
|
|
3214
|
+
require_passthrough.defineOptionMatch(objectParser, (state, token) => require_passthrough.combineOptionMatches(parserPairs.map(([field, parser]) => require_passthrough.getOptionMatch(parser, getAnnotatedFieldState(state, typeof field === "number" ? String(field) : field, parser), token))));
|
|
3215
|
+
require_passthrough.definePassThroughPriority(objectParser, parserPairs.map(([, parser]) => parser), (state, token) => require_passthrough.combinePassThroughPriorities(parserPairs.map(([field, parser]) => require_passthrough.getPassThroughPriority(parser, getAnnotatedFieldState(state, typeof field === "number" ? String(field) : field, parser), token))));
|
|
3096
3216
|
return require_modifiers.fluent(objectParser);
|
|
3097
3217
|
}
|
|
3098
3218
|
function isParserLike(value) {
|
|
@@ -3549,6 +3669,7 @@ function advanceTupleSuggestContextSync(context, parsers) {
|
|
|
3549
3669
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
3550
3670
|
currentContext = {
|
|
3551
3671
|
...currentContext,
|
|
3672
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
3552
3673
|
buffer: result.next.buffer,
|
|
3553
3674
|
optionsTerminated: result.next.optionsTerminated,
|
|
3554
3675
|
state: newStateArray,
|
|
@@ -3615,6 +3736,7 @@ async function advanceTupleSuggestContextAsync(context, parsers) {
|
|
|
3615
3736
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
3616
3737
|
currentContext = {
|
|
3617
3738
|
...currentContext,
|
|
3739
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
3618
3740
|
buffer: result.next.buffer,
|
|
3619
3741
|
optionsTerminated: result.next.optionsTerminated,
|
|
3620
3742
|
state: newStateArray,
|
|
@@ -3714,10 +3836,12 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3714
3836
|
const combinedMode = parsers.some((p) => p.mode === "async") ? "async" : "sync";
|
|
3715
3837
|
const syncParsers = parsers;
|
|
3716
3838
|
if (!options.allowDuplicates) checkDuplicateOptionNames(parsers.map((parser, index) => [String(index), parser.usage]));
|
|
3839
|
+
const passThroughParsers = new Set(parsers.filter((parser) => require_passthrough.hasPassThroughUsage(parser.usage)));
|
|
3717
3840
|
const parseSync = (context) => {
|
|
3718
3841
|
let currentContext = context;
|
|
3719
3842
|
const allConsumed = [];
|
|
3720
3843
|
const matchedParsers = /* @__PURE__ */ new Set();
|
|
3844
|
+
let consumingFailure;
|
|
3721
3845
|
while (matchedParsers.size < syncParsers.length) {
|
|
3722
3846
|
let foundMatch = false;
|
|
3723
3847
|
let error = {
|
|
@@ -3725,14 +3849,15 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3725
3849
|
error: require_message.message`No remaining parsers could match the input.`
|
|
3726
3850
|
};
|
|
3727
3851
|
const stateArray = currentContext.state;
|
|
3728
|
-
const remainingParsers = syncParsers.map((parser, index) => [parser, index]).filter(([
|
|
3852
|
+
const remainingParsers = orderBeforePassThrough(syncParsers.map((parser, index) => [parser, index]).filter(([parser, index]) => !matchedParsers.has(index) || require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0])?.continuesCommand === true || passThroughParsers.size > 0 && !currentContext.optionsTerminated && require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]) != null).sort(([parserA], [parserB]) => parserB.priority - parserA.priority), currentContext, ([parser]) => parser, ([, index]) => stateArray[index], passThroughParsers);
|
|
3729
3853
|
for (const [parser, index] of remainingParsers) {
|
|
3730
|
-
const result = parser.parse(withChildContext$1(currentContext, index, stateArray[index], parser));
|
|
3854
|
+
const result = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
3731
3855
|
if (result.success && result.consumed.length > 0) {
|
|
3732
3856
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
3733
3857
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
3734
3858
|
currentContext = {
|
|
3735
3859
|
...currentContext,
|
|
3860
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
3736
3861
|
buffer: result.next.buffer,
|
|
3737
3862
|
optionsTerminated: result.next.optionsTerminated,
|
|
3738
3863
|
state: newStateArray,
|
|
@@ -3741,14 +3866,21 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3741
3866
|
dependencyRegistry: mergedExec.dependencyRegistry
|
|
3742
3867
|
} : {}
|
|
3743
3868
|
};
|
|
3869
|
+
consumingFailure = void 0;
|
|
3744
3870
|
allConsumed.push(...result.consumed);
|
|
3745
3871
|
matchedParsers.add(index);
|
|
3746
3872
|
foundMatch = true;
|
|
3747
3873
|
break;
|
|
3748
|
-
} else if (
|
|
3874
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
3875
|
+
else {
|
|
3876
|
+
const match = require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]);
|
|
3877
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
3878
|
+
if (error.consumed < result.consumed) error = result;
|
|
3879
|
+
}
|
|
3749
3880
|
}
|
|
3750
3881
|
if (!foundMatch) for (const [parser, index] of remainingParsers) {
|
|
3751
|
-
|
|
3882
|
+
if (matchedParsers.has(index)) continue;
|
|
3883
|
+
const result = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
3752
3884
|
if (result.success && result.consumed.length < 1) {
|
|
3753
3885
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
3754
3886
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
@@ -3776,7 +3908,7 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3776
3908
|
}
|
|
3777
3909
|
return {
|
|
3778
3910
|
success: true,
|
|
3779
|
-
next: currentContext,
|
|
3911
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
3780
3912
|
consumed: allConsumed
|
|
3781
3913
|
};
|
|
3782
3914
|
};
|
|
@@ -3784,6 +3916,7 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3784
3916
|
let currentContext = context;
|
|
3785
3917
|
const allConsumed = [];
|
|
3786
3918
|
const matchedParsers = /* @__PURE__ */ new Set();
|
|
3919
|
+
let consumingFailure;
|
|
3787
3920
|
while (matchedParsers.size < parsers.length) {
|
|
3788
3921
|
let foundMatch = false;
|
|
3789
3922
|
let error = {
|
|
@@ -3791,15 +3924,16 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3791
3924
|
error: require_message.message`No remaining parsers could match the input.`
|
|
3792
3925
|
};
|
|
3793
3926
|
const stateArray = currentContext.state;
|
|
3794
|
-
const remainingParsers = parsers.map((parser, index) => [parser, index]).filter(([
|
|
3927
|
+
const remainingParsers = orderBeforePassThrough(parsers.map((parser, index) => [parser, index]).filter(([parser, index]) => !matchedParsers.has(index) || require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0])?.continuesCommand === true || passThroughParsers.size > 0 && !currentContext.optionsTerminated && require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]) != null).sort(([parserA], [parserB]) => parserB.priority - parserA.priority), currentContext, ([parser]) => parser, ([, index]) => stateArray[index], passThroughParsers);
|
|
3795
3928
|
for (const [parser, index] of remainingParsers) {
|
|
3796
|
-
const resultOrPromise = parser.parse(withChildContext$1(currentContext, index, stateArray[index], parser));
|
|
3929
|
+
const resultOrPromise = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
3797
3930
|
const result = await resultOrPromise;
|
|
3798
3931
|
if (result.success && result.consumed.length > 0) {
|
|
3799
3932
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
3800
3933
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
3801
3934
|
currentContext = {
|
|
3802
3935
|
...currentContext,
|
|
3936
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
3803
3937
|
buffer: result.next.buffer,
|
|
3804
3938
|
optionsTerminated: result.next.optionsTerminated,
|
|
3805
3939
|
state: newStateArray,
|
|
@@ -3808,14 +3942,21 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3808
3942
|
dependencyRegistry: mergedExec.dependencyRegistry
|
|
3809
3943
|
} : {}
|
|
3810
3944
|
};
|
|
3945
|
+
consumingFailure = void 0;
|
|
3811
3946
|
allConsumed.push(...result.consumed);
|
|
3812
3947
|
matchedParsers.add(index);
|
|
3813
3948
|
foundMatch = true;
|
|
3814
3949
|
break;
|
|
3815
|
-
} else if (
|
|
3950
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
3951
|
+
else {
|
|
3952
|
+
const match = require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]);
|
|
3953
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
3954
|
+
if (error.consumed < result.consumed) error = result;
|
|
3955
|
+
}
|
|
3816
3956
|
}
|
|
3817
3957
|
if (!foundMatch) for (const [parser, index] of remainingParsers) {
|
|
3818
|
-
|
|
3958
|
+
if (matchedParsers.has(index)) continue;
|
|
3959
|
+
const resultOrPromise = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
3819
3960
|
const result = await resultOrPromise;
|
|
3820
3961
|
if (result.success && result.consumed.length < 1) {
|
|
3821
3962
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
@@ -3844,7 +3985,7 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
3844
3985
|
}
|
|
3845
3986
|
return {
|
|
3846
3987
|
success: true,
|
|
3847
|
-
next: currentContext,
|
|
3988
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
3848
3989
|
consumed: allConsumed
|
|
3849
3990
|
};
|
|
3850
3991
|
};
|
|
@@ -4109,6 +4250,8 @@ function tuple(labelOrParsers, maybeParsersOrOptions, maybeOptions) {
|
|
|
4109
4250
|
enumerable: false
|
|
4110
4251
|
});
|
|
4111
4252
|
require_internal_parser.defineInheritedAnnotationParser(tupleParser);
|
|
4253
|
+
require_passthrough.defineOptionMatch(tupleParser, (state, token) => require_passthrough.combineOptionMatches(parsers.map((parser, index) => require_passthrough.getOptionMatch(parser, require_annotation_state.getWrappedChildState(state, state[index], parser), token))));
|
|
4254
|
+
require_passthrough.definePassThroughPriority(tupleParser, parsers, (state, token) => require_passthrough.combinePassThroughPriorities(parsers.map((parser, index) => require_passthrough.getPassThroughPriority(parser, require_annotation_state.getWrappedChildState(state, state[index], parser), token))));
|
|
4112
4255
|
return require_modifiers.fluent(tupleParser);
|
|
4113
4256
|
}
|
|
4114
4257
|
function seq(...rawArgs) {
|
|
@@ -4565,6 +4708,7 @@ function merge(...args) {
|
|
|
4565
4708
|
success: true,
|
|
4566
4709
|
next: {
|
|
4567
4710
|
...context,
|
|
4711
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
4568
4712
|
buffer: result.next.buffer,
|
|
4569
4713
|
optionsTerminated: result.next.optionsTerminated,
|
|
4570
4714
|
state: newState,
|
|
@@ -4670,6 +4814,7 @@ function merge(...args) {
|
|
|
4670
4814
|
const mergedExec = require_execution_context.mergeChildExec(settledContext.exec, result.next.exec);
|
|
4671
4815
|
settledContext = {
|
|
4672
4816
|
...settledContext,
|
|
4817
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
4673
4818
|
buffer: result.next.buffer,
|
|
4674
4819
|
optionsTerminated: result.next.optionsTerminated,
|
|
4675
4820
|
state: nextState,
|
|
@@ -4702,6 +4847,7 @@ function merge(...args) {
|
|
|
4702
4847
|
const newState = mergeResultState(parser, currentContext, parserState, result, i);
|
|
4703
4848
|
const newContext = {
|
|
4704
4849
|
...currentContext,
|
|
4850
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
4705
4851
|
buffer: result.next.buffer,
|
|
4706
4852
|
optionsTerminated: result.next.optionsTerminated,
|
|
4707
4853
|
state: newState,
|
|
@@ -4747,6 +4893,7 @@ function merge(...args) {
|
|
|
4747
4893
|
const newState = mergeResultState(parser, currentContext, parserState, result, i);
|
|
4748
4894
|
const newContext = {
|
|
4749
4895
|
...currentContext,
|
|
4896
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
4750
4897
|
buffer: result.next.buffer,
|
|
4751
4898
|
optionsTerminated: result.next.optionsTerminated,
|
|
4752
4899
|
state: newState,
|
|
@@ -4786,10 +4933,12 @@ function merge(...args) {
|
|
|
4786
4933
|
const consumedLanes = /* @__PURE__ */ new Set();
|
|
4787
4934
|
const consumedGroups = /* @__PURE__ */ new Set();
|
|
4788
4935
|
const laneResults = /* @__PURE__ */ new Map();
|
|
4936
|
+
let consumingFailure;
|
|
4789
4937
|
let attemptedLane = false;
|
|
4790
4938
|
let madeProgress = true;
|
|
4791
4939
|
while (madeProgress && currentContext.buffer.length > 0) {
|
|
4792
4940
|
madeProgress = false;
|
|
4941
|
+
consumingFailure = void 0;
|
|
4793
4942
|
let consumingError = null;
|
|
4794
4943
|
for (const lane of mergeParseLanes) {
|
|
4795
4944
|
if (consumingError != null && lane.priority < consumingError.priority) {
|
|
@@ -4807,6 +4956,10 @@ function merge(...args) {
|
|
|
4807
4956
|
break;
|
|
4808
4957
|
}
|
|
4809
4958
|
if (!result.success) {
|
|
4959
|
+
if (result.consumed > 0 && require_passthrough.matchesOptionToken({
|
|
4960
|
+
leadingNames: lane.leadingNames,
|
|
4961
|
+
usage: parsers.flatMap((parser) => parser.usage)
|
|
4962
|
+
}, currentContext.buffer[0])) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, lane.priority);
|
|
4810
4963
|
if (result.consumed > 0 && consumingError == null) consumingError = {
|
|
4811
4964
|
priority: lane.priority,
|
|
4812
4965
|
result
|
|
@@ -4838,7 +4991,7 @@ function merge(...args) {
|
|
|
4838
4991
|
}
|
|
4839
4992
|
return {
|
|
4840
4993
|
success: true,
|
|
4841
|
-
next: currentContext,
|
|
4994
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
4842
4995
|
consumed: allConsumed
|
|
4843
4996
|
};
|
|
4844
4997
|
};
|
|
@@ -4849,10 +5002,12 @@ function merge(...args) {
|
|
|
4849
5002
|
const consumedLanes = /* @__PURE__ */ new Set();
|
|
4850
5003
|
const consumedGroups = /* @__PURE__ */ new Set();
|
|
4851
5004
|
const laneResults = /* @__PURE__ */ new Map();
|
|
5005
|
+
let consumingFailure;
|
|
4852
5006
|
let attemptedLane = false;
|
|
4853
5007
|
let madeProgress = true;
|
|
4854
5008
|
while (madeProgress && currentContext.buffer.length > 0) {
|
|
4855
5009
|
madeProgress = false;
|
|
5010
|
+
consumingFailure = void 0;
|
|
4856
5011
|
let consumingError = null;
|
|
4857
5012
|
for (const lane of mergeParseLanes) {
|
|
4858
5013
|
if (consumingError != null && lane.priority < consumingError.priority) {
|
|
@@ -4870,6 +5025,10 @@ function merge(...args) {
|
|
|
4870
5025
|
break;
|
|
4871
5026
|
}
|
|
4872
5027
|
if (!result.success) {
|
|
5028
|
+
if (result.consumed > 0 && require_passthrough.matchesOptionToken({
|
|
5029
|
+
leadingNames: lane.leadingNames,
|
|
5030
|
+
usage: parsers.flatMap((parser) => parser.usage)
|
|
5031
|
+
}, currentContext.buffer[0])) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, lane.priority);
|
|
4873
5032
|
if (result.consumed > 0 && consumingError == null) consumingError = {
|
|
4874
5033
|
priority: lane.priority,
|
|
4875
5034
|
result
|
|
@@ -4901,7 +5060,7 @@ function merge(...args) {
|
|
|
4901
5060
|
}
|
|
4902
5061
|
return {
|
|
4903
5062
|
success: true,
|
|
4904
|
-
next: currentContext,
|
|
5063
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
4905
5064
|
consumed: allConsumed
|
|
4906
5065
|
};
|
|
4907
5066
|
};
|
|
@@ -5437,6 +5596,8 @@ function merge(...args) {
|
|
|
5437
5596
|
};
|
|
5438
5597
|
require_internal_parser.defineParseLanes(mergeParser, mergeParseLanes);
|
|
5439
5598
|
require_internal_parser.defineInheritedAnnotationParser(mergeParser);
|
|
5599
|
+
require_passthrough.defineOptionMatch(mergeParser, (state, token) => require_passthrough.combineOptionMatches(sorted.map(([parser], index) => require_passthrough.getOptionMatch(parser, extractParserStateFromState(parser, state, index), token))));
|
|
5600
|
+
require_passthrough.definePassThroughPriority(mergeParser, parsers, (state, token) => require_passthrough.combinePassThroughPriorities(sorted.map(([parser], index) => require_passthrough.getPassThroughPriority(parser, extractParserStateFromState(parser, state, index), token))));
|
|
5440
5601
|
return require_modifiers.fluent(mergeParser);
|
|
5441
5602
|
}
|
|
5442
5603
|
/**
|
|
@@ -5627,6 +5788,7 @@ function tryParseSuggestList(context, stateArray, parsers, matchedParsers, remai
|
|
|
5627
5788
|
const mergedExec = require_execution_context.mergeChildExec(context.exec, result$1.next.exec);
|
|
5628
5789
|
return preParseSuggestLoop({
|
|
5629
5790
|
...context,
|
|
5791
|
+
...require_passthrough.getPassThroughFailureHint(result$1.next),
|
|
5630
5792
|
buffer: result$1.next.buffer,
|
|
5631
5793
|
optionsTerminated: result$1.next.optionsTerminated,
|
|
5632
5794
|
state: stateArray,
|
|
@@ -5654,6 +5816,7 @@ function tryParseSuggestList(context, stateArray, parsers, matchedParsers, remai
|
|
|
5654
5816
|
const mergedExec = require_execution_context.mergeChildExec(context.exec, result.next.exec);
|
|
5655
5817
|
return {
|
|
5656
5818
|
...context,
|
|
5819
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
5657
5820
|
buffer: result.next.buffer,
|
|
5658
5821
|
optionsTerminated: result.next.optionsTerminated,
|
|
5659
5822
|
state: stateArray,
|
|
@@ -5673,10 +5836,12 @@ function concat(...parsers) {
|
|
|
5673
5836
|
const isAsync = combinedMode === "async";
|
|
5674
5837
|
const syncParsers = parsers;
|
|
5675
5838
|
const initialState = parsers.map((parser) => parser.initialState);
|
|
5839
|
+
const passThroughParsers = new Set(parsers.filter((parser) => require_passthrough.hasPassThroughUsage(parser.usage)));
|
|
5676
5840
|
const parseSync = (context) => {
|
|
5677
5841
|
let currentContext = context;
|
|
5678
5842
|
const allConsumed = [];
|
|
5679
5843
|
const matchedParsers = /* @__PURE__ */ new Set();
|
|
5844
|
+
let consumingFailure;
|
|
5680
5845
|
while (matchedParsers.size < syncParsers.length) {
|
|
5681
5846
|
let foundMatch = false;
|
|
5682
5847
|
let error = {
|
|
@@ -5684,14 +5849,15 @@ function concat(...parsers) {
|
|
|
5684
5849
|
error: require_message.message`No remaining parsers could match the input.`
|
|
5685
5850
|
};
|
|
5686
5851
|
const stateArray = currentContext.state;
|
|
5687
|
-
const remainingParsers = syncParsers.map((parser, index) => [parser, index]).filter(([
|
|
5852
|
+
const remainingParsers = orderBeforePassThrough(syncParsers.map((parser, index) => [parser, index]).filter(([parser, index]) => !matchedParsers.has(index) || require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0])?.continuesCommand === true || passThroughParsers.size > 0 && !currentContext.optionsTerminated && require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]) != null).sort(([parserA], [parserB]) => parserB.priority - parserA.priority), currentContext, ([parser]) => parser, ([, index]) => stateArray[index], passThroughParsers);
|
|
5688
5853
|
for (const [parser, index] of remainingParsers) {
|
|
5689
|
-
const result = parser.parse(withChildContext$1(currentContext, index, stateArray[index], parser));
|
|
5854
|
+
const result = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
5690
5855
|
if (result.success && result.consumed.length > 0) {
|
|
5691
5856
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
5692
5857
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
5693
5858
|
currentContext = {
|
|
5694
5859
|
...currentContext,
|
|
5860
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
5695
5861
|
buffer: result.next.buffer,
|
|
5696
5862
|
optionsTerminated: result.next.optionsTerminated,
|
|
5697
5863
|
state: newStateArray,
|
|
@@ -5700,14 +5866,21 @@ function concat(...parsers) {
|
|
|
5700
5866
|
dependencyRegistry: mergedExec.dependencyRegistry
|
|
5701
5867
|
} : {}
|
|
5702
5868
|
};
|
|
5869
|
+
consumingFailure = void 0;
|
|
5703
5870
|
allConsumed.push(...result.consumed);
|
|
5704
5871
|
matchedParsers.add(index);
|
|
5705
5872
|
foundMatch = true;
|
|
5706
5873
|
break;
|
|
5707
|
-
} else if (
|
|
5874
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
5875
|
+
else {
|
|
5876
|
+
const match = require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]);
|
|
5877
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
5878
|
+
if (error.consumed < result.consumed) error = result;
|
|
5879
|
+
}
|
|
5708
5880
|
}
|
|
5709
5881
|
if (!foundMatch) for (const [parser, index] of remainingParsers) {
|
|
5710
|
-
|
|
5882
|
+
if (matchedParsers.has(index)) continue;
|
|
5883
|
+
const result = parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
5711
5884
|
if (result.success && result.consumed.length < 1) {
|
|
5712
5885
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
5713
5886
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
@@ -5735,7 +5908,7 @@ function concat(...parsers) {
|
|
|
5735
5908
|
}
|
|
5736
5909
|
return {
|
|
5737
5910
|
success: true,
|
|
5738
|
-
next: currentContext,
|
|
5911
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
5739
5912
|
consumed: allConsumed
|
|
5740
5913
|
};
|
|
5741
5914
|
};
|
|
@@ -5743,6 +5916,7 @@ function concat(...parsers) {
|
|
|
5743
5916
|
let currentContext = context;
|
|
5744
5917
|
const allConsumed = [];
|
|
5745
5918
|
const matchedParsers = /* @__PURE__ */ new Set();
|
|
5919
|
+
let consumingFailure;
|
|
5746
5920
|
while (matchedParsers.size < parsers.length) {
|
|
5747
5921
|
let foundMatch = false;
|
|
5748
5922
|
let error = {
|
|
@@ -5750,14 +5924,15 @@ function concat(...parsers) {
|
|
|
5750
5924
|
error: require_message.message`No remaining parsers could match the input.`
|
|
5751
5925
|
};
|
|
5752
5926
|
const stateArray = currentContext.state;
|
|
5753
|
-
const remainingParsers = parsers.map((parser, index) => [parser, index]).filter(([
|
|
5927
|
+
const remainingParsers = orderBeforePassThrough(parsers.map((parser, index) => [parser, index]).filter(([parser, index]) => !matchedParsers.has(index) || require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0])?.continuesCommand === true || passThroughParsers.size > 0 && !currentContext.optionsTerminated && require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]) != null).sort(([parserA], [parserB]) => parserB.priority - parserA.priority), currentContext, ([parser]) => parser, ([, index]) => stateArray[index], passThroughParsers);
|
|
5754
5928
|
for (const [parser, index] of remainingParsers) {
|
|
5755
|
-
const result = await parser.parse(withChildContext$1(currentContext, index, stateArray[index], parser));
|
|
5929
|
+
const result = await parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
5756
5930
|
if (result.success && result.consumed.length > 0) {
|
|
5757
5931
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
5758
5932
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
5759
5933
|
currentContext = {
|
|
5760
5934
|
...currentContext,
|
|
5935
|
+
...require_passthrough.getPassThroughFailureHint(result.next),
|
|
5761
5936
|
buffer: result.next.buffer,
|
|
5762
5937
|
optionsTerminated: result.next.optionsTerminated,
|
|
5763
5938
|
state: newStateArray,
|
|
@@ -5766,14 +5941,21 @@ function concat(...parsers) {
|
|
|
5766
5941
|
dependencyRegistry: mergedExec.dependencyRegistry
|
|
5767
5942
|
} : {}
|
|
5768
5943
|
};
|
|
5944
|
+
consumingFailure = void 0;
|
|
5769
5945
|
allConsumed.push(...result.consumed);
|
|
5770
5946
|
matchedParsers.add(index);
|
|
5771
5947
|
foundMatch = true;
|
|
5772
5948
|
break;
|
|
5773
|
-
} else if (
|
|
5949
|
+
} else if (result.success) consumingFailure = require_passthrough.retainConsumingFailureHint(consumingFailure, currentContext, result.next);
|
|
5950
|
+
else {
|
|
5951
|
+
const match = require_passthrough.getOptionMatch(parser, stateArray[index], currentContext.buffer[0]);
|
|
5952
|
+
if (result.consumed > 0 && match != null) consumingFailure = require_passthrough.retainConsumingFailure(consumingFailure, result, match.priority);
|
|
5953
|
+
if (error.consumed < result.consumed) error = result;
|
|
5954
|
+
}
|
|
5774
5955
|
}
|
|
5775
5956
|
if (!foundMatch) for (const [parser, index] of remainingParsers) {
|
|
5776
|
-
|
|
5957
|
+
if (matchedParsers.has(index)) continue;
|
|
5958
|
+
const result = await parser.parse(require_passthrough.withPassThroughFailure(withChildContext$1(currentContext, index, stateArray[index], parser), consumingFailure, require_passthrough.getPassThroughPriority(parser, stateArray[index], currentContext.buffer[0])));
|
|
5777
5959
|
if (result.success && result.consumed.length < 1) {
|
|
5778
5960
|
const newStateArray = require_internal_annotations.annotateFreshArray(currentContext.state, stateArray.map((s, idx) => idx === index ? require_annotation_state.getWrappedChildState(currentContext.state, result.next.state, parser) : s));
|
|
5779
5961
|
const mergedExec = require_execution_context.mergeChildExec(currentContext.exec, result.next.exec);
|
|
@@ -5801,7 +5983,7 @@ function concat(...parsers) {
|
|
|
5801
5983
|
}
|
|
5802
5984
|
return {
|
|
5803
5985
|
success: true,
|
|
5804
|
-
next: currentContext,
|
|
5986
|
+
next: require_passthrough.withPassThroughFailure(currentContext, consumingFailure),
|
|
5805
5987
|
consumed: allConsumed
|
|
5806
5988
|
};
|
|
5807
5989
|
};
|
|
@@ -6064,6 +6246,8 @@ function concat(...parsers) {
|
|
|
6064
6246
|
}
|
|
6065
6247
|
};
|
|
6066
6248
|
require_internal_parser.defineInheritedAnnotationParser(concatParser);
|
|
6249
|
+
require_passthrough.defineOptionMatch(concatParser, (state, token) => require_passthrough.combineOptionMatches(parsers.map((parser, index) => require_passthrough.getOptionMatch(parser, require_annotation_state.getWrappedChildState(state, state[index], parser), token))));
|
|
6250
|
+
require_passthrough.definePassThroughPriority(concatParser, parsers, (state, token) => require_passthrough.combinePassThroughPriorities(parsers.map((parser, index) => require_passthrough.getPassThroughPriority(parser, require_annotation_state.getWrappedChildState(state, state[index], parser), token))));
|
|
6067
6251
|
return require_modifiers.fluent(concatParser);
|
|
6068
6252
|
}
|
|
6069
6253
|
function group(label, parser, options = {}) {
|
|
@@ -6174,6 +6358,9 @@ function group(label, parser, options = {}) {
|
|
|
6174
6358
|
configurable: true,
|
|
6175
6359
|
enumerable: false
|
|
6176
6360
|
});
|
|
6361
|
+
require_passthrough.delegateKnownCompletion(groupParser, parser);
|
|
6362
|
+
require_passthrough.defineOptionMatch(groupParser, (state, token) => require_passthrough.getOptionMatch(parser, state, token));
|
|
6363
|
+
require_passthrough.definePassThroughPriority(groupParser, [parser], (state, token) => require_passthrough.getPassThroughPriority(parser, state, token));
|
|
6177
6364
|
return require_modifiers.fluent(groupParser);
|
|
6178
6365
|
}
|
|
6179
6366
|
/**
|
|
@@ -6328,6 +6515,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6328
6515
|
dependencyRegistry: discriminatorExec.dependencyRegistry
|
|
6329
6516
|
} : {}
|
|
6330
6517
|
}, "_branch", branchParser.initialState, branchParser, branchParser.usage),
|
|
6518
|
+
...require_passthrough.getPassThroughFailureHint(discriminatorResult.next),
|
|
6331
6519
|
buffer: discriminatorResult.next.buffer,
|
|
6332
6520
|
optionsTerminated: discriminatorResult.next.optionsTerminated
|
|
6333
6521
|
});
|
|
@@ -6449,6 +6637,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6449
6637
|
const discriminatorExec = require_execution_context.mergeChildExec(context.exec, discriminatorResult.next.exec);
|
|
6450
6638
|
const speculationContext = {
|
|
6451
6639
|
...context,
|
|
6640
|
+
...require_passthrough.getPassThroughFailureHint(discriminatorResult.next),
|
|
6452
6641
|
buffer: discriminatorResult.next.buffer,
|
|
6453
6642
|
optionsTerminated: discriminatorResult.next.optionsTerminated,
|
|
6454
6643
|
...discriminatorExec != null ? {
|
|
@@ -6576,6 +6765,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
6576
6765
|
dependencyRegistry: discriminatorExec.dependencyRegistry
|
|
6577
6766
|
} : {}
|
|
6578
6767
|
}, "_branch", branchParser.initialState, branchParser, branchParser.usage),
|
|
6768
|
+
...require_passthrough.getPassThroughFailureHint(discriminatorResult.next),
|
|
6579
6769
|
buffer: discriminatorResult.next.buffer,
|
|
6580
6770
|
optionsTerminated: discriminatorResult.next.optionsTerminated
|
|
6581
6771
|
});
|
|
@@ -7501,6 +7691,36 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
7501
7691
|
configurable: true,
|
|
7502
7692
|
enumerable: false
|
|
7503
7693
|
});
|
|
7694
|
+
const reachableBranches = (state) => {
|
|
7695
|
+
if (state.selectedBranch != null) {
|
|
7696
|
+
const branch = state.selectedBranch.kind === "default" ? defaultBranch : branches[state.selectedBranch.key];
|
|
7697
|
+
return branch == null ? [] : [{
|
|
7698
|
+
branch,
|
|
7699
|
+
state: state.branchState
|
|
7700
|
+
}];
|
|
7701
|
+
}
|
|
7702
|
+
const known = require_passthrough.getKnownCompletion(discriminator, state.discriminatorState);
|
|
7703
|
+
if (known != null) {
|
|
7704
|
+
const branch = typeof known.value === "string" ? branches[known.value] : void 0;
|
|
7705
|
+
const reachable = branch ?? defaultBranch;
|
|
7706
|
+
return reachable == null ? [] : [{
|
|
7707
|
+
branch: reachable,
|
|
7708
|
+
state: reachable.initialState
|
|
7709
|
+
}];
|
|
7710
|
+
}
|
|
7711
|
+
return allBranchParsers.map((branch) => ({
|
|
7712
|
+
branch,
|
|
7713
|
+
state: branch.initialState
|
|
7714
|
+
}));
|
|
7715
|
+
};
|
|
7716
|
+
require_passthrough.definePassThroughPriority(conditionalParser, [discriminator, ...allBranchParsers], (state, token) => require_passthrough.combinePassThroughPriorities([...state.selectedBranch == null ? [require_passthrough.getPassThroughPriority(discriminator, state.discriminatorState, token)] : [], ...reachableBranches(state).map(({ branch, state: state$1 }) => require_passthrough.getPassThroughPriority(branch, state$1, token))]));
|
|
7717
|
+
require_passthrough.defineOptionMatch(conditionalParser, (state, token) => {
|
|
7718
|
+
if (state.selectedBranch != null) {
|
|
7719
|
+
const branch = state.selectedBranch.kind === "default" ? defaultBranch : branches[state.selectedBranch.key];
|
|
7720
|
+
return branch == null ? void 0 : require_passthrough.getOptionMatch(branch, state.branchState, token);
|
|
7721
|
+
}
|
|
7722
|
+
return require_passthrough.combineOptionMatches([require_passthrough.getOptionMatch(discriminator, state.discriminatorState, token), ...reachableBranches(state).map(({ branch, state: state$1 }) => require_passthrough.getOptionMatch(branch, state$1, token))]);
|
|
7723
|
+
});
|
|
7504
7724
|
return require_modifiers.fluent(conditionalParser);
|
|
7505
7725
|
}
|
|
7506
7726
|
|