Skip to content

API stubs for casting and named captures #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Sources/_StringProcessing/Regex/AnyRegexOutput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,28 @@ extension Regex.Match where Output == AnyRegexOutput {
fatalError("FIXME: Not implemented")
}
}

@available(SwiftStdlib 5.7, *)
extension Regex where Output == AnyRegexOutput {
/// Returns whether a named-capture with `name` exists
public func contains(captureNamed name: String) -> Bool {
fatalError("FIXME: not implemented")
}

/// Creates a type-erased regex from an existing regex.
///
/// Use this initializer to fit a regex with strongly typed captures into the
/// use site of a dynamic regex, i.e. one that was created from a string.
public init<Output>(_ match: Regex<Output>) {
fatalError("FIXME: Not implemented")
}

/// Returns a typed regex by converting the underlying types.
///
/// - Parameter type: The expected output type.
/// - Returns: A regex generic over the output type if the underlying types can be converted.
/// Returns `nil` otherwise.
public func `as`<Output>(_ type: Output.Type) -> Regex<Output>? {
fatalError("FIXME: Not implemented")
}
}