From 8f7968ed5c649e5227e605ee272f59dd5ca75adb Mon Sep 17 00:00:00 2001 From: Sjoerd Job Postmus Date: Thu, 2 Jun 2016 10:28:54 +0200 Subject: Index-based token_idx_prev Prevent some more calls to token_index in group_identifier_list. They are now all gone. --- sqlparse/engine/grouping.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sqlparse/engine') diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index fddee0f..6bdba2f 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -166,10 +166,11 @@ def group_identifier_list(tlist): tidx, token = tlist.token_idx_next_by(m=M_COMMA) while token: - before, after = tlist.token_prev(tidx), tlist.token_next(tidx) + before_idx, before = tlist.token_idx_prev(tidx) + after = tlist.token_next(tidx) if func(before) and func(after): - tidx = tlist.token_index(before) + tidx = before_idx token = tlist.group_tokens_between(sql.IdentifierList, tidx, after, extend=True) tidx, token = tlist.token_idx_next_by(m=M_COMMA, idx=tidx + 1) -- cgit v1.2.1