diff --git a/Sources/VariadicsGenerator/VariadicsGenerator.swift b/Sources/VariadicsGenerator/VariadicsGenerator.swift index 50cfb51af..f98775267 100644 --- a/Sources/VariadicsGenerator/VariadicsGenerator.swift +++ b/Sources/VariadicsGenerator/VariadicsGenerator.swift @@ -522,7 +522,7 @@ struct VariadicsGenerator: ParsableCommand { output(""" extension \(altBuilderName) { public static func buildPartialBlock<\(genericParams)>(first regex: R) -> ChoiceOf<(W, \(resultCaptures))> \(whereClause) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } @@ -554,14 +554,14 @@ struct VariadicsGenerator: ParsableCommand { public init<\(genericParams)>( _ component: R ) \(whereClauseRaw) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } \(disfavored)\ public init<\(genericParams)>( _ component: R, as reference: Reference ) \(whereClauseRaw) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } \(disfavored)\ @@ -569,12 +569,11 @@ struct VariadicsGenerator: ParsableCommand { _ component: R, transform: @escaping (Substring) -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } \(disfavored)\ @@ -583,13 +582,13 @@ struct VariadicsGenerator: ParsableCommand { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -599,12 +598,11 @@ struct VariadicsGenerator: ParsableCommand { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } \(disfavored)\ @@ -613,13 +611,13 @@ struct VariadicsGenerator: ParsableCommand { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } \(disfavored)\ @@ -627,12 +625,11 @@ struct VariadicsGenerator: ParsableCommand { _ component: R, transform: @escaping (Substring) -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } \(disfavored)\ @@ -641,13 +638,13 @@ struct VariadicsGenerator: ParsableCommand { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -658,7 +655,7 @@ struct VariadicsGenerator: ParsableCommand { public init<\(genericParams)>( @\(concatBuilderName) _ component: () -> R ) \(whereClauseRaw) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } \(disfavored)\ @@ -666,7 +663,9 @@ struct VariadicsGenerator: ParsableCommand { as reference: Reference, @\(concatBuilderName) _ component: () -> R ) \(whereClauseRaw) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } \(disfavored)\ @@ -674,12 +673,11 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } \(disfavored)\ @@ -688,13 +686,13 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -704,12 +702,11 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } \(disfavored)\ @@ -718,13 +715,13 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } \(disfavored)\ @@ -732,12 +729,11 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } \(disfavored)\ @@ -746,13 +742,13 @@ struct VariadicsGenerator: ParsableCommand { @\(concatBuilderName) _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) \(whereClauseTransformed) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } diff --git a/Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift b/Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift index 7faf4f5ff..8298dc207 100644 --- a/Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift +++ b/Sources/_MatchingEngine/Regex/Parse/CaptureStructure.swift @@ -59,54 +59,29 @@ extension CaptureStructure.Constructor { } public mutating func grouping( - _ child: T, as kind: AST.Group.Kind + _ child: T, + as kind: AST.Group.Kind ) -> CaptureStructure { - let innerCaptures = child._captureStructure(&self) switch kind { case .capture: - return .atom() + innerCaptures + return capturing(child) case .namedCapture(let name): - return .atom(name: name.value) + innerCaptures + return capturing(name: name.value, child) case .balancedCapture(let b): - return .atom(name: b.name?.value) + innerCaptures + return capturing(name: b.name?.value, child) default: precondition(!kind.isCapturing) - return innerCaptures - } - } - - public mutating func grouping( - _ child: T, - as kind: AST.Group.Kind, - withTransform transform: CaptureTransform - ) -> CaptureStructure { - let innerCaptures = child._captureStructure(&self) - switch kind { - case .capture: - return .atom(type: AnyType(transform.resultType)) + innerCaptures - case .namedCapture(let name): - return .atom(name: name.value, type: AnyType(transform.resultType)) - + innerCaptures - default: - return innerCaptures + return child._captureStructure(&self) } } - public mutating func grouping( + public mutating func capturing( + name: String? = nil, _ child: T, - as kind: AST.Group.Kind, - withType type: AnyType + withType type: AnyType? = nil ) -> CaptureStructure { - let innerCaptures = child._captureStructure(&self) - switch kind { - case .capture: - return .atom(type: type) + innerCaptures - case .namedCapture(let name): - return .atom(name: name.value, type: type) - + innerCaptures - default: - return innerCaptures - } + .atom(name: name, type: type) + + child._captureStructure(&self) } // TODO: We'll likely want/need a generalization of diff --git a/Sources/_StringProcessing/ByteCodeGen.swift b/Sources/_StringProcessing/ByteCodeGen.swift index d6389c1f6..c9599b925 100644 --- a/Sources/_StringProcessing/ByteCodeGen.swift +++ b/Sources/_StringProcessing/ByteCodeGen.swift @@ -299,31 +299,33 @@ extension Compiler.ByteCodeGen { } } - mutating func emitGroup( - _ kind: AST.Group.Kind, + mutating func emitTransform( + _ t: CaptureTransform, _ child: DSLTree.Node, - _ referenceID: ReferenceID? - ) throws -> CaptureRegister? { - guard kind.isCapturing || referenceID == nil else { - throw Unreachable("Reference ID shouldn't exist for non-capturing groups") + into cap: CaptureRegister + ) throws { + let transform = builder.makeTransformFunction { + input, range in + t(input[range]) } + builder.buildBeginCapture(cap) + try emitNode(child) + builder.buildEndCapture(cap) + builder.buildTransformCapture(cap, transform) + } + + mutating func emitNoncapturingGroup( + _ kind: AST.Group.Kind, + _ child: DSLTree.Node + ) throws { + assert(!kind.isCapturing) options.beginScope() defer { options.endScope() } - // If we have a strong type, write result directly into - // the capture register. - // - // FIXME: Unify with .groupTransform - if kind.isCapturing, case let .matcher(_, m) = child { - let cap = builder.makeCapture(id: referenceID) - emitMatcher(m, into: cap) - return cap - } - if let lookaround = kind.lookaroundKind { try emitLookaround(lookaround, child) - return nil + return } switch kind { @@ -331,22 +333,16 @@ extension Compiler.ByteCodeGen { .lookbehind, .negativeLookbehind: throw Unreachable("TODO: reason") - case .capture, .namedCapture: - let cap = builder.makeCapture(id: referenceID) - builder.buildBeginCapture(cap) - try emitNode(child) - builder.buildEndCapture(cap) - return cap + case .capture, .namedCapture, .balancedCapture: + throw Unreachable("These should produce a capture node") case .changeMatchingOptions(let optionSequence, _): options.apply(optionSequence) try emitNode(child) - return nil default: // FIXME: Other kinds... try emitNode(child) - return nil } } @@ -557,7 +553,7 @@ extension Compiler.ByteCodeGen { mutating func emitNode(_ node: DSLTree.Node) throws { switch node { - case let .alternation(children): + case let .orderedChoice(children): try emitAlternation(children) case let .concatenation(children): @@ -565,8 +561,21 @@ extension Compiler.ByteCodeGen { try emitConcatenationComponent(child) } - case let .group(kind, child, referenceID): - _ = try emitGroup(kind, child, referenceID) + case let .capture(_, refId, child): + let cap = builder.makeCapture(id: refId) + switch child { + case let .matcher(_, m): + emitMatcher(m, into: cap) + case let .transform(t, child): + try emitTransform(t, child, into: cap) + default: + builder.buildBeginCapture(cap) + try emitNode(child) + builder.buildEndCapture(cap) + } + + case let .nonCapturingGroup(kind, child): + try emitNoncapturingGroup(kind, child) case .conditional: throw Unsupported("Conditionals") @@ -605,22 +614,6 @@ extension Compiler.ByteCodeGen { case let .convertedRegexLiteral(n, _): try emitNode(n) - case let .groupTransform(kind, child, t, referenceID): - guard let cap = try emitGroup(kind, child, referenceID) else { - assertionFailure(""" - What does it mean to not have a capture to transform? - """) - return - } - - // FIXME: Is this how we want to do it? - let transform = builder.makeTransformFunction { - input, range in - t(input[range]) - } - - builder.buildTransformCapture(cap, transform) - case .absentFunction: throw Unsupported("absent function") case .consumer: @@ -629,6 +622,10 @@ extension Compiler.ByteCodeGen { case let .matcher(_, f): emitMatcher(f) + case .transform: + throw Unreachable( + "Transforms only directly inside captures") + case .characterPredicate: throw Unsupported("character predicates") diff --git a/Sources/_StringProcessing/ConsumerInterface.swift b/Sources/_StringProcessing/ConsumerInterface.swift index 47012a5c3..8bddb3a87 100644 --- a/Sources/_StringProcessing/ConsumerInterface.swift +++ b/Sources/_StringProcessing/ConsumerInterface.swift @@ -36,14 +36,17 @@ extension DSLTree.Node { case let .convertedRegexLiteral(n, _): return try n.generateConsumer(opts) - case .alternation, .conditional, .concatenation, .group, + case .orderedChoice, .conditional, .concatenation, + .capture, .nonCapturingGroup, .quantification, .trivia, .empty, - .groupTransform, .absentFunction: return nil + .absentFunction: return nil case .consumer: fatalError("FIXME: Is this where we handle them?") case .matcher: fatalError("FIXME: Is this where we handle them?") + case .transform: + fatalError("FIXME: Is this where we handle them?") case .characterPredicate: fatalError("FIXME: Is this where we handle them?") } diff --git a/Sources/_StringProcessing/PrintAsPattern.swift b/Sources/_StringProcessing/PrintAsPattern.swift index b9c5943d4..f30d8d54b 100644 --- a/Sources/_StringProcessing/PrintAsPattern.swift +++ b/Sources/_StringProcessing/PrintAsPattern.swift @@ -73,7 +73,7 @@ extension PrettyPrinter { switch node { - case let .alternation(a): + case let .orderedChoice(a): printBlock("Alternation") { printer in a.forEach { printer.printAsPattern(convertedFromAST: $0) @@ -87,10 +87,18 @@ extension PrettyPrinter { } } - case let .group(kind, child, referenceID): + case let .nonCapturingGroup(kind, child): let kind = kind._patternBase - let refIDString = referenceID.map { ", referenceID: \($0)" } ?? "" - printBlock("Group(\(kind)\(refIDString)") { printer in + printBlock("Group(\(kind))") { printer in + printer.printAsPattern(convertedFromAST: child) + } + + case let .capture(name, _, child): + var cap = "capture" + if let n = name { + cap += "(\(n))" + } + printBlock(cap) { printer in printer.printAsPattern(convertedFromAST: child) } @@ -152,8 +160,8 @@ extension PrettyPrinter { case let .customCharacterClass(ccc): printAsPattern(ccc) - case .groupTransform: - print("/* TODO: group transforms */") + case .transform: + print("/* TODO: transforms */") case .consumer: print("/* TODO: consumers */") case .matcher: diff --git a/Sources/_StringProcessing/RegexDSL/ASTConversion.swift b/Sources/_StringProcessing/RegexDSL/ASTConversion.swift index 3ec12b85c..72dd11cdf 100644 --- a/Sources/_StringProcessing/RegexDSL/ASTConversion.swift +++ b/Sources/_StringProcessing/RegexDSL/ASTConversion.swift @@ -44,11 +44,11 @@ extension AST.Node { } // Convert the top-level node without wrapping - func convert() -> DSLTree.Node { + func convert() throws -> DSLTree.Node { switch self { case let .alternation(v): let children = v.children.map(\.dslTreeNode) - return .alternation(children) + return .orderedChoice(children) case let .concatenation(v): // Coalesce adjacent children who can produce a @@ -103,7 +103,16 @@ extension AST.Node { case let .group(v): let child = v.child.dslTreeNode - return .group(v.kind.value, child) + switch v.kind.value { + case .capture: + return .capture(child) + case .namedCapture(let name): + return .capture(name: name.value, child) + case .balancedCapture: + throw Unsupported("TODO: balanced captures") + default: + return .nonCapturingGroup(v.kind.value, child) + } case let .conditional(v): let trueBranch = v.trueBranch.dslTreeNode @@ -137,7 +146,8 @@ extension AST.Node { } } - let converted = convert() + // FIXME: make total function again + let converted = try! convert() return wrap(converted) } } diff --git a/Sources/_StringProcessing/RegexDSL/Anchor.swift b/Sources/_StringProcessing/RegexDSL/Anchor.swift index da3452d5c..f8c8e759f 100644 --- a/Sources/_StringProcessing/RegexDSL/Anchor.swift +++ b/Sources/_StringProcessing/RegexDSL/Anchor.swift @@ -110,12 +110,12 @@ public func lookahead( negative: Bool = false, @RegexComponentBuilder _ content: () -> R ) -> Regex { - Regex(node: .group(negative ? .negativeLookahead : .lookahead, content().regex.root)) + Regex(node: .nonCapturingGroup(negative ? .negativeLookahead : .lookahead, content().regex.root)) } public func lookahead( _ component: R, negative: Bool = false ) -> Regex { - Regex(node: .group(negative ? .negativeLookahead : .lookahead, component.regex.root)) + Regex(node: .nonCapturingGroup(negative ? .negativeLookahead : .lookahead, component.regex.root)) } diff --git a/Sources/_StringProcessing/RegexDSL/DSLTree.swift b/Sources/_StringProcessing/RegexDSL/DSLTree.swift index 43f8aa62f..25a5943c0 100644 --- a/Sources/_StringProcessing/RegexDSL/DSLTree.swift +++ b/Sources/_StringProcessing/RegexDSL/DSLTree.swift @@ -23,18 +23,32 @@ struct DSLTree { extension DSLTree { indirect enum Node: _TreeNode { - /// ... | ... | ... - case alternation([Node]) + /// Try to match each node in order + /// + /// ... | ... | ... + case orderedChoice([Node]) - /// ... ... + /// Match each node in sequence + /// + /// ... ... case concatenation([Node]) - /// (...) - case group(AST.Group.Kind, Node, ReferenceID? = nil) + /// Capture the result of a subpattern + /// + /// (...), (?...) + case capture( + name: String? = nil, reference: ReferenceID? = nil, Node) + + /// Match a (non-capturing) subpattern / group + case nonCapturingGroup(AST.Group.Kind, Node) - /// (?(cond) true-branch | false-branch) + // TODO: Consider splitting off grouped conditions, or have + // our own kind + + /// Match a choice of two nodes based on a condition + /// + /// (?(cond) true-branch | false-branch) /// - /// TODO: Consider splitting off grouped conditions, or have our own kind case conditional( AST.Conditional.Condition.Kind, Node, Node) @@ -74,15 +88,8 @@ extension DSLTree { // MARK: - Extensibility points - /// A capturing group (TODO: is it?) with a transformation function - /// - /// TODO: Consider as a validator or constructor nested in a - /// group, or split capturing off of group. - case groupTransform( - AST.Group.Kind, - Node, - CaptureTransform, - ReferenceID? = nil) + /// Transform a range into a value, most often used inside captures + case transform(CaptureTransform, Node) case consumer(_ConsumerInterface) @@ -157,16 +164,17 @@ extension DSLTree.Node { var children: [DSLTree.Node]? { switch self { - case let .alternation(v): return v + case let .orderedChoice(v): return v case let .concatenation(v): return v case let .convertedRegexLiteral(n, _): // Treat this transparently return n.children - case let .group(_, n, _): return [n] - case let .groupTransform(_, n, _, _): return [n] - case let .quantification(_, _, n): return [n] + case let .capture(_, _, n): return [n] + case let .nonCapturingGroup(_, n): return [n] + case let .transform(_, n): return [n] + case let .quantification(_, _, n): return [n] case let .conditional(_, t, f): return [t,f] @@ -226,18 +234,17 @@ extension DSLTree { extension DSLTree.Node { var hasCapture: Bool { switch self { - case let .group(k, _, _) where k.isCapturing, - let .groupTransform(k, _, _, _) where k.isCapturing: + case .capture: return true + case let .regexLiteral(re): + return re.hasCapture case let .convertedRegexLiteral(n, re): assert(n.hasCapture == re.hasCapture) return n.hasCapture - case let .regexLiteral(re): - return re.hasCapture + default: - break + return self.children?.any(\.hasCapture) ?? false } - return self.children?.any(\.hasCapture) ?? false } } @@ -253,22 +260,22 @@ extension DSLTree.Node { _ constructor: inout CaptureStructure.Constructor ) -> CaptureStructure { switch self { - case let .alternation(children): + case let .orderedChoice(children): return constructor.alternating(children) case let .concatenation(children): return constructor.concatenating(children) - case let .group(kind, child, _): - if let type = child.matcherCaptureType { - return constructor.grouping( - child, as: kind, withType: type) + case let .capture(name, _, child): + if let type = child.valueCaptureType { + return constructor.capturing( + name: name, child, withType: type) } - return constructor.grouping(child, as: kind) + return constructor.capturing(name: name, child) - case let .groupTransform(kind, child, transform, _): - return constructor.grouping( - child, as: kind, withTransform: transform) + case let .nonCapturingGroup(kind, child): + assert(!kind.isCapturing) + return constructor.grouping(child, as: kind) case let .conditional(cond, trueBranch, falseBranch): return constructor.condition( @@ -294,17 +301,22 @@ extension DSLTree.Node { case .matcher: return .empty + case .transform(_, let child): + return child._captureStructure(&constructor) + case .customCharacterClass, .atom, .trivia, .empty, .quotedLiteral, .consumer, .characterPredicate: return .empty } } - // TODO: Unify with group transform - var matcherCaptureType: AnyType? { + /// For typed capture-producing nodes, the type produced. + var valueCaptureType: AnyType? { switch self { case let .matcher(t, _): return t + case let .transform(t, _): + return AnyType(t.resultType) default: return nil } } @@ -319,10 +331,10 @@ extension DSLTree.Node { } func appendingAlternationCase(_ newNode: DSLTree.Node) -> DSLTree.Node { - if case .alternation(let components) = self { - return .alternation(components + [newNode]) + if case .orderedChoice(let components) = self { + return .orderedChoice(components + [newNode]) } - return .alternation([self, newNode]) + return .orderedChoice([self, newNode]) } } diff --git a/Sources/_StringProcessing/RegexDSL/Options.swift b/Sources/_StringProcessing/RegexDSL/Options.swift index 5163340e0..ca20bc8f7 100644 --- a/Sources/_StringProcessing/RegexDSL/Options.swift +++ b/Sources/_StringProcessing/RegexDSL/Options.swift @@ -20,7 +20,9 @@ extension RegexComponent { let sequence = isCaseSensitive ? AST.MatchingOptionSequence(removing: [.init(.caseInsensitive, location: .fake)]) : AST.MatchingOptionSequence(adding: [.init(.caseInsensitive, location: .fake)]) - return Regex(node: .group(.changeMatchingOptions(sequence, isIsolated: false), regex.root)) + return Regex(node: .nonCapturingGroup( + .changeMatchingOptions(sequence, isIsolated: false), + regex.root)) } } diff --git a/Sources/_StringProcessing/RegexDSL/Variadics.swift b/Sources/_StringProcessing/RegexDSL/Variadics.swift index 2c7108076..7a628d937 100644 --- a/Sources/_StringProcessing/RegexDSL/Variadics.swift +++ b/Sources/_StringProcessing/RegexDSL/Variadics.swift @@ -2483,52 +2483,52 @@ public func | (lhs: R0, } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?)> where R: RegexComponent, R.Match == (W, C0) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?)> where R: RegexComponent, R.Match == (W, C0, C1) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?)> where R: RegexComponent, R.Match == (W, C0, C1, C2) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?, C5?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4, C5) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?, C5?, C6?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } extension AlternationBuilder { public static func buildPartialBlock(first regex: R) -> ChoiceOf<(W, C0?, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?)> where R: RegexComponent, R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - .init(node: .alternation([regex.regex.root])) + .init(node: .orderedChoice([regex.regex.root])) } } // MARK: - Non-builder capture arity 0 @@ -2538,14 +2538,14 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W), R.Match == W { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } @_disfavoredOverload public init( _ component: R, as reference: Reference ) where Match == (Substring, W), R.Match == W { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } @_disfavoredOverload @@ -2553,12 +2553,11 @@ extension Capture { _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } @_disfavoredOverload @@ -2567,13 +2566,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -2583,12 +2582,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } @_disfavoredOverload @@ -2597,13 +2595,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } @_disfavoredOverload @@ -2611,12 +2609,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } @_disfavoredOverload @@ -2625,13 +2622,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -2642,7 +2639,7 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W), R.Match == W { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } @_disfavoredOverload @@ -2650,7 +2647,9 @@ extension Capture { as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W), R.Match == W { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } @_disfavoredOverload @@ -2658,12 +2657,11 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } @_disfavoredOverload @@ -2672,13 +2670,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -2688,12 +2686,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } @_disfavoredOverload @@ -2702,13 +2699,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } @_disfavoredOverload @@ -2716,12 +2713,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } @_disfavoredOverload @@ -2730,13 +2726,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture), R.Match == W { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -2746,25 +2742,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0), R.Match == (W, C0) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0), R.Match == (W, C0) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -2772,13 +2767,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -2787,12 +2782,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -2800,25 +2794,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -2826,13 +2819,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -2842,26 +2835,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0), R.Match == (W, C0) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0), R.Match == (W, C0) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -2869,13 +2863,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -2884,12 +2878,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -2897,25 +2890,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -2923,13 +2915,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0), R.Match == (W, C0) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -2939,25 +2931,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -2965,13 +2956,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -2980,12 +2971,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -2993,25 +2983,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3019,13 +3008,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -3035,26 +3024,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3062,13 +3052,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -3077,12 +3067,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3090,25 +3079,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -3116,13 +3104,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1), R.Match == (W, C0, C1) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -3132,25 +3120,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3158,13 +3145,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -3173,12 +3160,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3186,25 +3172,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3212,13 +3197,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -3228,26 +3213,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3255,13 +3241,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -3270,12 +3256,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3283,25 +3268,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -3309,13 +3293,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2), R.Match == (W, C0, C1, C2) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -3325,25 +3309,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3351,13 +3334,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -3366,12 +3349,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3379,25 +3361,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3405,13 +3386,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -3421,26 +3402,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3448,13 +3430,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -3463,12 +3445,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3476,25 +3457,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -3502,13 +3482,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3), R.Match == (W, C0, C1, C2, C3) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -3518,25 +3498,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3544,13 +3523,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -3559,12 +3538,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3572,25 +3550,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3598,13 +3575,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -3614,26 +3591,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3641,13 +3619,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -3656,12 +3634,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3669,25 +3646,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -3695,13 +3671,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4), R.Match == (W, C0, C1, C2, C3, C4) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -3711,25 +3687,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3737,13 +3712,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -3752,12 +3727,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3765,25 +3739,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3791,13 +3764,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -3807,26 +3780,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3834,13 +3808,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -3849,12 +3823,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -3862,25 +3835,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -3888,13 +3860,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5), R.Match == (W, C0, C1, C2, C3, C4, C5) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -3904,25 +3876,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3930,13 +3901,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -3945,12 +3916,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -3958,25 +3928,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -3984,13 +3953,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -4000,26 +3969,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4027,13 +3997,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -4042,12 +4012,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4055,25 +4024,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -4081,13 +4049,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6), R.Match == (W, C0, C1, C2, C3, C4, C5, C6) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -4097,25 +4065,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4123,13 +4090,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -4138,12 +4105,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4151,25 +4117,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -4177,13 +4142,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -4193,26 +4158,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4220,13 +4186,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -4235,12 +4201,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4248,25 +4213,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -4274,13 +4238,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -4290,25 +4254,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4316,13 +4279,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -4331,12 +4294,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4344,25 +4306,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -4370,13 +4331,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -4386,26 +4347,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4413,13 +4375,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -4428,12 +4390,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4441,25 +4402,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -4467,13 +4427,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } } @@ -4483,25 +4443,24 @@ extension Capture { public init( _ component: R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .group(.capture, component.regex.root)) + self.init(node: .capture(component.regex.root)) } public init( _ component: R, as reference: Reference ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .group(.capture, component.regex.root, reference.id)) + self.init(node: .capture(reference: reference.id, component.regex.root)) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4509,13 +4468,13 @@ extension Capture { as reference: Reference, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component.regex.root))) } } @@ -4524,12 +4483,11 @@ extension TryCapture { _ component: R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component.regex.root))) } public init( @@ -4537,25 +4495,24 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component.regex.root))) } public init( _ component: R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component.regex.root))) } public init( @@ -4563,13 +4520,13 @@ extension TryCapture { as reference: Reference, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component.regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component.regex.root))) } } @@ -4579,26 +4536,27 @@ extension Capture { public init( @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .group(.capture, component().regex.root)) + self.init(node: .capture(component().regex.root)) } public init( as reference: Reference, @RegexComponentBuilder _ component: () -> R ) where Match == (Substring, W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .group(.capture, component().regex.root, reference.id)) + self.init(node: .capture( + reference: reference.id, + component().regex.root)) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4606,13 +4564,13 @@ extension Capture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any + }, + component().regex.root))) } } @@ -4621,12 +4579,11 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { try transform($0) as Any - })) + }, + component().regex.root))) } public init( @@ -4634,25 +4591,24 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) throws -> NewCapture ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - try transform($0) as Any - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + try transform($0) as Any + }, + component().regex.root))) } public init( @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, + self.init(node: .capture(.transform( CaptureTransform(resultType: NewCapture.self) { transform($0) as Any? - })) + }, + component().regex.root))) } public init( @@ -4660,13 +4616,13 @@ extension TryCapture { @RegexComponentBuilder _ component: () -> R, transform: @escaping (Substring) -> NewCapture? ) where Match == (Substring, NewCapture, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9), R.Match == (W, C0, C1, C2, C3, C4, C5, C6, C7, C8, C9) { - self.init(node: .groupTransform( - .capture, - component().regex.root, - CaptureTransform(resultType: NewCapture.self) { - transform($0) as Any? - }, - reference.id)) + self.init(node: .capture( + reference: reference.id, + .transform( + CaptureTransform(resultType: NewCapture.self) { + transform($0) as Any? + }, + component().regex.root))) } }