diff --git a/Sources/RegexBuilder/Anchor.swift b/Sources/RegexBuilder/Anchor.swift index ae66310af..31a3e8a0d 100644 --- a/Sources/RegexBuilder/Anchor.swift +++ b/Sources/RegexBuilder/Anchor.swift @@ -51,7 +51,7 @@ extension Anchor: RegexComponent { } public var regex: Regex { - Regex(node: .atom(.assertion(baseAssertion))) + _RegexFactory().assertion(baseAssertion) } } @@ -159,14 +159,14 @@ public struct Lookahead: _BuiltinRegexComponent { public init( _ component: R ) where R.RegexOutput == Output { - self.init(node: .nonCapturingGroup(.lookahead, component.regex.root)) + self.init(_RegexFactory().lookaheadNonCapturing(component)) } /// Creates a lookahead from the regex generated by the given builder closure. public init( @RegexComponentBuilder _ component: () -> R ) where R.RegexOutput == Output { - self.init(node: .nonCapturingGroup(.lookahead, component().regex.root)) + self.init(_RegexFactory().lookaheadNonCapturing(component())) } } @@ -189,7 +189,7 @@ public struct NegativeLookahead: _BuiltinRegexComponent { public init( _ component: R ) where R.RegexOutput == Output { - self.init(node: .nonCapturingGroup(.negativeLookahead, component.regex.root)) + self.init(_RegexFactory().negativeLookaheadNonCapturing(component)) } /// Creates a negative lookahead from the regex generated by the given builder @@ -197,6 +197,6 @@ public struct NegativeLookahead: _BuiltinRegexComponent { public init( @RegexComponentBuilder _ component: () -> R ) where R.RegexOutput == Output { - self.init(node: .nonCapturingGroup(.negativeLookahead, component().regex.root)) + self.init(_RegexFactory().negativeLookaheadNonCapturing(component())) } } diff --git a/Sources/RegexBuilder/Builder.swift b/Sources/RegexBuilder/Builder.swift index dfafd3803..7afe254c2 100644 --- a/Sources/RegexBuilder/Builder.swift +++ b/Sources/RegexBuilder/Builder.swift @@ -15,7 +15,7 @@ @resultBuilder public enum RegexComponentBuilder { public static func buildBlock() -> Regex { - .init(node: .empty) + _RegexFactory().empty() } public static func buildPartialBlock( diff --git a/Sources/RegexBuilder/CharacterClass.swift b/Sources/RegexBuilder/CharacterClass.swift index 3a96ba363..0c34b0de2 100644 --- a/Sources/RegexBuilder/CharacterClass.swift +++ b/Sources/RegexBuilder/CharacterClass.swift @@ -31,7 +31,7 @@ public struct CharacterClass { @available(SwiftStdlib 5.7, *) extension CharacterClass: RegexComponent { public var regex: Regex { - return Regex(node: DSLTree.Node.customCharacterClass(ccc)) + _RegexFactory().customCharacterClass(ccc) } } diff --git a/Sources/RegexBuilder/DSL.swift b/Sources/RegexBuilder/DSL.swift index ecd01c07c..e758999ef 100644 --- a/Sources/RegexBuilder/DSL.swift +++ b/Sources/RegexBuilder/DSL.swift @@ -28,13 +28,6 @@ internal protocol _BuiltinRegexComponent: RegexComponent { init(_ regex: Regex) } -@available(SwiftStdlib 5.7, *) -extension _BuiltinRegexComponent { - init(node: DSLTree.Node) { - self.init(Regex(node: node)) - } -} - // MARK: - Primitive regex components @available(SwiftStdlib 5.7, *) @@ -56,7 +49,7 @@ extension Character: RegexComponent { public typealias Output = Substring public var regex: Regex { - .init(node: .atom(.char(self))) + _RegexFactory().char(self) } } @@ -65,7 +58,7 @@ extension UnicodeScalar: RegexComponent { public typealias Output = Substring public var regex: Regex { - .init(node: .atom(.scalar(self))) + _RegexFactory().scalar(self) } } @@ -90,39 +83,6 @@ extension UnicodeScalar: RegexComponent { // Note: Quantifiers are currently gyb'd. -extension DSLTree.Node { - // Individual public API functions are in the generated Variadics.swift file. - /// Generates a DSL tree node for a repeated range of the given node. - @available(SwiftStdlib 5.7, *) - static func repeating( - _ range: Range, - _ behavior: RegexRepetitionBehavior?, - _ node: DSLTree.Node - ) -> DSLTree.Node { - // TODO: Throw these as errors - assert(range.lowerBound >= 0, "Cannot specify a negative lower bound") - assert(!range.isEmpty, "Cannot specify an empty range") - - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - - switch (range.lowerBound, range.upperBound) { - case (0, Int.max): // 0... - return .quantification(.zeroOrMore, kind, node) - case (1, Int.max): // 1... - return .quantification(.oneOrMore, kind, node) - case _ where range.count == 1: // ..<1 or ...0 or any range with count == 1 - // Note: `behavior` is ignored in this case - return .quantification(.exactly(range.lowerBound), .default, node) - case (0, _): // 0..: RegexComponent { public struct OneOrMore: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -152,6 +113,7 @@ public struct OneOrMore: _BuiltinRegexComponent { public struct ZeroOrMore: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -164,6 +126,7 @@ public struct ZeroOrMore: _BuiltinRegexComponent { public struct Optionally: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -176,6 +139,7 @@ public struct Optionally: _BuiltinRegexComponent { public struct Repeat: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -217,6 +181,7 @@ public struct AlternationBuilder { public struct ChoiceOf: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -232,6 +197,7 @@ public struct ChoiceOf: _BuiltinRegexComponent { public struct Capture: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -243,6 +209,7 @@ public struct Capture: _BuiltinRegexComponent { public struct TryCapture: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -260,6 +227,7 @@ public struct TryCapture: _BuiltinRegexComponent { public struct Local: _BuiltinRegexComponent { public var regex: Regex + @usableFromInline internal init(_ regex: Regex) { self.regex = regex } @@ -274,8 +242,13 @@ public struct Reference: RegexComponent { public init(_ captureType: Capture.Type = Capture.self) {} + @usableFromInline + var _raw: Int { + id._raw + } + public var regex: Regex { - .init(node: .atom(.symbolicReference(id))) + _RegexFactory().symbolicReference(id) } } @@ -285,3 +258,12 @@ extension Regex.Match { self[reference.id] } } + +// RegexFactory's init is SPI, so we can't make an instance of one in AEIC, but +// if we hide it behind a resilience barrier we can call this function instead +// to get our instance of it. +@available(SwiftStdlib 5.7, *) +@usableFromInline +internal func makeFactory() -> _RegexFactory { + _RegexFactory() +} diff --git a/Sources/RegexBuilder/Variadics.swift b/Sources/RegexBuilder/Variadics.swift index f4adddd93..e367a2ecb 100644 --- a/Sources/RegexBuilder/Variadics.swift +++ b/Sources/RegexBuilder/Variadics.swift @@ -15,541 +15,673 @@ @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == W0, R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7), R1.RegexOutput == (W1, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7), R1.RegexOutput == (W1, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7), R1.RegexOutput == (W1, C8, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7, C8), R1.RegexOutput == (W1, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7, C8), R1.RegexOutput == (W1, C9, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)> where R0.RegexOutput == (W0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R1.RegexOutput == (W1, C10) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex where R0.RegexOutput == W0 { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0)> where R0.RegexOutput == (W0, C0) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1)> where R0.RegexOutput == (W0, C0, C1) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2)> where R0.RegexOutput == (W0, C0, C1, C2) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3)> where R0.RegexOutput == (W0, C0, C1, C2, C3) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4, C5)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4, C5, C6)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4, C5, C6, C7)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> Regex<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @@ -557,56 +689,62 @@ extension RegexComponentBuilder { @available(SwiftStdlib 5.7, *) extension Optionally { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @@ -614,24 +752,26 @@ extension ZeroOrMore { @available(SwiftStdlib 5.7, *) extension OneOrMore { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @@ -639,1171 +779,1319 @@ extension OneOrMore { @available(SwiftStdlib 5.7, *) extension Repeat { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == Substring { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == Substring, R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring, R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?)> where Component.RegexOutput == (W, C1) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1), Component.RegexOutput == (W, C1) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?), Component.RegexOutput == (W, C1), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?)> where Component.RegexOutput == (W, C1, C2) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2), Component.RegexOutput == (W, C1, C2) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?), Component.RegexOutput == (W, C1, C2), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?)> where Component.RegexOutput == (W, C1, C2, C3) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3), Component.RegexOutput == (W, C1, C2, C3) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?), Component.RegexOutput == (W, C1, C2, C3), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?)> where Component.RegexOutput == (W, C1, C2, C3, C4) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4), Component.RegexOutput == (W, C1, C2, C3, C4) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?), Component.RegexOutput == (W, C1, C2, C3, C4), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?), Component.RegexOutput == (W, C1, C2, C3, C4, C5), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?, C6?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension Optionally { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrOne, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrOne(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension RegexComponentBuilder { + @_alwaysEmitIntoClient public static func buildLimitedAvailability( _ component: Component ) -> Regex<(Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?)> where Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - .init(node: .quantification(.zeroOrOne, .default, component.regex.root)) + let factory = makeFactory() + return factory.zeroOrOne(component, nil) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension ZeroOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.zeroOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.zeroOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component, behavior)) } } @available(SwiftStdlib 5.7, *) extension OneOrMore { + @_alwaysEmitIntoClient public init( _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.oneOrMore, kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.oneOrMore(component(), behavior)) } } @available(SwiftStdlib 5.7, *) extension Repeat { + @_alwaysEmitIntoClient public init( _ component: Component, count: Int ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } + @_alwaysEmitIntoClient public init( count: Int, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } + @_alwaysEmitIntoClient public init( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.Bound == Int { - self.init(node: .repeating(expression.relative(to: 0..( _ component: Component ) where RegexOutput == Substring { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @@ -1811,780 +2099,972 @@ extension Local { extension Local { @available(SwiftStdlib 5.7, *) @_disfavoredOverload + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == Substring { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1), Component.RegexOutput == (W, C1) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1), Component.RegexOutput == (W, C1) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2), Component.RegexOutput == (W, C1, C2) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2), Component.RegexOutput == (W, C1, C2) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3), Component.RegexOutput == (W, C1, C2, C3) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3), Component.RegexOutput == (W, C1, C2, C3) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4), Component.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4), Component.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5), Component.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( _ component: Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component)) } } @available(SwiftStdlib 5.7, *) extension Local { @available(SwiftStdlib 5.7, *) + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> Component ) where RegexOutput == (Substring, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), Component.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .nonCapturingGroup(.atomicNonCapturing, component().regex.root)) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(component())) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf where R0: RegexComponent, R1: RegexComponent { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?, C5?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R1.RegexOutput == (W1, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?, C5?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0), R1.RegexOutput == (W1, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?, C5?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1), R1.RegexOutput == (W1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?, C5?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2), R1.RegexOutput == (W1, C3, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?, C5?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4?, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3), R1.RegexOutput == (W1, C4, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5?, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5?, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5?, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5?, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4), R1.RegexOutput == (W1, C5, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6?, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6?, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6?, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5), R1.RegexOutput == (W1, C6, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7?, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7?, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6), R1.RegexOutput == (W1, C7, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7), R1.RegexOutput == (W1, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8?, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7), R1.RegexOutput == (W1, C8, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock( accumulated: R0, next: R1 ) -> ChoiceOf<(Substring, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9?)> where R0: RegexComponent, R1: RegexComponent, R0.RegexOutput == (W0, C0, C1, C2, C3, C4, C5, C6, C7, C8), R1.RegexOutput == (W1, C9) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?)> where R: RegexComponent, R.RegexOutput == (W, C1) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?, C6?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?, C6?, C7?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @available(SwiftStdlib 5.7, *) extension AlternationBuilder { + @_alwaysEmitIntoClient public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?)> where R: RegexComponent, R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } // MARK: - Non-builder capture arity 0 @@ -2592,64 +3072,66 @@ extension AlternationBuilder { @available(SwiftStdlib 5.7, *) extension Capture { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W), R.RegexOutput == W { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W), R.RegexOutput == W { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -2658,67 +3140,67 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { @_disfavoredOverload + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W), R.RegexOutput == W { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W), R.RegexOutput == W { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { @_disfavoredOverload + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } @_disfavoredOverload + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture), R.RegexOutput == W { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -2726,59 +3208,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -2786,62 +3270,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1), R.RegexOutput == (W, C1) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -2849,59 +3333,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -2909,62 +3395,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2), R.RegexOutput == (W, C1, C2) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -2972,59 +3458,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3032,62 +3520,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3), R.RegexOutput == (W, C1, C2, C3) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3095,59 +3583,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3155,62 +3645,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4), R.RegexOutput == (W, C1, C2, C3, C4) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3218,59 +3708,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3278,62 +3770,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5), R.RegexOutput == (W, C1, C2, C3, C4, C5) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3341,59 +3833,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3401,62 +3895,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3464,59 +3958,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3524,62 +4020,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3587,59 +4083,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3647,62 +4145,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3710,59 +4208,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3770,62 +4270,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } @@ -3833,59 +4333,61 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( _ component: R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( _ component: R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } + @_alwaysEmitIntoClient public init( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -3893,62 +4395,62 @@ extension TryCapture { @available(SwiftStdlib 5.7, *) extension Capture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where RegexOutput == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } @available(SwiftStdlib 5.7, *) extension TryCapture { + @_alwaysEmitIntoClient public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } + @_alwaysEmitIntoClient public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) where RegexOutput == (Substring, NewCapture, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10), R.RegexOutput == (W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } diff --git a/Sources/VariadicsGenerator/VariadicsGenerator.swift b/Sources/VariadicsGenerator/VariadicsGenerator.swift index b3132c5cd..98885f6f2 100644 --- a/Sources/VariadicsGenerator/VariadicsGenerator.swift +++ b/Sources/VariadicsGenerator/VariadicsGenerator.swift @@ -257,10 +257,12 @@ struct VariadicsGenerator: ParsableCommand { output(""" \(defaultAvailableAttr) extension \(concatBuilderName) { + @_alwaysEmitIntoClient public static func buildPartialBlock<\(genericParams)>( accumulated: R0, next: R1 ) -> \(regexTypeName)<\(matchType)> \(whereClause) { - .init(node: accumulated.regex.root.appending(next.regex.root)) + let factory = makeFactory() + return factory.accumulate(accumulated, next) } } @@ -273,6 +275,7 @@ struct VariadicsGenerator: ParsableCommand { \(defaultAvailableAttr) extension \(concatBuilderName) { \(defaultAvailableAttr) + @_alwaysEmitIntoClient public static func buildPartialBlock( _ component: Component, _ behavior: RegexRepetitionBehavior? = nil ) \(params.whereClauseForInit) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.\(kind.astQuantifierAmount), kind, component.regex.root)) + let factory = makeFactory() + self.init(factory.\(kind.astQuantifierAmount)(component, behavior)) } } \(defaultAvailableAttr) extension \(kind.rawValue) { \(params.disfavored)\ + @_alwaysEmitIntoClient public init<\(params.genericParams)>( _ behavior: RegexRepetitionBehavior? = nil, @\(concatBuilderName) _ component: () -> Component ) \(params.whereClauseForInit) { - let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default - self.init(node: .quantification(.\(kind.astQuantifierAmount), kind, component().regex.root)) + let factory = makeFactory() + self.init(factory.\(kind.astQuantifierAmount)(component(), behavior)) } } @@ -411,10 +417,12 @@ struct VariadicsGenerator: ParsableCommand { """ \(defaultAvailableAttr) extension \(concatBuilderName) { + @_alwaysEmitIntoClient public static func buildLimitedAvailability<\(params.genericParams)>( _ component: Component ) -> \(regexTypeName)<\(params.matchType)> \(params.whereClause) { - .init(node: .quantification(.\(kind.astQuantifierAmount), .default, component.regex.root)) + let factory = makeFactory() + return factory.\(kind.astQuantifierAmount)(component, nil) } } """ : "") @@ -428,9 +436,7 @@ struct VariadicsGenerator: ParsableCommand { let groupName = "Local" func node(builder: Bool) -> String { """ - .nonCapturingGroup(.atomicNonCapturing, component\( - builder ? "()" : "" - ).regex.root) + component\(builder ? "()" : "") """ } @@ -457,10 +463,12 @@ struct VariadicsGenerator: ParsableCommand { extension \(groupName) { \(defaultAvailableAttr) \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( _ component: Component ) \(whereClauseForInit) { - self.init(node: \(node(builder: false))) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(\(node(builder: false)))) } } @@ -468,10 +476,12 @@ struct VariadicsGenerator: ParsableCommand { extension \(groupName) { \(defaultAvailableAttr) \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( @\(concatBuilderName) _ component: () -> Component ) \(whereClauseForInit) { - self.init(node: \(node(builder: true))) + let factory = makeFactory() + self.init(factory.atomicNonCapturing(\(node(builder: true)))) } } @@ -490,41 +500,47 @@ struct VariadicsGenerator: ParsableCommand { \(defaultAvailableAttr) extension Repeat { \(params.disfavored)\ + @_alwaysEmitIntoClient public init<\(params.genericParams)>( _ component: Component, count: Int ) \(params.whereClauseForInit) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component.regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component)) } \(params.disfavored)\ + @_alwaysEmitIntoClient public init<\(params.genericParams)>( count: Int, @\(concatBuilderName) _ component: () -> Component ) \(params.whereClauseForInit) { assert(count > 0, "Must specify a positive count") - // TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)` - self.init(node: .quantification(.exactly(count), .default, component().regex.root)) + let factory = makeFactory() + self.init(factory.exactly(count, component())) } \(params.disfavored)\ + @_alwaysEmitIntoClient public init<\(params.genericParams), R: RangeExpression>( _ component: Component, _ expression: R, _ behavior: RegexRepetitionBehavior? = nil ) \(params.repeatingWhereClause) { - self.init(node: .repeating(expression.relative(to: 0..( _ expression: R, _ behavior: RegexRepetitionBehavior? = nil, @\(concatBuilderName) _ component: () -> Component ) \(params.repeatingWhereClause) { - self.init(node: .repeating(expression.relative(to: 0..( accumulated: R0, next: R1 ) -> ChoiceOf<\(matchType)> \(whereClause) { - .init(node: accumulated.regex.root.appendingAlternationCase(next.regex.root)) + let factory = makeFactory() + return .init(factory.accumulateAlternation(accumulated, next)) } } @@ -599,8 +617,10 @@ struct VariadicsGenerator: ParsableCommand { output(""" \(defaultAvailableAttr) extension \(altBuilderName) { + @_alwaysEmitIntoClient public static func buildPartialBlock<\(genericParams)>(first regex: R) -> ChoiceOf<(W, \(resultCaptures))> \(whereClause) { - .init(node: .orderedChoice([regex.regex.root])) + let factory = makeFactory() + return .init(factory.orderedChoice(regex)) } } @@ -630,64 +650,66 @@ struct VariadicsGenerator: ParsableCommand { \(defaultAvailableAttr) extension Capture { \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( _ component: R ) \(whereClauseRaw) { - self.init(node: .capture(component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( _ component: R, as reference: Reference ) \(whereClauseRaw) { - self.init(node: .capture(reference: reference.id, component.regex.root)) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( _ component: R, transform: @escaping (W) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, nil, transform)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component, reference._raw, transform)) } } \(defaultAvailableAttr) extension TryCapture { \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( _ component: R, transform: @escaping (W) throws -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .capture( - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, nil, transform)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( _ component: R, as reference: Reference, transform: @escaping (W) throws -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .capture( - reference: reference.id, - component.regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component, reference._raw, transform)) } } @@ -696,67 +718,67 @@ struct VariadicsGenerator: ParsableCommand { \(defaultAvailableAttr) extension Capture { \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( @\(concatBuilderName) _ component: () -> R ) \(whereClauseRaw) { - self.init(node: .capture(component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component())) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams)>( as reference: Reference, @\(concatBuilderName) _ component: () -> R ) \(whereClauseRaw) { - self.init(node: .capture( - reference: reference.id, - component().regex.root)) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( @\(concatBuilderName) _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), nil, transform)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( as reference: Reference, @\(concatBuilderName) _ component: () -> R, transform: @escaping (W) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.capture(component(), reference._raw, transform)) } } \(defaultAvailableAttr) extension TryCapture { \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( @\(concatBuilderName) _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .capture( - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), nil, transform)) } \(disfavored)\ + @_alwaysEmitIntoClient public init<\(genericParams), NewCapture>( as reference: Reference, @\(concatBuilderName) _ component: () -> R, transform: @escaping (W) throws -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .capture( - reference: reference.id, - component().regex.root, - CaptureTransform(transform))) + let factory = makeFactory() + self.init(factory.captureOptional(component(), reference._raw, transform)) } } diff --git a/Sources/_StringProcessing/Regex/Core.swift b/Sources/_StringProcessing/Regex/Core.swift index b96ccda58..6e00fc391 100644 --- a/Sources/_StringProcessing/Regex/Core.swift +++ b/Sources/_StringProcessing/Regex/Core.swift @@ -122,13 +122,11 @@ extension Regex { @available(SwiftStdlib 5.7, *) extension Regex { - @_spi(RegexBuilder) - public var root: DSLTree.Node { + var root: DSLTree.Node { program.tree.root } - @_spi(RegexBuilder) - public init(node: DSLTree.Node) { + init(node: DSLTree.Node) { self.program = Program(tree: .init(node)) } } diff --git a/Sources/_StringProcessing/Regex/DSLTree.swift b/Sources/_StringProcessing/Regex/DSLTree.swift index 72c5f1526..f28d5a8b4 100644 --- a/Sources/_StringProcessing/Regex/DSLTree.swift +++ b/Sources/_StringProcessing/Regex/DSLTree.swift @@ -21,8 +21,7 @@ public struct DSLTree { } extension DSLTree { - @_spi(RegexBuilder) - public indirect enum Node { + indirect enum Node { /// Matches each node in order. /// /// ... | ... | ... @@ -99,8 +98,7 @@ extension DSLTree { } extension DSLTree { - @_spi(RegexBuilder) - public enum QuantificationKind { + enum QuantificationKind { /// The default quantification kind, as set by options. case `default` /// An explicitly chosen kind, overriding any options. @@ -221,21 +219,18 @@ extension Unicode.GeneralCategory { } // CollectionConsumer -@_spi(RegexBuilder) -public typealias _ConsumerInterface = ( +typealias _ConsumerInterface = ( String, Range ) throws -> String.Index? // Type producing consume // TODO: better name -@_spi(RegexBuilder) -public typealias _MatcherInterface = ( +typealias _MatcherInterface = ( String, String.Index, Range ) throws -> (String.Index, Any)? // Character-set (post grapheme segmentation) -@_spi(RegexBuilder) -public typealias _CharacterPredicateInterface = ( +typealias _CharacterPredicateInterface = ( (Character) -> Bool ) @@ -339,16 +334,14 @@ extension DSLTree.Node { } extension DSLTree.Node { - @_spi(RegexBuilder) - public func appending(_ newNode: DSLTree.Node) -> DSLTree.Node { + func appending(_ newNode: DSLTree.Node) -> DSLTree.Node { if case .concatenation(let components) = self { return .concatenation(components + [newNode]) } return .concatenation([self, newNode]) } - @_spi(RegexBuilder) - public func appendingAlternationCase( + func appendingAlternationCase( _ newNode: DSLTree.Node ) -> DSLTree.Node { if case .orderedChoice(let components) = self { @@ -363,14 +356,21 @@ public struct ReferenceID: Hashable { private static var counter: Int = 0 var base: Int + public var _raw: Int { + base + } + public init() { base = Self.counter Self.counter += 1 } + + init(_ base: Int) { + self.base = base + } } -@_spi(RegexBuilder) -public struct CaptureTransform: Hashable, CustomStringConvertible { +struct CaptureTransform: Hashable, CustomStringConvertible { enum Closure { /// A failable transform. case failable((Any) throws -> Any?) @@ -391,7 +391,7 @@ public struct CaptureTransform: Hashable, CustomStringConvertible { self.closure = closure } - public init( + init( _ userSpecifiedTransform: @escaping (Argument) throws -> Result ) { let closure: Closure @@ -409,7 +409,7 @@ public struct CaptureTransform: Hashable, CustomStringConvertible { closure: closure) } - public init( + init( _ userSpecifiedTransform: @escaping (Argument) throws -> Result? ) { let closure: Closure @@ -465,18 +465,18 @@ public struct CaptureTransform: Hashable, CustomStringConvertible { } } - public static func == (lhs: CaptureTransform, rhs: CaptureTransform) -> Bool { + static func == (lhs: CaptureTransform, rhs: CaptureTransform) -> Bool { unsafeBitCast(lhs.closure, to: (Int, Int).self) == unsafeBitCast(rhs.closure, to: (Int, Int).self) } - public func hash(into hasher: inout Hasher) { + func hash(into hasher: inout Hasher) { let (fn, ctx) = unsafeBitCast(closure, to: (Int, Int).self) hasher.combine(fn) hasher.combine(ctx) } - public var description: String { + var description: String { "" } } @@ -772,3 +772,36 @@ extension DSLTree.Atom { } } } + +extension DSLTree.Node { + // Individual public API functions are in the generated Variadics.swift file. + /// Generates a DSL tree node for a repeated range of the given node. + @available(SwiftStdlib 5.7, *) + static func repeating( + _ range: Range, + _ behavior: RegexRepetitionBehavior?, + _ node: DSLTree.Node + ) -> DSLTree.Node { + // TODO: Throw these as errors + assert(range.lowerBound >= 0, "Cannot specify a negative lower bound") + assert(!range.isEmpty, "Cannot specify an empty range") + + let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default + + switch (range.lowerBound, range.upperBound) { + case (0, Int.max): // 0... + return .quantification(.zeroOrMore, kind, node) + case (1, Int.max): // 1... + return .quantification(.oneOrMore, kind, node) + case _ where range.count == 1: // ..<1 or ...0 or any range with count == 1 + // Note: `behavior` is ignored in this case + return .quantification(.exactly(range.lowerBound), .default, node) + case (0, _): // 0..( + _ left: some RegexComponent, + _ right: some RegexComponent + ) -> Regex { + .init(node: left.regex.root.appending(right.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func accumulateAlternation( + _ left: some RegexComponent, + _ right: some RegexComponent + ) -> Regex { + .init(node: left.regex.root.appendingAlternationCase(right.regex.root)) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func assertion( + _ kind: DSLTree._AST.AssertionKind + ) -> Regex { + .init(node: .atom(.assertion(kind))) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func empty() -> Regex { + .init(node: .empty) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func scalar( + _ scalar: Unicode.Scalar + ) -> Regex { + .init(node: .atom(.scalar(scalar))) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func char( + _ char: Character + ) -> Regex { + .init(node: .atom(.char(char))) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func symbolicReference( + _ reference: ReferenceID + ) -> Regex { + .init(node: .atom(.symbolicReference(reference))) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func customCharacterClass( + _ ccc: DSLTree.CustomCharacterClass + ) -> Regex { + .init(node: .customCharacterClass(ccc)) + } + + @available(SwiftStdlib 5.7, *) + public func zeroOrOne( + _ component: some RegexComponent, + _ behavior: RegexRepetitionBehavior? = nil + ) -> Regex { + let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default + return .init(node: .quantification(.zeroOrOne, kind, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func zeroOrMore( + _ component: some RegexComponent, + _ behavior: RegexRepetitionBehavior? = nil + ) -> Regex { + let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default + return .init(node: .quantification(.zeroOrMore, kind, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func oneOrMore( + _ component: some RegexComponent, + _ behavior: RegexRepetitionBehavior? = nil + ) -> Regex { + let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.dslTreeKind) } ?? .default + return .init(node: .quantification(.oneOrMore, kind, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func exactly( + _ count: Int, + _ component: some RegexComponent + ) -> Regex { + .init(node: .quantification(.exactly(count), .default, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func repeating( + _ range: Range, + _ behavior: RegexRepetitionBehavior?, + _ component: some RegexComponent + ) -> Regex { + .init(node: .repeating(range, behavior, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func atomicNonCapturing( + _ component: some RegexComponent + ) -> Regex { + .init(node: .nonCapturingGroup(.atomicNonCapturing, component.regex.root)) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func lookaheadNonCapturing( + _ component: some RegexComponent + ) -> Regex { + .init(node: .nonCapturingGroup(.lookahead, component.regex.root)) + } + + @_spi(RegexBuilder) + @available(SwiftStdlib 5.7, *) + public func negativeLookaheadNonCapturing( + _ component: some RegexComponent + ) -> Regex { + .init(node: .nonCapturingGroup(.negativeLookahead, component.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func orderedChoice( + _ component: some RegexComponent + ) -> Regex { + .init(node: .orderedChoice([component.regex.root])) + } + + @available(SwiftStdlib 5.7, *) + public func capture( + _ r: some RegexComponent + ) -> Regex { + .init(node: .capture(r.regex.root)) + } + + @available(SwiftStdlib 5.7, *) + public func capture( + _ component: some RegexComponent, + _ reference: Int + ) -> Regex { + .init(node: .capture( + reference: ReferenceID(reference), + component.regex.root + )) + } + + @available(SwiftStdlib 5.7, *) + public func capture( + _ component: some RegexComponent, + _ reference: Int? = nil, + _ transform: @escaping (W) throws -> NewCapture + ) -> Regex { + .init(node: .capture( + reference: reference.map { ReferenceID($0) }, + component.regex.root, + CaptureTransform(transform) + )) + } + + @available(SwiftStdlib 5.7, *) + public func captureOptional( + _ component: some RegexComponent, + _ reference: Int? = nil, + _ transform: @escaping (W) throws -> NewCapture? + ) -> Regex { + .init(node: .capture( + reference: reference.map { ReferenceID($0) }, + component.regex.root, + CaptureTransform(transform) + )) + } +}