Commit eb2628e
committed
Switch to variadic quantifiers
This converts the RegexBuilder quantifiers to use variadic generics
instead of explicit overloads. This transition uses a particular
generic pattern so that a variadic number of output parameters are
captured correctly, without matching a "zero captures" component
as having `()` as its output type. To accomplish this, the generic
parameters for each quantification method are like:
some RegexComponent<(W, Capture0, repeat each Capture)>
The presence of `Capture0` requires that at least one sub-capture
beyond the whole match is present. In addition to the variadic
versions, unconstrained versions of each initializer are included,
marked `@_disfavoredOverload`. These are only selected when the
component's output type is a single type (e.g. `Regex<Substring>`).1 parent 9643f8d commit eb2628e
1 file changed
+40
-2136
lines changed
0 commit comments