Skip to content

Commit e0922ec

Browse files
milsemanrxwei
andauthored
API stubs for casting and named captures (#349)
* API stubs for casting and named captures * Update Sources/_StringProcessing/Regex/AnyRegexOutput.swift Co-authored-by: Richard Wei <[email protected]> Co-authored-by: Richard Wei <[email protected]>
1 parent 1467470 commit e0922ec

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Sources/_StringProcessing/Regex/AnyRegexOutput.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,28 @@ extension Regex.Match where Output == AnyRegexOutput {
205205
fatalError("FIXME: Not implemented")
206206
}
207207
}
208+
209+
@available(SwiftStdlib 5.7, *)
210+
extension Regex where Output == AnyRegexOutput {
211+
/// Returns whether a named-capture with `name` exists
212+
public func contains(captureNamed name: String) -> Bool {
213+
fatalError("FIXME: not implemented")
214+
}
215+
216+
/// Creates a type-erased regex from an existing regex.
217+
///
218+
/// Use this initializer to fit a regex with strongly typed captures into the
219+
/// use site of a dynamic regex, i.e. one that was created from a string.
220+
public init<Output>(_ match: Regex<Output>) {
221+
fatalError("FIXME: Not implemented")
222+
}
223+
224+
/// Returns a typed regex by converting the underlying types.
225+
///
226+
/// - Parameter type: The expected output type.
227+
/// - Returns: A regex generic over the output type if the underlying types can be converted.
228+
/// Returns `nil` otherwise.
229+
public func `as`<Output>(_ type: Output.Type) -> Regex<Output>? {
230+
fatalError("FIXME: Not implemented")
231+
}
232+
}

0 commit comments

Comments
 (0)