@@ -378,9 +378,10 @@ struct VariadicsGenerator: ParsableCommand {
378
378
\( params. disfavored) \
379
379
public init< \( params. genericParams) >(
380
380
_ component: Component,
381
- _ behavior: QuantificationBehavior = .eagerly
381
+ _ behavior: QuantificationBehavior? = nil
382
382
) \( params. whereClauseForInit) {
383
- self.init(node: .quantification(. \( kind. astQuantifierAmount) , behavior.astKind, component.regex.root))
383
+ let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.astKind) } ?? .default
384
+ self.init(node: .quantification(. \( kind. astQuantifierAmount) , kind, component.regex.root))
384
385
}
385
386
}
386
387
@@ -389,10 +390,11 @@ struct VariadicsGenerator: ParsableCommand {
389
390
\( defaultAvailableAttr)
390
391
\( params. disfavored) \
391
392
public init< \( params. genericParams) >(
392
- _ behavior: QuantificationBehavior = .eagerly ,
393
+ _ behavior: QuantificationBehavior? = nil ,
393
394
@ \( concatBuilderName) _ component: () -> Component
394
395
) \( params. whereClauseForInit) {
395
- self.init(node: .quantification(. \( kind. astQuantifierAmount) , behavior.astKind, component().regex.root))
396
+ let kind: DSLTree.QuantificationKind = behavior.map { .explicit($0.astKind) } ?? .default
397
+ self.init(node: .quantification(. \( kind. astQuantifierAmount) , kind, component().regex.root))
396
398
}
397
399
}
398
400
@@ -404,7 +406,7 @@ struct VariadicsGenerator: ParsableCommand {
404
406
public static func buildLimitedAvailability< \( params. genericParams) >(
405
407
_ component: Component
406
408
) -> \( regexTypeName) < \( params. matchType) > \( params. whereClause) {
407
- .init(node: .quantification(. \( kind. astQuantifierAmount) , .eager , component.regex.root))
409
+ .init(node: .quantification(. \( kind. astQuantifierAmount) , .default , component.regex.root))
408
410
}
409
411
}
410
412
""" : " " )
@@ -488,7 +490,7 @@ struct VariadicsGenerator: ParsableCommand {
488
490
) \( params. whereClauseForInit) {
489
491
assert(count > 0, " Must specify a positive count " )
490
492
// TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)`
491
- self.init(node: .quantification(.exactly(.init(faking: count)), .eager , component.regex.root))
493
+ self.init(node: .quantification(.exactly(.init(faking: count)), .default , component.regex.root))
492
494
}
493
495
494
496
\( defaultAvailableAttr)
@@ -499,15 +501,15 @@ struct VariadicsGenerator: ParsableCommand {
499
501
) \( params. whereClauseForInit) {
500
502
assert(count > 0, " Must specify a positive count " )
501
503
// TODO: Emit a warning about `repeatMatch(count: 0)` or `repeatMatch(count: 1)`
502
- self.init(node: .quantification(.exactly(.init(faking: count)), .eager , component().regex.root))
504
+ self.init(node: .quantification(.exactly(.init(faking: count)), .default , component().regex.root))
503
505
}
504
506
505
507
\( defaultAvailableAttr)
506
508
\( params. disfavored) \
507
509
public init< \( params. genericParams) , R: RangeExpression>(
508
510
_ component: Component,
509
511
_ expression: R,
510
- _ behavior: QuantificationBehavior = .eagerly
512
+ _ behavior: QuantificationBehavior? = nil
511
513
) \( params. repeatingWhereClause) {
512
514
self.init(node: .repeating(expression.relative(to: 0..<Int.max), behavior, component.regex.root))
513
515
}
@@ -516,7 +518,7 @@ struct VariadicsGenerator: ParsableCommand {
516
518
\( params. disfavored) \
517
519
public init< \( params. genericParams) , R: RangeExpression>(
518
520
_ expression: R,
519
- _ behavior: QuantificationBehavior = .eagerly ,
521
+ _ behavior: QuantificationBehavior? = nil ,
520
522
@ \( concatBuilderName) _ component: () -> Component
521
523
) \( params. repeatingWhereClause) {
522
524
self.init(node: .repeating(expression.relative(to: 0..<Int.max), behavior, component().regex.root))
0 commit comments