Skip to content

Commit 692237f

Browse files
authored
Rename BacktrackingScope to Local (#239)
1 parent 0108e22 commit 692237f

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

Sources/RegexBuilder/DSL.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public struct TryCapture<Output>: _BuiltinRegexComponent {
239239

240240
/// An atomic group, i.e. opens a local backtracking scope which, upon successful exit,
241241
/// discards any remaining backtracking points from within the scope
242-
public struct BacktrackingScope<Output>: _BuiltinRegexComponent {
242+
public struct Local<Output>: _BuiltinRegexComponent {
243243
public var regex: Regex<Output>
244244

245245
internal init(_ regex: Regex<Output>) {

Sources/RegexBuilder/Variadics.swift

+22-22
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ extension Repeat {
15661566
self.init(node: .repeating(expression.relative(to: 0..<Int.max), behavior, component().regex.root))
15671567
}
15681568
}
1569-
extension BacktrackingScope {
1569+
extension Local {
15701570
@_disfavoredOverload
15711571
public init<Component: RegexComponent>(
15721572
_ component: Component
@@ -1575,158 +1575,158 @@ extension BacktrackingScope {
15751575
}
15761576
}
15771577

1578-
extension BacktrackingScope {
1578+
extension Local {
15791579
@_disfavoredOverload
15801580
public init<Component: RegexComponent>(
15811581
@RegexComponentBuilder _ component: () -> Component
15821582
) where Output == Substring {
15831583
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
15841584
}
15851585
}
1586-
extension BacktrackingScope {
1586+
extension Local {
15871587
public init<W, C0, Component: RegexComponent>(
15881588
_ component: Component
15891589
) where Output == (Substring, C0), Component.Output == (W, C0) {
15901590
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
15911591
}
15921592
}
15931593

1594-
extension BacktrackingScope {
1594+
extension Local {
15951595
public init<W, C0, Component: RegexComponent>(
15961596
@RegexComponentBuilder _ component: () -> Component
15971597
) where Output == (Substring, C0), Component.Output == (W, C0) {
15981598
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
15991599
}
16001600
}
1601-
extension BacktrackingScope {
1601+
extension Local {
16021602
public init<W, C0, C1, Component: RegexComponent>(
16031603
_ component: Component
16041604
) where Output == (Substring, C0, C1), Component.Output == (W, C0, C1) {
16051605
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16061606
}
16071607
}
16081608

1609-
extension BacktrackingScope {
1609+
extension Local {
16101610
public init<W, C0, C1, Component: RegexComponent>(
16111611
@RegexComponentBuilder _ component: () -> Component
16121612
) where Output == (Substring, C0, C1), Component.Output == (W, C0, C1) {
16131613
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16141614
}
16151615
}
1616-
extension BacktrackingScope {
1616+
extension Local {
16171617
public init<W, C0, C1, C2, Component: RegexComponent>(
16181618
_ component: Component
16191619
) where Output == (Substring, C0, C1, C2), Component.Output == (W, C0, C1, C2) {
16201620
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16211621
}
16221622
}
16231623

1624-
extension BacktrackingScope {
1624+
extension Local {
16251625
public init<W, C0, C1, C2, Component: RegexComponent>(
16261626
@RegexComponentBuilder _ component: () -> Component
16271627
) where Output == (Substring, C0, C1, C2), Component.Output == (W, C0, C1, C2) {
16281628
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16291629
}
16301630
}
1631-
extension BacktrackingScope {
1631+
extension Local {
16321632
public init<W, C0, C1, C2, C3, Component: RegexComponent>(
16331633
_ component: Component
16341634
) where Output == (Substring, C0, C1, C2, C3), Component.Output == (W, C0, C1, C2, C3) {
16351635
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16361636
}
16371637
}
16381638

1639-
extension BacktrackingScope {
1639+
extension Local {
16401640
public init<W, C0, C1, C2, C3, Component: RegexComponent>(
16411641
@RegexComponentBuilder _ component: () -> Component
16421642
) where Output == (Substring, C0, C1, C2, C3), Component.Output == (W, C0, C1, C2, C3) {
16431643
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16441644
}
16451645
}
1646-
extension BacktrackingScope {
1646+
extension Local {
16471647
public init<W, C0, C1, C2, C3, C4, Component: RegexComponent>(
16481648
_ component: Component
16491649
) where Output == (Substring, C0, C1, C2, C3, C4), Component.Output == (W, C0, C1, C2, C3, C4) {
16501650
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16511651
}
16521652
}
16531653

1654-
extension BacktrackingScope {
1654+
extension Local {
16551655
public init<W, C0, C1, C2, C3, C4, Component: RegexComponent>(
16561656
@RegexComponentBuilder _ component: () -> Component
16571657
) where Output == (Substring, C0, C1, C2, C3, C4), Component.Output == (W, C0, C1, C2, C3, C4) {
16581658
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16591659
}
16601660
}
1661-
extension BacktrackingScope {
1661+
extension Local {
16621662
public init<W, C0, C1, C2, C3, C4, C5, Component: RegexComponent>(
16631663
_ component: Component
16641664
) where Output == (Substring, C0, C1, C2, C3, C4, C5), Component.Output == (W, C0, C1, C2, C3, C4, C5) {
16651665
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16661666
}
16671667
}
16681668

1669-
extension BacktrackingScope {
1669+
extension Local {
16701670
public init<W, C0, C1, C2, C3, C4, C5, Component: RegexComponent>(
16711671
@RegexComponentBuilder _ component: () -> Component
16721672
) where Output == (Substring, C0, C1, C2, C3, C4, C5), Component.Output == (W, C0, C1, C2, C3, C4, C5) {
16731673
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16741674
}
16751675
}
1676-
extension BacktrackingScope {
1676+
extension Local {
16771677
public init<W, C0, C1, C2, C3, C4, C5, C6, Component: RegexComponent>(
16781678
_ component: Component
16791679
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6) {
16801680
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16811681
}
16821682
}
16831683

1684-
extension BacktrackingScope {
1684+
extension Local {
16851685
public init<W, C0, C1, C2, C3, C4, C5, C6, Component: RegexComponent>(
16861686
@RegexComponentBuilder _ component: () -> Component
16871687
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6) {
16881688
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
16891689
}
16901690
}
1691-
extension BacktrackingScope {
1691+
extension Local {
16921692
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, Component: RegexComponent>(
16931693
_ component: Component
16941694
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7) {
16951695
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
16961696
}
16971697
}
16981698

1699-
extension BacktrackingScope {
1699+
extension Local {
17001700
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, Component: RegexComponent>(
17011701
@RegexComponentBuilder _ component: () -> Component
17021702
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7) {
17031703
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
17041704
}
17051705
}
1706-
extension BacktrackingScope {
1706+
extension Local {
17071707
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, C8, Component: RegexComponent>(
17081708
_ component: Component
17091709
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) {
17101710
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
17111711
}
17121712
}
17131713

1714-
extension BacktrackingScope {
1714+
extension Local {
17151715
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, C8, Component: RegexComponent>(
17161716
@RegexComponentBuilder _ component: () -> Component
17171717
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) {
17181718
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root))
17191719
}
17201720
}
1721-
extension BacktrackingScope {
1721+
extension Local {
17221722
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, Component: RegexComponent>(
17231723
_ component: Component
17241724
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) {
17251725
self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root))
17261726
}
17271727
}
17281728

1729-
extension BacktrackingScope {
1729+
extension Local {
17301730
public init<W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, Component: RegexComponent>(
17311731
@RegexComponentBuilder _ component: () -> Component
17321732
) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) {

Sources/VariadicsGenerator/VariadicsGenerator.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ struct VariadicsGenerator: ParsableCommand {
404404

405405
func emitAtomicGroup(arity: Int) {
406406
assert(arity >= 0)
407-
let groupName = "BacktrackingScope"
407+
let groupName = "Local"
408408
func node(builder: Bool) -> String {
409409
"""
410410
.nonCapturingGroup(.atomicNonCapturing, component\(

0 commit comments

Comments
 (0)