@optique/core 1.0.0-dev.1751 → 1.0.0-dev.1758
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/modifiers.cjs +44 -14
- package/dist/modifiers.js +44 -14
- package/package.json +1 -1
package/dist/modifiers.cjs
CHANGED
|
@@ -788,13 +788,28 @@ function multiple(parser, options = {}) {
|
|
|
788
788
|
let itemIndex = canExtendCurrent ? context.state.length - 1 : context.state.length;
|
|
789
789
|
const currentItemStateWithAnnotations = canExtendCurrent ? currentItemState : require_annotations.inheritAnnotations(context.state, syncParser.initialState);
|
|
790
790
|
let result = parseSyncWithUnwrappedFallback(withChildContext(context, itemIndex, currentItemStateWithAnnotations));
|
|
791
|
-
if (!result.success)
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
791
|
+
if (!result.success) {
|
|
792
|
+
if (result.consumed !== 0) return result;
|
|
793
|
+
if (!added && canOpenFreshItem) {
|
|
794
|
+
const nextInitialState = require_annotations.inheritAnnotations(context.state, syncParser.initialState);
|
|
795
|
+
itemIndex = context.state.length;
|
|
796
|
+
result = parseSyncWithUnwrappedFallback(withChildContext(context, itemIndex, nextInitialState));
|
|
797
|
+
if (!result.success) {
|
|
798
|
+
if (min === 0 && context.buffer.length === 0 && result.consumed === 0) return {
|
|
799
|
+
success: true,
|
|
800
|
+
next: context,
|
|
801
|
+
consumed: []
|
|
802
|
+
};
|
|
803
|
+
return result;
|
|
804
|
+
}
|
|
805
|
+
added = true;
|
|
806
|
+
} else if (min === 0 && context.buffer.length === 0) return {
|
|
807
|
+
success: true,
|
|
808
|
+
next: context,
|
|
809
|
+
consumed: []
|
|
810
|
+
};
|
|
811
|
+
else return result;
|
|
812
|
+
}
|
|
798
813
|
const mergedExec = mergeChildExec(context.exec, result.next.exec);
|
|
799
814
|
if (added && result.consumed.length === 0 && result.next.optionsTerminated === context.optionsTerminated && isUnstartedMultipleItemState(result.next.state, currentItemStateWithAnnotations)) return {
|
|
800
815
|
success: true,
|
|
@@ -853,13 +868,28 @@ function multiple(parser, options = {}) {
|
|
|
853
868
|
let itemIndex = canExtendCurrent ? context.state.length - 1 : context.state.length;
|
|
854
869
|
const currentItemStateWithAnnotations = canExtendCurrent ? currentItemState : require_annotations.inheritAnnotations(context.state, parser.initialState);
|
|
855
870
|
let result = await parseAsyncWithUnwrappedFallback(withChildContext(context, itemIndex, currentItemStateWithAnnotations));
|
|
856
|
-
if (!result.success)
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
871
|
+
if (!result.success) {
|
|
872
|
+
if (result.consumed !== 0) return result;
|
|
873
|
+
if (!added && canOpenFreshItem) {
|
|
874
|
+
const nextInitialState = require_annotations.inheritAnnotations(context.state, parser.initialState);
|
|
875
|
+
itemIndex = context.state.length;
|
|
876
|
+
result = await parseAsyncWithUnwrappedFallback(withChildContext(context, itemIndex, nextInitialState));
|
|
877
|
+
if (!result.success) {
|
|
878
|
+
if (min === 0 && context.buffer.length === 0 && result.consumed === 0) return {
|
|
879
|
+
success: true,
|
|
880
|
+
next: context,
|
|
881
|
+
consumed: []
|
|
882
|
+
};
|
|
883
|
+
return result;
|
|
884
|
+
}
|
|
885
|
+
added = true;
|
|
886
|
+
} else if (min === 0 && context.buffer.length === 0) return {
|
|
887
|
+
success: true,
|
|
888
|
+
next: context,
|
|
889
|
+
consumed: []
|
|
890
|
+
};
|
|
891
|
+
else return result;
|
|
892
|
+
}
|
|
863
893
|
const mergedExec = mergeChildExec(context.exec, result.next.exec);
|
|
864
894
|
if (added && result.consumed.length === 0 && result.next.optionsTerminated === context.optionsTerminated && isUnstartedMultipleItemState(result.next.state, currentItemStateWithAnnotations)) return {
|
|
865
895
|
success: true,
|
package/dist/modifiers.js
CHANGED
|
@@ -788,13 +788,28 @@ function multiple(parser, options = {}) {
|
|
|
788
788
|
let itemIndex = canExtendCurrent ? context.state.length - 1 : context.state.length;
|
|
789
789
|
const currentItemStateWithAnnotations = canExtendCurrent ? currentItemState : inheritAnnotations(context.state, syncParser.initialState);
|
|
790
790
|
let result = parseSyncWithUnwrappedFallback(withChildContext(context, itemIndex, currentItemStateWithAnnotations));
|
|
791
|
-
if (!result.success)
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
791
|
+
if (!result.success) {
|
|
792
|
+
if (result.consumed !== 0) return result;
|
|
793
|
+
if (!added && canOpenFreshItem) {
|
|
794
|
+
const nextInitialState = inheritAnnotations(context.state, syncParser.initialState);
|
|
795
|
+
itemIndex = context.state.length;
|
|
796
|
+
result = parseSyncWithUnwrappedFallback(withChildContext(context, itemIndex, nextInitialState));
|
|
797
|
+
if (!result.success) {
|
|
798
|
+
if (min === 0 && context.buffer.length === 0 && result.consumed === 0) return {
|
|
799
|
+
success: true,
|
|
800
|
+
next: context,
|
|
801
|
+
consumed: []
|
|
802
|
+
};
|
|
803
|
+
return result;
|
|
804
|
+
}
|
|
805
|
+
added = true;
|
|
806
|
+
} else if (min === 0 && context.buffer.length === 0) return {
|
|
807
|
+
success: true,
|
|
808
|
+
next: context,
|
|
809
|
+
consumed: []
|
|
810
|
+
};
|
|
811
|
+
else return result;
|
|
812
|
+
}
|
|
798
813
|
const mergedExec = mergeChildExec(context.exec, result.next.exec);
|
|
799
814
|
if (added && result.consumed.length === 0 && result.next.optionsTerminated === context.optionsTerminated && isUnstartedMultipleItemState(result.next.state, currentItemStateWithAnnotations)) return {
|
|
800
815
|
success: true,
|
|
@@ -853,13 +868,28 @@ function multiple(parser, options = {}) {
|
|
|
853
868
|
let itemIndex = canExtendCurrent ? context.state.length - 1 : context.state.length;
|
|
854
869
|
const currentItemStateWithAnnotations = canExtendCurrent ? currentItemState : inheritAnnotations(context.state, parser.initialState);
|
|
855
870
|
let result = await parseAsyncWithUnwrappedFallback(withChildContext(context, itemIndex, currentItemStateWithAnnotations));
|
|
856
|
-
if (!result.success)
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
871
|
+
if (!result.success) {
|
|
872
|
+
if (result.consumed !== 0) return result;
|
|
873
|
+
if (!added && canOpenFreshItem) {
|
|
874
|
+
const nextInitialState = inheritAnnotations(context.state, parser.initialState);
|
|
875
|
+
itemIndex = context.state.length;
|
|
876
|
+
result = await parseAsyncWithUnwrappedFallback(withChildContext(context, itemIndex, nextInitialState));
|
|
877
|
+
if (!result.success) {
|
|
878
|
+
if (min === 0 && context.buffer.length === 0 && result.consumed === 0) return {
|
|
879
|
+
success: true,
|
|
880
|
+
next: context,
|
|
881
|
+
consumed: []
|
|
882
|
+
};
|
|
883
|
+
return result;
|
|
884
|
+
}
|
|
885
|
+
added = true;
|
|
886
|
+
} else if (min === 0 && context.buffer.length === 0) return {
|
|
887
|
+
success: true,
|
|
888
|
+
next: context,
|
|
889
|
+
consumed: []
|
|
890
|
+
};
|
|
891
|
+
else return result;
|
|
892
|
+
}
|
|
863
893
|
const mergedExec = mergeChildExec(context.exec, result.next.exec);
|
|
864
894
|
if (added && result.consumed.length === 0 && result.next.optionsTerminated === context.optionsTerminated && isUnstartedMultipleItemState(result.next.state, currentItemStateWithAnnotations)) return {
|
|
865
895
|
success: true,
|