9
9
//
10
10
//===----------------------------------------------------------------------===//
11
11
12
- public struct RegexConsumer <
12
+ struct RegexConsumer <
13
13
R: RegexComponent , Consumed: BidirectionalCollection
14
14
> where Consumed. SubSequence == Substring {
15
15
// TODO: Should `Regex` itself implement these protocols?
16
16
let regex : R
17
17
18
- public init ( _ regex: R ) {
18
+ init ( _ regex: R ) {
19
19
self . regex = regex
20
20
}
21
21
}
@@ -36,9 +36,9 @@ extension RegexConsumer {
36
36
// well, taking advantage of the fact that the captures can be ignored
37
37
38
38
extension RegexConsumer : MatchingCollectionConsumer {
39
- public typealias Match = R . Output
39
+ typealias Match = R . Output
40
40
41
- public func matchingConsuming(
41
+ func matchingConsuming(
42
42
_ consumed: Consumed , in range: Range < Consumed . Index >
43
43
) -> ( upperBound: String . Index , match: Match ) ? {
44
44
_matchingConsuming ( consumed [ ... ] , in: range)
@@ -47,7 +47,7 @@ extension RegexConsumer: MatchingCollectionConsumer {
47
47
48
48
// TODO: We'll want to bake backwards into the engine
49
49
extension RegexConsumer : BidirectionalMatchingCollectionConsumer {
50
- public func matchingConsumingBack(
50
+ func matchingConsumingBack(
51
51
_ consumed: Consumed , in range: Range < Consumed . Index >
52
52
) -> ( lowerBound: String . Index , match: Match ) ? {
53
53
var i = range. lowerBound
@@ -67,12 +67,12 @@ extension RegexConsumer: BidirectionalMatchingCollectionConsumer {
67
67
}
68
68
69
69
extension RegexConsumer : MatchingStatelessCollectionSearcher {
70
- public typealias Searched = Consumed
70
+ typealias Searched = Consumed
71
71
72
72
// TODO: We'll want to bake search into the engine so it can
73
73
// take advantage of the structure of the regex itself and
74
74
// its own internal state
75
- public func matchingSearch(
75
+ func matchingSearch(
76
76
_ searched: Searched , in range: Range < Searched . Index >
77
77
) -> ( range: Range < String . Index > , match: Match ) ? {
78
78
ConsumerSearcher ( consumer: self ) . matchingSearch ( searched, in: range)
@@ -81,9 +81,9 @@ extension RegexConsumer: MatchingStatelessCollectionSearcher {
81
81
82
82
// TODO: Bake in search-back to engine too
83
83
extension RegexConsumer : BackwardMatchingStatelessCollectionSearcher {
84
- public typealias BackwardSearched = Consumed
84
+ typealias BackwardSearched = Consumed
85
85
86
- public func matchingSearchBack(
86
+ func matchingSearchBack(
87
87
_ searched: BackwardSearched , in range: Range < Searched . Index >
88
88
) -> ( range: Range < String . Index > , match: Match ) ? {
89
89
ConsumerSearcher ( consumer: self ) . matchingSearchBack ( searched, in: range)
0 commit comments