diff options
author | Sjoerd Job Postmus <sjoerdjob@sjec.nl> | 2016-06-02 08:30:27 +0200 |
---|---|---|
committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-12 17:33:15 -0700 |
commit | d4cc0644c8348da5e49c58df5e26a3e969045249 (patch) | |
tree | a23fcaa75e313369194a27e0f7ac040b20b9e23c /sqlparse/utils.py | |
parent | 896774cb5298924abbcea81b9b90f1c7c10b3d6a (diff) | |
download | sqlparse-d4cc0644c8348da5e49c58df5e26a3e969045249.tar.gz |
Replace _group_matching with an inward-out grouping algorithm
All the matching between open/close was done all the time, first finding
the matching closing token, and then grouping the tokens in between, and
recurse over the newly created list.
Instead, it is more efficient to look for the previous open-token on
finding a closing-token, group these two together, and then continue on.
squashed: Handle token indices in group_tokens_between and find_matching.
Diffstat (limited to 'sqlparse/utils.py')
-rw-r--r-- | sqlparse/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlparse/utils.py b/sqlparse/utils.py index 90acb5c..5e01f58 100644 --- a/sqlparse/utils.py +++ b/sqlparse/utils.py @@ -164,7 +164,7 @@ def imt(token, i=None, m=None, t=None): def find_matching(tlist, token, M1, M2): - idx = tlist.token_index(token) + idx = tlist.token_index(token) if not isinstance(token, int) else token depth = 0 for token in tlist.tokens[idx:]: if token.match(*M1): |