-
Notifications
You must be signed in to change notification settings - Fork 699
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
Compute TokenList.value dynamically (v2) #710
base: master
Are you sure you want to change the base?
Compute TokenList.value dynamically (v2) #710
Conversation
Avoid stripping T.Comment tokens contained within an sql.Comment before stripping the sql.Comment itself. Now an sql.Comment token will be stripped first along with any contained T.Comment tokens.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #710 +/- ##
==========================================
+ Coverage 96.95% 96.97% +0.01%
==========================================
Files 20 20
Lines 1545 1555 +10
==========================================
+ Hits 1498 1508 +10
Misses 47 47
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
f47bc2c
to
de63e50
Compare
Rename Token to TokenBase and make it a superclass for TokenList and a new Token class. Move some of the functionality of TokenBase into Token and TokenList. This will make it easier to maintain separate functionality for Token versus TokenList.
The fact that a new value was being computed each time TokenList.group_tokens() was called caused supra-linear runtime when token grouping was enabled. Address by making TokenList.value a dynamically-computed property rather than a static attribute.
de63e50
to
ff4f391
Compare
This is just the fix I need. Ran into some problems with parsing SQL with ~50k ID |
any progress here? |
This PR supersedes #623. The meat of the PR is the same: fix the remaining portion of issue #621 by making
TokenList.value
a dynamically-computed property rather than an attribute. This avoids the quadratic runtime behavior that occurred due to recomputingTokenList.value
each timeTokenList.group_tokens(
) was called withextend=True
.The previous PR #623 had some rather awkward hacks related to stripping comments, but I found that I could avoid those by simply tweaking the comment stripping process to strip comments from a token list before stripping any sublists, making this PR much simpler.