Skip to content

Commit 978cce1

Browse files
committed
Rename CustomPrefixMatchRC to CustomConsumingRegexComponent
1 parent 2745de2 commit 978cce1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/_StringProcessing/Regex/CustomComponents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@available(SwiftStdlib 5.7, *)
1313
/// A protocol allowing custom types to function as regex components by
1414
/// providing the raw functionality backing `prefixMatch`.
15-
public protocol CustomPrefixMatchRegexComponent: RegexComponent {
15+
public protocol CustomConsumingRegexComponent: RegexComponent {
1616
/// Process the input string within the specified bounds, beginning at the given index, and return
1717
/// the end position (upper bound) of the match and the produced output.
1818
/// - Parameters:
@@ -29,7 +29,7 @@ public protocol CustomPrefixMatchRegexComponent: RegexComponent {
2929
}
3030

3131
@available(SwiftStdlib 5.7, *)
32-
extension CustomPrefixMatchRegexComponent {
32+
extension CustomConsumingRegexComponent {
3333
public var regex: Regex<RegexOutput> {
3434
let node: DSLTree.Node = .matcher(.init(RegexOutput.self), { input, index, bounds in
3535
try consuming(input, startingAt: index, in: bounds)

Tests/RegexBuilderTests/CustomTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import _StringProcessing
1414
@testable import RegexBuilder
1515

1616
// A nibbler processes a single character from a string
17-
private protocol Nibbler: CustomPrefixMatchRegexComponent {
17+
private protocol Nibbler: CustomConsumingRegexComponent {
1818
func nibble(_: Character) -> RegexOutput?
1919
}
2020

@@ -49,7 +49,7 @@ private struct Asciibbler: Nibbler {
4949
}
5050
}
5151

52-
private struct IntParser: CustomPrefixMatchRegexComponent {
52+
private struct IntParser: CustomConsumingRegexComponent {
5353
struct ParseError: Error, Hashable {}
5454
typealias RegexOutput = Int
5555
func consuming(_ input: String,
@@ -71,7 +71,7 @@ private struct IntParser: CustomPrefixMatchRegexComponent {
7171
}
7272
}
7373

74-
private struct CurrencyParser: CustomPrefixMatchRegexComponent {
74+
private struct CurrencyParser: CustomConsumingRegexComponent {
7575
enum Currency: String, Hashable {
7676
case usd = "USD"
7777
case ntd = "NTD"

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class RegexDSLTests: XCTestCase {
850850
var patch: Int
851851
var dev: String?
852852
}
853-
struct SemanticVersionParser: CustomPrefixMatchRegexComponent {
853+
struct SemanticVersionParser: CustomConsumingRegexComponent {
854854
typealias RegexOutput = SemanticVersion
855855
func consuming(
856856
_ input: String,

0 commit comments

Comments
 (0)