make generateLogic more readable with named matches #600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I started looking at #590 and noticed one of the problems with fixing that is the use of vararg: generateLogic failed to work because it could not match that 'vararg'.
So I fixed that. Because I could not figure out the index-based regex, I moved everything to named groups first and then added the vararg. I don't like the way I had to abuse string interpolation to specify the named group referenced, but that's the best I could come up with.
Note that the vararg does not get 'expanded', so the underlying code needs to accept an
Array
instead of the vararg.I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.