summaryrefslogtreecommitdiff
path: root/sqlparse/sql.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r--sqlparse/sql.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index 19c2ed4..586cd21 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -234,19 +234,16 @@ class TokenList(Token):
if reverse:
assert end is None
- for idx in range(start - 2, -1, -1):
- token = self.tokens[idx]
- for func in funcs:
- if func(token):
- return idx, token
+ indexes = range(start - 2, -1, -1)
else:
if end is None:
end = len(self.tokens)
- for idx in range(start, end):
- token = self.tokens[idx]
- for func in funcs:
- if func(token):
- return idx, token
+ indexes = range(start, end)
+ for idx in indexes:
+ token = self.tokens[idx]
+ for func in funcs:
+ if func(token):
+ return idx, token
return None, None
def token_first(self, skip_ws=True, skip_cm=False):