Regex part deux - INTERPOLATION_SYNTAX #669
Merged
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.
Thanks for the great gem.
I was curious what I could do with
INTERPOLATION_SYNTAX
.This has 3 commits.
INTERPOLATION_SYNTAX
with minor ruby changes.INTERPOLATION_SYNTAX
and just usingTOKENIZER
.I ran tests with ruby 2.6.9 and 3.0.6
Not sure when the syntax change for the substring was introduced
str[1..]
.rubocop suggested I change my
str[1..-1]
over to that.They also said the backslash in
[^\}]
was not necessary.Let me know if you would like to keep
INTERPOLATION_SYNTAX
and I can throw away the second commit. Or if you like it, I can squash the two.Something was nice about the multiple capture groups in the regular expression, but I didn't feel the complexity (from pcre's perspective) bought too much. But since this is your project, it is your call.
Also in reference to #667
As I started to run numbers, I'm feeling less and less like this is a DoS. So maybe I'm not the right person to state an opinion on whether these changes are necessary.
From the commit messages
But that hasn't reached the
TOKENIZER
performance, so the second commit went with that one: