Skip to content

Commit da89bf7

Browse files
authored
Rename RegexComponent.Output (swiftlang#281)
1 parent 34da2b6 commit da89bf7

File tree

18 files changed

+471
-471
lines changed

18 files changed

+471
-471
lines changed

Sources/Exercises/Participants/RegexParticipant.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private func extractFromCaptures(
6262
private func graphemeBreakPropertyData<RP: RegexComponent>(
6363
forLine line: String,
6464
using regex: RP
65-
) -> GraphemeBreakEntry? where RP.Output == (Substring, Substring, Substring?, Substring) {
65+
) -> GraphemeBreakEntry? where RP.RegexOutput == (Substring, Substring, Substring?, Substring) {
6666
line.wholeMatch(of: regex).map(\.output).flatMap(extractFromCaptures)
6767
}
6868

Sources/RegexBuilder/Anchor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ public struct Lookahead<Output>: _BuiltinRegexComponent {
119119
public init<R: RegexComponent>(
120120
_ component: R,
121121
negative: Bool = false
122-
) where R.Output == Output {
122+
) where R.RegexOutput == Output {
123123
self.init(node: .nonCapturingGroup(
124124
negative ? .negativeLookahead : .lookahead, component.regex.root))
125125
}
126126

127127
public init<R: RegexComponent>(
128128
negative: Bool = false,
129129
@RegexComponentBuilder _ component: () -> R
130-
) where R.Output == Output {
130+
) where R.RegexOutput == Output {
131131
self.init(node: .nonCapturingGroup(
132132
negative ? .negativeLookahead : .lookahead, component().regex.root))
133133
}

Sources/RegexBuilder/DSL.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import _RegexParser
1515
extension Regex {
1616
public init<Content: RegexComponent>(
1717
@RegexComponentBuilder _ content: () -> Content
18-
) where Content.Output == Output {
18+
) where Content.RegexOutput == Output {
1919
self = content().regex
2020
}
2121
}
2222

2323
// A convenience protocol for builtin regex components that are initialized with
2424
// a `DSLTree` node.
2525
internal protocol _BuiltinRegexComponent: RegexComponent {
26-
init(_ regex: Regex<Output>)
26+
init(_ regex: Regex<RegexOutput>)
2727
}
2828

2929
extension _BuiltinRegexComponent {
@@ -224,7 +224,7 @@ public struct AlternationBuilder {
224224
@_disfavoredOverload
225225
public static func buildPartialBlock<R: RegexComponent>(
226226
first component: R
227-
) -> ChoiceOf<R.Output> {
227+
) -> ChoiceOf<R.RegexOutput> {
228228
.init(component.regex)
229229
}
230230

Sources/RegexBuilder/Match.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ extension String {
1515
@available(SwiftStdlib 5.7, *)
1616
public func wholeMatch<R: RegexComponent>(
1717
@RegexComponentBuilder of content: () -> R
18-
) -> Regex<R.Output>.Match? {
18+
) -> Regex<R.RegexOutput>.Match? {
1919
wholeMatch(of: content())
2020
}
2121

2222
@available(SwiftStdlib 5.7, *)
2323
public func prefixMatch<R: RegexComponent>(
2424
@RegexComponentBuilder of content: () -> R
25-
) -> Regex<R.Output>.Match? {
25+
) -> Regex<R.RegexOutput>.Match? {
2626
prefixMatch(of: content())
2727
}
2828
}
@@ -31,14 +31,14 @@ extension Substring {
3131
@available(SwiftStdlib 5.7, *)
3232
public func wholeMatch<R: RegexComponent>(
3333
@RegexComponentBuilder of content: () -> R
34-
) -> Regex<R.Output>.Match? {
34+
) -> Regex<R.RegexOutput>.Match? {
3535
wholeMatch(of: content())
3636
}
3737

3838
@available(SwiftStdlib 5.7, *)
3939
public func prefixMatch<R: RegexComponent>(
4040
@RegexComponentBuilder of content: () -> R
41-
) -> Regex<R.Output>.Match? {
41+
) -> Regex<R.RegexOutput>.Match? {
4242
prefixMatch(of: content())
4343
}
4444
}

Sources/RegexBuilder/Variadics.swift

Lines changed: 414 additions & 414 deletions
Large diffs are not rendered by default.

Sources/VariadicsGenerator/VariadicsGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ var standardError = StandardErrorStream()
9090

9191
typealias Counter = Int64
9292
let regexComponentProtocolName = "RegexComponent"
93-
let outputAssociatedTypeName = "Output"
93+
let outputAssociatedTypeName = "RegexOutput"
9494
let patternProtocolRequirementName = "regex"
9595
let regexTypeName = "Regex"
9696
let baseMatchTypeName = "Substring"

Sources/_StringProcessing/Algorithms/Consumers/RegexConsumer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extension RegexConsumer {
3737
// well, taking advantage of the fact that the captures can be ignored
3838

3939
extension RegexConsumer: MatchingCollectionConsumer {
40-
typealias Match = R.Output
40+
typealias Match = R.RegexOutput
4141

4242
func matchingConsuming(
4343
_ consumed: Consumed, in range: Range<Consumed.Index>

Sources/_StringProcessing/Algorithms/Matching/FirstMatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension BidirectionalCollection where SubSequence == Substring {
5656
/// there isn't a match.
5757
public func firstMatch<R: RegexComponent>(
5858
of r: R
59-
) -> Regex<R.Output>.Match? {
59+
) -> Regex<R.RegexOutput>.Match? {
6060
let slice = self[...]
6161
return try? r.regex.firstMatch(in: slice.base)
6262
}

Sources/_StringProcessing/Algorithms/Matching/MatchReplace.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ extension RangeReplaceableCollection where SubSequence == Substring {
125125
@available(SwiftStdlib 5.7, *)
126126
public func replacing<R: RegexComponent, Replacement: Collection>(
127127
_ regex: R,
128-
with replacement: (Regex<R.Output>.Match) throws -> Replacement,
128+
with replacement: (Regex<R.RegexOutput>.Match) throws -> Replacement,
129129
subrange: Range<Index>,
130130
maxReplacements: Int = .max
131131
) rethrows -> Self where Replacement.Element == Element {
@@ -161,7 +161,7 @@ extension RangeReplaceableCollection where SubSequence == Substring {
161161
@available(SwiftStdlib 5.7, *)
162162
public func replacing<R: RegexComponent, Replacement: Collection>(
163163
_ regex: R,
164-
with replacement: (Regex<R.Output>.Match) throws -> Replacement,
164+
with replacement: (Regex<R.RegexOutput>.Match) throws -> Replacement,
165165
maxReplacements: Int = .max
166166
) rethrows -> Self where Replacement.Element == Element {
167167
try replacing(
@@ -182,7 +182,7 @@ extension RangeReplaceableCollection where SubSequence == Substring {
182182
@available(SwiftStdlib 5.7, *)
183183
public mutating func replace<R: RegexComponent, Replacement: Collection>(
184184
_ regex: R,
185-
with replacement: (Regex<R.Output>.Match) throws -> Replacement,
185+
with replacement: (Regex<R.RegexOutput>.Match) throws -> Replacement,
186186
maxReplacements: Int = .max
187187
) rethrows where Replacement.Element == Element {
188188
self = try replacing(

Sources/_StringProcessing/Algorithms/Matching/Matches.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ extension BidirectionalCollection where SubSequence == Substring {
202202

203203
// FIXME: Replace the returned value as `some Collection<Regex<R.Output>.Match>
204204
// when SE-0346 is enabled
205-
func _matches<R: RegexComponent>(of r: R) -> [Regex<R.Output>.Match] {
205+
func _matches<R: RegexComponent>(of r: R) -> [Regex<R.RegexOutput>.Match] {
206206
let slice = self[...]
207207
var start = self.startIndex
208208
let end = self.endIndex
209209
let regex = r.regex
210210

211-
var result = [Regex<R.Output>.Match]()
211+
var result = [Regex<R.RegexOutput>.Match]()
212212
while start < end {
213213
guard let match = try? regex._firstMatch(
214214
slice.base, in: start..<end

0 commit comments

Comments
 (0)