10
10
//===----------------------------------------------------------------------===//
11
11
12
12
@dynamicMemberLookup
13
- public struct RegexMatch < Match> {
13
+ public struct MatchResult < Match> {
14
14
let input : String
15
15
public let range : Range < String . Index >
16
16
let rawCaptures : [ StructuredCapture ]
@@ -64,11 +64,11 @@ public struct RegexMatch<Match> {
64
64
}
65
65
66
66
extension RegexComponent {
67
- public func match( in input: String ) -> RegexMatch < Match > ? {
67
+ public func match( in input: String ) -> MatchResult < Match > ? {
68
68
_match (
69
69
input, in: input. startIndex..< input. endIndex)
70
70
}
71
- public func match( in input: Substring ) -> RegexMatch < Match > ? {
71
+ public func match( in input: Substring ) -> MatchResult < Match > ? {
72
72
_match (
73
73
input. base, in: input. startIndex..< input. endIndex)
74
74
}
@@ -77,7 +77,7 @@ extension RegexComponent {
77
77
_ input: String ,
78
78
in inputRange: Range < String . Index > ,
79
79
mode: MatchMode = . wholeString
80
- ) -> RegexMatch < Match > ? {
80
+ ) -> MatchResult < Match > ? {
81
81
let executor = Executor ( program: regex. program. loweredProgram)
82
82
do {
83
83
return try executor. match ( input, in: inputRange, mode)
@@ -88,24 +88,24 @@ extension RegexComponent {
88
88
}
89
89
90
90
extension String {
91
- public func match< R: RegexComponent > ( _ regex: R ) -> RegexMatch < R . Match > ? {
91
+ public func match< R: RegexComponent > ( _ regex: R ) -> MatchResult < R . Match > ? {
92
92
regex. match ( in: self )
93
93
}
94
94
95
95
public func match< R: RegexComponent > (
96
96
@RegexComponentBuilder _ content: ( ) -> R
97
- ) -> RegexMatch < R . Match > ? {
97
+ ) -> MatchResult < R . Match > ? {
98
98
match ( content ( ) )
99
99
}
100
100
}
101
101
extension Substring {
102
- public func match< R: RegexComponent > ( _ regex: R ) -> RegexMatch < R . Match > ? {
102
+ public func match< R: RegexComponent > ( _ regex: R ) -> MatchResult < R . Match > ? {
103
103
regex. match ( in: self )
104
104
}
105
105
106
106
public func match< R: RegexComponent > (
107
107
@RegexComponentBuilder _ content: ( ) -> R
108
- ) -> RegexMatch < R . Match > ? {
108
+ ) -> MatchResult < R . Match > ? {
109
109
match ( content ( ) )
110
110
}
111
111
}
0 commit comments