@optique/core 1.0.0-dev.1714 → 1.0.0-dev.1718
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 +1 -1
- package/dist/constructs.d.cts +4 -4
- package/dist/constructs.d.ts +4 -4
- package/dist/constructs.js +1 -1
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -4141,7 +4141,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
4143
|
let deferredBranchState = state.branchState;
|
|
4144
|
-
if (defaultBranch !== void 0) {
|
|
4144
|
+
if (defaultBranch !== void 0 && !ambiguous && !provisionalAmbiguous) {
|
|
4145
4145
|
const defaultResult = await defaultBranch.parse(withChildContext(speculationContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch, defaultBranch.usage));
|
|
4146
4146
|
if (defaultResult.success && defaultResult.consumed.length > 0) {
|
|
4147
4147
|
const defaultExec = mergeChildExec(discriminatorExec ?? context.exec, defaultResult.next.exec);
|
package/dist/constructs.d.cts
CHANGED
|
@@ -1327,11 +1327,11 @@ interface ConditionalErrorOptions {
|
|
|
1327
1327
|
* Custom error message when branch parser fails.
|
|
1328
1328
|
* Receives the discriminator value for context.
|
|
1329
1329
|
*/
|
|
1330
|
-
branchError?: (discriminatorValue: string | undefined, error: Message) => Message;
|
|
1330
|
+
readonly branchError?: (discriminatorValue: string | undefined, error: Message) => Message;
|
|
1331
1331
|
/**
|
|
1332
1332
|
* Custom error message for no matching input.
|
|
1333
1333
|
*/
|
|
1334
|
-
noMatch?: Message | ((context: NoMatchContext) => Message);
|
|
1334
|
+
readonly noMatch?: Message | ((context: NoMatchContext) => Message);
|
|
1335
1335
|
/**
|
|
1336
1336
|
* Custom error message when speculative branch parsing committed
|
|
1337
1337
|
* to one branch but the resolved discriminator value names a
|
|
@@ -1345,7 +1345,7 @@ interface ConditionalErrorOptions {
|
|
|
1345
1345
|
* branch tokens were committed to (`speculativeKey`).
|
|
1346
1346
|
* @since 0.10.1
|
|
1347
1347
|
*/
|
|
1348
|
-
branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1348
|
+
readonly branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1349
1349
|
}
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Options for customizing the {@link conditional} combinator behavior.
|
|
@@ -1355,7 +1355,7 @@ interface ConditionalOptions {
|
|
|
1355
1355
|
/**
|
|
1356
1356
|
* Custom error messages.
|
|
1357
1357
|
*/
|
|
1358
|
-
errors?: ConditionalErrorOptions;
|
|
1358
|
+
readonly errors?: ConditionalErrorOptions;
|
|
1359
1359
|
}
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Helper type to infer result type without default branch.
|
package/dist/constructs.d.ts
CHANGED
|
@@ -1327,11 +1327,11 @@ interface ConditionalErrorOptions {
|
|
|
1327
1327
|
* Custom error message when branch parser fails.
|
|
1328
1328
|
* Receives the discriminator value for context.
|
|
1329
1329
|
*/
|
|
1330
|
-
branchError?: (discriminatorValue: string | undefined, error: Message) => Message;
|
|
1330
|
+
readonly branchError?: (discriminatorValue: string | undefined, error: Message) => Message;
|
|
1331
1331
|
/**
|
|
1332
1332
|
* Custom error message for no matching input.
|
|
1333
1333
|
*/
|
|
1334
|
-
noMatch?: Message | ((context: NoMatchContext) => Message);
|
|
1334
|
+
readonly noMatch?: Message | ((context: NoMatchContext) => Message);
|
|
1335
1335
|
/**
|
|
1336
1336
|
* Custom error message when speculative branch parsing committed
|
|
1337
1337
|
* to one branch but the resolved discriminator value names a
|
|
@@ -1345,7 +1345,7 @@ interface ConditionalErrorOptions {
|
|
|
1345
1345
|
* branch tokens were committed to (`speculativeKey`).
|
|
1346
1346
|
* @since 0.10.1
|
|
1347
1347
|
*/
|
|
1348
|
-
branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1348
|
+
readonly branchMismatch?: (discriminatorValue: string, speculativeKey: string) => Message;
|
|
1349
1349
|
}
|
|
1350
1350
|
/**
|
|
1351
1351
|
* Options for customizing the {@link conditional} combinator behavior.
|
|
@@ -1355,7 +1355,7 @@ interface ConditionalOptions {
|
|
|
1355
1355
|
/**
|
|
1356
1356
|
* Custom error messages.
|
|
1357
1357
|
*/
|
|
1358
|
-
errors?: ConditionalErrorOptions;
|
|
1358
|
+
readonly errors?: ConditionalErrorOptions;
|
|
1359
1359
|
}
|
|
1360
1360
|
/**
|
|
1361
1361
|
* Helper type to infer result type without default branch.
|
package/dist/constructs.js
CHANGED
|
@@ -4141,7 +4141,7 @@ function conditional(discriminator, branches, defaultBranch, options) {
|
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
4143
|
let deferredBranchState = state.branchState;
|
|
4144
|
-
if (defaultBranch !== void 0) {
|
|
4144
|
+
if (defaultBranch !== void 0 && !ambiguous && !provisionalAmbiguous) {
|
|
4145
4145
|
const defaultResult = await defaultBranch.parse(withChildContext(speculationContext, "_branch", state.branchState ?? defaultBranch.initialState, defaultBranch, defaultBranch.usage));
|
|
4146
4146
|
if (defaultResult.success && defaultResult.consumed.length > 0) {
|
|
4147
4147
|
const defaultExec = mergeChildExec(discriminatorExec ?? context.exec, defaultResult.next.exec);
|