Skip to content

Commit 74ea98d

Browse files
authored
Merge pull request #205 from rxwei/regexmatch
Rename `RegexMatch` to `MatchResult`.
2 parents 85c7d90 + 8f48032 commit 74ea98d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Sources/_StringProcessing/Executor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct Executor {
2323
_ input: String,
2424
in inputRange: Range<String.Index>,
2525
_ mode: MatchMode
26-
) throws -> RegexMatch<Match>? {
26+
) throws -> MatchResult<Match>? {
2727
var cpu = engine.makeProcessor(
2828
input: input, bounds: inputRange, matchMode: mode)
2929

@@ -53,7 +53,7 @@ struct Executor {
5353
value = nil
5454
}
5555

56-
return RegexMatch(
56+
return MatchResult(
5757
input: input,
5858
range: range,
5959
rawCaptures: caps,
@@ -65,7 +65,7 @@ struct Executor {
6565
_ input: String,
6666
in inputRange: Range<String.Index>,
6767
_ mode: MatchMode
68-
) throws -> RegexMatch<(Substring, DynamicCaptures)>? {
68+
) throws -> MatchResult<(Substring, DynamicCaptures)>? {
6969
try match(input, in: inputRange, mode)
7070
}
7171
}

Sources/_StringProcessing/RegexDSL/Match.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@dynamicMemberLookup
13-
public struct RegexMatch<Match> {
13+
public struct MatchResult<Match> {
1414
let input: String
1515
public let range: Range<String.Index>
1616
let rawCaptures: [StructuredCapture]
@@ -64,11 +64,11 @@ public struct RegexMatch<Match> {
6464
}
6565

6666
extension RegexComponent {
67-
public func match(in input: String) -> RegexMatch<Match>? {
67+
public func match(in input: String) -> MatchResult<Match>? {
6868
_match(
6969
input, in: input.startIndex..<input.endIndex)
7070
}
71-
public func match(in input: Substring) -> RegexMatch<Match>? {
71+
public func match(in input: Substring) -> MatchResult<Match>? {
7272
_match(
7373
input.base, in: input.startIndex..<input.endIndex)
7474
}
@@ -77,7 +77,7 @@ extension RegexComponent {
7777
_ input: String,
7878
in inputRange: Range<String.Index>,
7979
mode: MatchMode = .wholeString
80-
) -> RegexMatch<Match>? {
80+
) -> MatchResult<Match>? {
8181
let executor = Executor(program: regex.program.loweredProgram)
8282
do {
8383
return try executor.match(input, in: inputRange, mode)
@@ -88,24 +88,24 @@ extension RegexComponent {
8888
}
8989

9090
extension String {
91-
public func match<R: RegexComponent>(_ regex: R) -> RegexMatch<R.Match>? {
91+
public func match<R: RegexComponent>(_ regex: R) -> MatchResult<R.Match>? {
9292
regex.match(in: self)
9393
}
9494

9595
public func match<R: RegexComponent>(
9696
@RegexComponentBuilder _ content: () -> R
97-
) -> RegexMatch<R.Match>? {
97+
) -> MatchResult<R.Match>? {
9898
match(content())
9999
}
100100
}
101101
extension Substring {
102-
public func match<R: RegexComponent>(_ regex: R) -> RegexMatch<R.Match>? {
102+
public func match<R: RegexComponent>(_ regex: R) -> MatchResult<R.Match>? {
103103
regex.match(in: self)
104104
}
105105

106106
public func match<R: RegexComponent>(
107107
@RegexComponentBuilder _ content: () -> R
108-
) -> RegexMatch<R.Match>? {
108+
) -> MatchResult<R.Match>? {
109109
match(content())
110110
}
111111
}

0 commit comments

Comments
 (0)