File tree 3 files changed +8
-8
lines changed 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import RegexBuilder
16
16
@available ( SwiftStdlib 5 . 7 , * )
17
17
class RegexConsumerTests : XCTestCase {
18
18
func testMatches( ) {
19
- let regex = Capture ( OneOrMore ( . digit) ) { 2 * Int( $0) ! }
19
+ let regex = Capture < ( Substring , Int ) > ( OneOrMore ( . digit) ) { 2 * Int( $0) ! }
20
20
let str = " foo 160 bar 99 baz "
21
21
XCTAssertEqual ( str. matches ( of: regex) . map ( \. output. 1 ) , [ 320 , 198 ] )
22
22
}
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ private struct IntParser: CustomConsumingRegexComponent {
64
64
guard index != bounds. upperBound else { return nil }
65
65
66
66
let r = Regex {
67
- Capture ( OneOrMore ( . digit) ) { Int ( $0) }
67
+ Capture < ( Substring , Int ? ) > ( OneOrMore ( . digit) ) { Int ( $0) }
68
68
}
69
69
70
70
guard let match = input [ index..< bounds. upperBound] . prefixMatch ( of: r) ,
@@ -694,7 +694,7 @@ class CustomRegexComponentTests: XCTestCase {
694
694
OneOrMore {
695
695
CharacterClass ( " A " ... " Z " )
696
696
OneOrMore ( CharacterClass ( " a " ... " z " ) )
697
- Capture ( Repeat ( . digit, count: 2 ) ) { Int ( $0) }
697
+ Capture < ( Substring , Int ? ) > ( Repeat ( . digit, count: 2 ) ) { Int ( $0) }
698
698
}
699
699
}
700
700
Original file line number Diff line number Diff line change @@ -1091,7 +1091,7 @@ class RegexDSLTests: XCTestCase {
1091
1091
OneOrMore ( " a " )
1092
1092
Capture {
1093
1093
TryCapture ( " b " , transform: { Int ( $0) } )
1094
- ZeroOrMore (
1094
+ ZeroOrMore < ( Substring , Double ? ) > (
1095
1095
TryCapture ( " c " , transform: { Double ( $0) } )
1096
1096
)
1097
1097
Optionally ( " e " )
@@ -1542,12 +1542,12 @@ class RegexDSLTests: XCTestCase {
1542
1542
in bounds: Range < String . Index >
1543
1543
) throws -> ( upperBound: String . Index , output: SemanticVersion ) ? {
1544
1544
let regex = Regex {
1545
- TryCapture ( OneOrMore ( . digit) ) { Int ( $0) }
1545
+ TryCapture < ( Substring , Int ) > ( OneOrMore ( . digit) ) { Int ( $0) }
1546
1546
" . "
1547
- TryCapture ( OneOrMore ( . digit) ) { Int ( $0) }
1547
+ TryCapture < ( Substring , Int ) > ( OneOrMore ( . digit) ) { Int ( $0) }
1548
1548
Optionally {
1549
1549
" . "
1550
- TryCapture ( OneOrMore ( . digit) ) { Int ( $0) }
1550
+ TryCapture < ( Substring , Int ) > ( OneOrMore ( . digit) ) { Int ( $0) }
1551
1551
}
1552
1552
Optionally {
1553
1553
" - "
@@ -1876,7 +1876,7 @@ extension RegexDSLTests {
1876
1876
" : "
1877
1877
regexWithTooManyCaptures
1878
1878
" : "
1879
- TryCapture ( OneOrMore ( . word) ) { Int ( $0) }
1879
+ TryCapture < ( Substring , Int ) > ( OneOrMore ( . word) ) { Int ( $0) }
1880
1880
#/:(\d+):/#
1881
1881
}
1882
1882
XCTAssert ( type ( of: dslWithTooManyCaptures) . self
You can’t perform that action at this time.
0 commit comments