diff options
| author | Vik <vmuriart@users.noreply.github.com> | 2016-06-11 05:29:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-11 05:29:39 -0700 |
| commit | 751933d3abdce2234bd869ee65a1ebc7ccbf6b53 (patch) | |
| tree | 77fd5be087ae64c4416c0bd775f6c1843b45a007 /sqlparse/engine/grouping.py | |
| parent | 00304afc15a554f2ac8decca1d916ba66c143b45 (diff) | |
| parent | 1fd3da42bd55bfc1e916e3c3f301f0364b0ded21 (diff) | |
| download | sqlparse-751933d3abdce2234bd869ee65a1ebc7ccbf6b53.tar.gz | |
Merge pull request #254 from vmuriart/tests_str-format
Add various tests and change to new style str-format
Diffstat (limited to 'sqlparse/engine/grouping.py')
| -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) |
