-
Notifications
You must be signed in to change notification settings - Fork 45
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
Blacklist sub-rules of Transforms #211
Comments
@ghnp5, indeed, it might be a part of #208. I think the optimize method may accept In particular, the caller may look like: regexpTree.optimize(/\[quote\]/, {
perTransformOptions: {
charEscapeUnescape: {
// Avoid rewriting /\[quote\]/ as /\[quote]/
excludedChars: /[\[\]]/,
},
charClassToMeta: {
// Avoid rewriting [0-9a-z] as [\da-z]
excludedClasses: [/[0-9]/],
},
}
}); Then the corresponding transforms have to be updated to accept those options and handle. A caveat: such granular checks and exclusions may slow down transforms. I may take a look into this, and will appreciate a PR on this too in case you'll reach it earlier than me. In addition, to faster unblock yourself, you can just write your own extra transform which translates |
also transformation from [0-9] to [\d] is not safe as they aren't equivalent |
@b-fett is it Perl-specific or universal? We might need to start introducing |
there are many cases gpt says the next:
|
@b-fett thanks, I think we can disable this specific transform if |
Hello,
Is there a way to disable sub-rules of transforms, without disabling the whole transform?
For example, I don't want to disable all "charEscapeUnescape", but only the sub-rule for "]".
For readability, I don't want to optimize to
/\[quote]/
.But fo all other unnecessary escapes, I want optimizations.
Also, similar for "charClassToMeta". Is there a way I could disable only the conversion from
[0-9a-z]
to[\da-z]
?Thank you!
EDIT - this might be related to #208
The text was updated successfully, but these errors were encountered: