From 5002bfa36c4fa2ee72eff18648b6ddc616b718f0 Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Mon, 13 Jun 2016 22:20:29 -0700 Subject: Normalize behavior between token_next and token_next_by both will now return the "next" token and not itself when passing own index --- sqlparse/sql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sqlparse/sql.py') 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): -- cgit v1.2.1