-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Regexp caching #354
Regexp caching #354
Conversation
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.
I don't know if you want to address it in this MR, but I do want to call out that we're still applying (?m)
implicitly on whitespace
:
Line 96 in 0240667
return re.compile(f'(?m){whitespace}') |
You've updated the ebnf grammar to specify this flag explicitly
Line 2 in 0240667
@@whitespace :: /(?m)\s+/ |
which was necessary when it was an re.Pattern
but the parsing will be hitting the str
branch of this logic. It may make sense to just remove that (?m)
and update the documentation to say users need to update their patterns as necessary.
seems ok so far, just a question on the |
Yes! There may be more improvements in further issues and pull requests. I'd like to merge and make a release now to get feedback about what projects we broke ASAP. |
Last minor fixup. Since you're updating Lines 121 to 127 in f3fb92a
Should be OK after this minor change |
@apalala do you want me to merge this or do you want to? |
Caching by
re.compile()
is mostly undocumented and unreliable.Implement caching of compiled regexes for the few critical ones in TatSu configurations.