diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-10 18:33:39 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-11 04:19:19 -0700 |
| commit | 1957755f5ff90568ec8dbdf41442018a341b1b6b (patch) | |
| tree | 86742376cd1c13c3593ead754a76f729b0e76073 /sqlparse | |
| parent | 00304afc15a554f2ac8decca1d916ba66c143b45 (diff) | |
| download | sqlparse-1957755f5ff90568ec8dbdf41442018a341b1b6b.tar.gz | |
clean up grouping
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/engine/grouping.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index c680995..e8e9dc3 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -42,13 +42,14 @@ def _group_left_right(tlist, m, cls, def _group_matching(tlist, cls): """Groups Tokens that have beginning and end.""" - idx = 1 if imt(tlist, i=cls) else 0 + idx = 1 if isinstance(tlist, cls) else 0 token = tlist.token_next_by(m=cls.M_OPEN, idx=idx) while token: end = find_matching(tlist, token, cls.M_OPEN, cls.M_CLOSE) if end is not None: - token = tlist.group_tokens(cls, tlist.tokens_between(token, end)) + tokens = tlist.tokens_between(token, end) + token = tlist.group_tokens(cls, tokens) _group_matching(token, cls) token = tlist.token_next_by(m=cls.M_OPEN, idx=token) @@ -120,7 +121,7 @@ def group_period(tlist): def group_arrays(tlist): token = tlist.token_next_by(i=sql.SquareBrackets) while token: - prev = tlist.token_prev(idx=token) + prev = tlist.token_prev(token) if imt(prev, i=(sql.SquareBrackets, sql.Identifier, sql.Function), t=(T.Name, T.String.Symbol,)): tokens = tlist.tokens_between(prev, token) |
