-
Notifications
You must be signed in to change notification settings - Fork 50
Add repeatMatch
functions to DSL
#161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
These allow you to spell literal expressions like `a{3,}` or `a{2,5}`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll let @rxwei comment on generator script.
My vote is for
repeat {
...
}
repeat(3...) {
...
}
I think repeat
as a verb is fine alongside capture
, but I'm not a picky grammar namer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'd vote for repeat
as the name.
@@ -145,6 +145,34 @@ postfix operator .? | |||
postfix operator .* | |||
postfix operator .+ | |||
|
|||
/// Generates a DSLTree node for a repeated range of the given DSLTree node. | |||
/// Individual public API functions are in the generated Variadics.swift file. | |||
internal func _repeatingNode( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: How about a static method DSLTree.Node.repeating(_:_:_:)
|
@swift-ci Please test |
These allow you to spell literal expressions like `a{3,}` or `a{2,5}` while using the Regex DSL.
These allow you to spell literal expressions like
a{3,}
ora{2,5}
when using the DSL. I've gone with therepeatMatch
name to align a bit withrepeatElement
in the stdlib, and becauserepeating(...)
sounds too much to my ear like you have to repeat the matched text, not repeat the match, if that makes sense.Usage: