diff options
Diffstat (limited to 'sqlparse/engine')
| -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 |
