@@ -23,9 +23,9 @@ extension BidirectionalCollection where SubSequence == Substring {
23
23
/// - Parameter content: A closure that returns a regex to match against.
24
24
/// - Returns: The match if there is one, or `nil` if none.
25
25
@available ( SwiftStdlib 5 . 7 , * )
26
- public func wholeMatch< R : RegexComponent > (
27
- @RegexComponentBuilder of content: ( ) -> R
28
- ) -> Regex < R . RegexOutput > . Match ? {
26
+ public func wholeMatch< Output > (
27
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent < Output >
28
+ ) -> Regex < Output > . Match ? {
29
29
wholeMatch ( of: content ( ) )
30
30
}
31
31
@@ -35,9 +35,9 @@ extension BidirectionalCollection where SubSequence == Substring {
35
35
/// - Parameter content: A closure that returns a regex to match against.
36
36
/// - Returns: The match if there is one, or `nil` if none.
37
37
@available ( SwiftStdlib 5 . 7 , * )
38
- public func prefixMatch< R : RegexComponent > (
39
- @RegexComponentBuilder of content: ( ) -> R
40
- ) -> Regex < R . RegexOutput > . Match ? {
38
+ public func prefixMatch< Output > (
39
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent < Output >
40
+ ) -> Regex < Output > . Match ? {
41
41
prefixMatch ( of: content ( ) )
42
42
}
43
43
@@ -49,8 +49,8 @@ extension BidirectionalCollection where SubSequence == Substring {
49
49
/// - Returns: `true` if the regex returned by `content` matched anywhere in
50
50
/// this collection, otherwise `false`.
51
51
@available ( SwiftStdlib 5 . 7 , * )
52
- public func contains< R : RegexComponent > (
53
- @RegexComponentBuilder _ content: ( ) -> R
52
+ public func contains(
53
+ @RegexComponentBuilder _ content: ( ) -> some RegexComponent
54
54
) -> Bool {
55
55
contains ( content ( ) )
56
56
}
@@ -63,8 +63,8 @@ extension BidirectionalCollection where SubSequence == Substring {
63
63
/// match of if the regex returned by `content`. Returns `nil` if no match
64
64
/// for the regex is found.
65
65
@available ( SwiftStdlib 5 . 7 , * )
66
- public func firstRange< R : RegexComponent > (
67
- @RegexComponentBuilder of content: ( ) -> R
66
+ public func firstRange(
67
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent
68
68
) -> Range < Index > ? {
69
69
firstRange ( of: content ( ) )
70
70
}
@@ -78,8 +78,8 @@ extension BidirectionalCollection where SubSequence == Substring {
78
78
/// `content`. Returns an empty collection if no match for the regex
79
79
/// is found.
80
80
@available ( SwiftStdlib 5 . 7 , * )
81
- public func ranges< R : RegexComponent > (
82
- @RegexComponentBuilder of content: ( ) -> R
81
+ public func ranges(
82
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent
83
83
) -> [ Range < Index > ] {
84
84
ranges ( of: content ( ) )
85
85
}
@@ -99,10 +99,10 @@ extension BidirectionalCollection where SubSequence == Substring {
99
99
/// - Returns: A collection of substrings, split from this collection's
100
100
/// elements.
101
101
@available ( SwiftStdlib 5 . 7 , * )
102
- public func split< R : RegexComponent > (
102
+ public func split(
103
103
maxSplits: Int = Int . max,
104
104
omittingEmptySubsequences: Bool = true ,
105
- @RegexComponentBuilder separator: ( ) -> R
105
+ @RegexComponentBuilder separator: ( ) -> some RegexComponent
106
106
) -> [ SubSequence ] {
107
107
split ( separator: separator ( ) , maxSplits: maxSplits, omittingEmptySubsequences: omittingEmptySubsequences)
108
108
}
@@ -115,8 +115,8 @@ extension BidirectionalCollection where SubSequence == Substring {
115
115
/// - Returns: `true` if the initial elements of this collection match
116
116
/// regex returned by `content`; otherwise, `false`.
117
117
@available ( SwiftStdlib 5 . 7 , * )
118
- public func starts< R : RegexComponent > (
119
- @RegexComponentBuilder with content: ( ) -> R
118
+ public func starts(
119
+ @RegexComponentBuilder with content: ( ) -> some RegexComponent
120
120
) -> Bool {
121
121
starts ( with: content ( ) )
122
122
}
@@ -132,8 +132,8 @@ extension BidirectionalCollection where SubSequence == Substring {
132
132
/// the start of the collection, the entire contents of this collection
133
133
/// are returned.
134
134
@available ( SwiftStdlib 5 . 7 , * )
135
- public func trimmingPrefix< R : RegexComponent > (
136
- @RegexComponentBuilder _ content: ( ) -> R
135
+ public func trimmingPrefix(
136
+ @RegexComponentBuilder _ content: ( ) -> some RegexComponent
137
137
) -> SubSequence {
138
138
trimmingPrefix ( content ( ) )
139
139
}
@@ -145,9 +145,9 @@ extension BidirectionalCollection where SubSequence == Substring {
145
145
/// - Returns: The first match for the regex created by `content` in this
146
146
/// collection, or `nil` if no match is found.
147
147
@available ( SwiftStdlib 5 . 7 , * )
148
- public func firstMatch< R : RegexComponent > (
149
- @RegexComponentBuilder of content: ( ) -> R
150
- ) -> Regex < R . RegexOutput > . Match ? {
148
+ public func firstMatch< Output > (
149
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent < Output >
150
+ ) -> Regex < Output > . Match ? {
151
151
firstMatch ( of: content ( ) )
152
152
}
153
153
@@ -159,9 +159,9 @@ extension BidirectionalCollection where SubSequence == Substring {
159
159
/// - Returns: A collection of matches for the regex returned by `content`.
160
160
/// If no matches are found, the returned collection is empty.
161
161
@available ( SwiftStdlib 5 . 7 , * )
162
- public func matches< R : RegexComponent > (
163
- @RegexComponentBuilder of content: ( ) -> R
164
- ) -> [ Regex < R . RegexOutput > . Match ] {
162
+ public func matches< Output > (
163
+ @RegexComponentBuilder of content: ( ) -> some RegexComponent < Output >
164
+ ) -> [ Regex < Output > . Match ] {
165
165
matches ( of: content ( ) )
166
166
}
167
167
}
@@ -175,8 +175,8 @@ where Self: BidirectionalCollection, SubSequence == Substring {
175
175
/// - Parameter content: A closure that returns the regex to search for
176
176
/// at the start of this collection.
177
177
@available ( SwiftStdlib 5 . 7 , * )
178
- public mutating func trimPrefix< R : RegexComponent > (
179
- @RegexComponentBuilder _ content: ( ) -> R
178
+ public mutating func trimPrefix(
179
+ @RegexComponentBuilder _ content: ( ) -> some RegexComponent
180
180
) {
181
181
trimPrefix ( content ( ) )
182
182
}
@@ -196,11 +196,11 @@ where Self: BidirectionalCollection, SubSequence == Substring {
196
196
/// - Returns: A new collection in which all matches for regex in `subrange`
197
197
/// are replaced by `replacement`, using `content` to create the regex.
198
198
@available ( SwiftStdlib 5 . 7 , * )
199
- public func replacing< R : RegexComponent , Replacement: Collection > (
199
+ public func replacing< Replacement: Collection > (
200
200
with replacement: Replacement ,
201
201
subrange: Range < Index > ,
202
202
maxReplacements: Int = . max,
203
- @RegexComponentBuilder content: ( ) -> R
203
+ @RegexComponentBuilder content: ( ) -> some RegexComponent
204
204
) -> Self where Replacement. Element == Element {
205
205
replacing ( content ( ) , with: replacement, subrange: subrange, maxReplacements: maxReplacements)
206
206
}
@@ -218,10 +218,10 @@ where Self: BidirectionalCollection, SubSequence == Substring {
218
218
/// - Returns: A new collection in which all matches for regex in `subrange`
219
219
/// are replaced by `replacement`, using `content` to create the regex.
220
220
@available ( SwiftStdlib 5 . 7 , * )
221
- public func replacing< R : RegexComponent , Replacement: Collection > (
221
+ public func replacing< Replacement: Collection > (
222
222
with replacement: Replacement ,
223
223
maxReplacements: Int = . max,
224
- @RegexComponentBuilder content: ( ) -> R
224
+ @RegexComponentBuilder content: ( ) -> some RegexComponent
225
225
) -> Self where Replacement. Element == Element {
226
226
replacing ( content ( ) , with: replacement, maxReplacements: maxReplacements)
227
227
}
@@ -237,10 +237,10 @@ where Self: BidirectionalCollection, SubSequence == Substring {
237
237
/// - content: A closure that returns the collection to search for
238
238
/// and replace.
239
239
@available ( SwiftStdlib 5 . 7 , * )
240
- public mutating func replace< R : RegexComponent , Replacement: Collection > (
240
+ public mutating func replace< Replacement: Collection > (
241
241
with replacement: Replacement ,
242
242
maxReplacements: Int = . max,
243
- @RegexComponentBuilder content: ( ) -> R
243
+ @RegexComponentBuilder content: ( ) -> some RegexComponent
244
244
) where Replacement. Element == Element {
245
245
replace ( content ( ) , with: replacement, maxReplacements: maxReplacements)
246
246
}
@@ -262,11 +262,11 @@ where Self: BidirectionalCollection, SubSequence == Substring {
262
262
/// are replaced by the result of calling `replacement`, where regex
263
263
/// is the result of calling `content`.
264
264
@available ( SwiftStdlib 5 . 7 , * )
265
- public func replacing< R : RegexComponent , Replacement: Collection > (
265
+ public func replacing< Output , Replacement: Collection > (
266
266
subrange: Range < Index > ,
267
267
maxReplacements: Int = . max,
268
- @RegexComponentBuilder content: ( ) -> R ,
269
- with replacement: ( Regex < R . RegexOutput > . Match ) throws -> Replacement
268
+ @RegexComponentBuilder content: ( ) -> some RegexComponent < Output > ,
269
+ with replacement: ( Regex < Output > . Match ) throws -> Replacement
270
270
) rethrows -> Self where Replacement. Element == Element {
271
271
try replacing ( content ( ) , subrange: subrange, maxReplacements: maxReplacements, with: replacement)
272
272
}
@@ -286,10 +286,10 @@ where Self: BidirectionalCollection, SubSequence == Substring {
286
286
/// are replaced by the result of calling `replacement`, where regex is
287
287
/// the result of calling `content`.
288
288
@available ( SwiftStdlib 5 . 7 , * )
289
- public func replacing< R : RegexComponent , Replacement: Collection > (
289
+ public func replacing< Output , Replacement: Collection > (
290
290
maxReplacements: Int = . max,
291
- @RegexComponentBuilder content: ( ) -> R ,
292
- with replacement: ( Regex < R . RegexOutput > . Match ) throws -> Replacement
291
+ @RegexComponentBuilder content: ( ) -> some RegexComponent < Output > ,
292
+ with replacement: ( Regex < Output > . Match ) throws -> Replacement
293
293
) rethrows -> Self where Replacement. Element == Element {
294
294
try replacing ( content ( ) , maxReplacements: maxReplacements, with: replacement)
295
295
}
@@ -305,10 +305,10 @@ where Self: BidirectionalCollection, SubSequence == Substring {
305
305
/// - replacement: A closure that receives the full match information,
306
306
/// including captures, and returns a replacement collection.
307
307
@available ( SwiftStdlib 5 . 7 , * )
308
- public mutating func replace< R : RegexComponent , Replacement: Collection > (
308
+ public mutating func replace< Output , Replacement: Collection > (
309
309
maxReplacements: Int = . max,
310
- @RegexComponentBuilder content: ( ) -> R ,
311
- with replacement: ( Regex < R . RegexOutput > . Match ) throws -> Replacement
310
+ @RegexComponentBuilder content: ( ) -> some RegexComponent < Output > ,
311
+ with replacement: ( Regex < Output > . Match ) throws -> Replacement
312
312
) rethrows where Replacement. Element == Element {
313
313
try replace ( content ( ) , maxReplacements: maxReplacements, with: replacement)
314
314
}
0 commit comments