summaryrefslogtreecommitdiff
path: root/sqlparse/sql.py
diff options
context:
space:
mode:
authorVictor Uriarte <victor.m.uriarte@intel.com>2016-06-13 22:20:29 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-15 13:29:15 -0700
commit5002bfa36c4fa2ee72eff18648b6ddc616b718f0 (patch)
tree54aa68750cc0c03289d29bdbbe852fb6f769e34b /sqlparse/sql.py
parent4f922d9b6fb68b8281c6b3d93a57a4c84860e06a (diff)
downloadsqlparse-5002bfa36c4fa2ee72eff18648b6ddc616b718f0.tar.gz
Normalize behavior between token_next and token_next_by
both will now return the "next" token and not itself when passing own index
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r--sqlparse/sql.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index ed56793..4b6abf1 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -240,8 +240,9 @@ class TokenList(Token):
(skip_cm and imt(tk, t=T.Comment, i=Comment)))
return self._token_matching(funcs)[1]
- def token_next_by(self, i=None, m=None, t=None, idx=0, end=None):
+ def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None):
funcs = lambda tk: imt(tk, i, m, t)
+ idx += 1
return self._token_matching(funcs, idx, end)
def token_not_matching(self, funcs, idx):