diff --git a/Sources/RegexBuilder/DSL.swift b/Sources/RegexBuilder/DSL.swift index 632f1baba..80662be41 100644 --- a/Sources/RegexBuilder/DSL.swift +++ b/Sources/RegexBuilder/DSL.swift @@ -239,7 +239,7 @@ public struct TryCapture: _BuiltinRegexComponent { /// An atomic group, i.e. opens a local backtracking scope which, upon successful exit, /// discards any remaining backtracking points from within the scope -public struct BacktrackingScope: _BuiltinRegexComponent { +public struct Local: _BuiltinRegexComponent { public var regex: Regex internal init(_ regex: Regex) { diff --git a/Sources/RegexBuilder/Variadics.swift b/Sources/RegexBuilder/Variadics.swift index 002898dfd..989e5d463 100644 --- a/Sources/RegexBuilder/Variadics.swift +++ b/Sources/RegexBuilder/Variadics.swift @@ -1566,7 +1566,7 @@ extension Repeat { self.init(node: .repeating(expression.relative(to: 0..( _ component: Component @@ -1575,7 +1575,7 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { @_disfavoredOverload public init( @RegexComponentBuilder _ component: () -> Component @@ -1583,7 +1583,7 @@ extension BacktrackingScope { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0), Component.Output == (W, C0) { @@ -1591,14 +1591,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0), Component.Output == (W, C0) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1), Component.Output == (W, C0, C1) { @@ -1606,14 +1606,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1), Component.Output == (W, C0, C1) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2), Component.Output == (W, C0, C1, C2) { @@ -1621,14 +1621,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2), Component.Output == (W, C0, C1, C2) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3), Component.Output == (W, C0, C1, C2, C3) { @@ -1636,14 +1636,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3), Component.Output == (W, C0, C1, C2, C3) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3, C4), Component.Output == (W, C0, C1, C2, C3, C4) { @@ -1651,14 +1651,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3, C4), Component.Output == (W, C0, C1, C2, C3, C4) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5), Component.Output == (W, C0, C1, C2, C3, C4, C5) { @@ -1666,14 +1666,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5), Component.Output == (W, C0, C1, C2, C3, C4, C5) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6) { @@ -1681,14 +1681,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7) { @@ -1696,14 +1696,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { @@ -1711,14 +1711,14 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) where Output == (Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8), Component.Output == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) } } -extension BacktrackingScope { +extension Local { public init( _ component: Component ) 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) { @@ -1726,7 +1726,7 @@ extension BacktrackingScope { } } -extension BacktrackingScope { +extension Local { public init( @RegexComponentBuilder _ component: () -> Component ) 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) { diff --git a/Sources/VariadicsGenerator/VariadicsGenerator.swift b/Sources/VariadicsGenerator/VariadicsGenerator.swift index 23a362dad..dbeff818c 100644 --- a/Sources/VariadicsGenerator/VariadicsGenerator.swift +++ b/Sources/VariadicsGenerator/VariadicsGenerator.swift @@ -404,7 +404,7 @@ struct VariadicsGenerator: ParsableCommand { func emitAtomicGroup(arity: Int) { assert(arity >= 0) - let groupName = "BacktrackingScope" + let groupName = "Local" func node(builder: Bool) -> String { """ .nonCapturingGroup(.atomicNonCapturing, component\(