File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
Sources/_StringProcessing/Engine Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,26 @@ extension Processor {
50
50
mutating func runQuantify( _ payload: QuantifyPayload ) -> Bool {
51
51
var trips = 0
52
52
var extraTrips = payload. extraTrips
53
+
54
+ while trips < payload. minTrips {
55
+ guard let next = _doQuantifyMatch ( payload) else {
56
+ signalFailure ( )
57
+ return false
58
+ }
59
+ currentPosition = next
60
+ trips += 1
61
+ }
62
+
53
63
var savePoint = startQuantifierSavePoint (
54
64
isScalarSemantics: payload. isScalarSemantics
55
65
)
56
-
57
66
while true {
58
- if trips >= payload. minTrips {
59
- if extraTrips == 0 { break }
60
- extraTrips = extraTrips. map ( { $0 - 1 } )
61
- if payload. quantKind == . eager {
62
- savePoint. updateRange ( newEnd: currentPosition)
63
- }
67
+ if extraTrips == 0 { break }
68
+ extraTrips = extraTrips. map ( { $0 - 1 } )
69
+ if payload. quantKind == . eager {
70
+ savePoint. updateRange ( newEnd: currentPosition)
64
71
}
72
+
65
73
let next = _doQuantifyMatch ( payload)
66
74
guard let idx = next else {
67
75
if savePoint. isQuantified {
@@ -75,11 +83,6 @@ extension Processor {
75
83
trips += 1
76
84
}
77
85
78
- if trips < payload. minTrips {
79
- signalFailure ( )
80
- return false
81
- }
82
-
83
86
if savePoint. isQuantified {
84
87
savePoints. append ( savePoint)
85
88
}
You can’t perform that action at this time.
0 commit comments