diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-07 19:51:14 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-08 10:59:24 +0100 |
| commit | 3360f5ddd0efe0bac694ca8e7a4d50b046ccc3f1 (patch) | |
| tree | 5aca966f85b32ed89a3f599712d128e031eb5bde /sqlparse | |
| parent | 4659db2991382692b849f0a029d5dfa1969abd6a (diff) | |
| parent | bd3ef1c518b99851fb9f0c1ead0ffc70f445f192 (diff) | |
| download | sqlparse-3360f5ddd0efe0bac694ca8e7a4d50b046ccc3f1.tar.gz | |
Merge branch 'hotfix'.
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/engine/grouping.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index fe8b2e8..1149370 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -234,7 +234,6 @@ def group_identifier(tlist): def group_identifier_list(tlist): [group_identifier_list(sgroup) for sgroup in tlist.get_sublists() if not isinstance(sgroup, sql.IdentifierList)] - idx = 0 # Allowed list items fend1_funcs = [lambda t: isinstance(t, (sql.Identifier, sql.Function, sql.Case)), @@ -251,10 +250,11 @@ def group_identifier_list(tlist): lambda t: isinstance(t, sql.Comment), lambda t: t.ttype == T.Comment.Multiline, ] - tcomma = tlist.token_next_match(idx, T.Punctuation, ',') + tcomma = tlist.token_next_match(0, T.Punctuation, ',') start = None while tcomma is not None: - idx = tlist.token_index(tcomma, start=idx) + # Go back one idx to make sure to find the correct tcomma + idx = tlist.token_index(tcomma) before = tlist.token_prev(idx) after = tlist.token_next(idx) # Check if the tokens around tcomma belong to a list |
