From a795be1a70a241e177227b742269fb2df88af962 Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Mon, 13 Jun 2016 13:21:20 -0700 Subject: Change token_ funcs to token_idx funcs --- examples/column_defs_lowlevel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/column_defs_lowlevel.py b/examples/column_defs_lowlevel.py index 5e98be3..1ebd065 100644 --- a/examples/column_defs_lowlevel.py +++ b/examples/column_defs_lowlevel.py @@ -17,16 +17,16 @@ def extract_definitions(token_list): definitions = [] tmp = [] # grab the first token, ignoring whitespace. idx=1 to skip open ( - token = token_list.token_next(1) + tidx, token = token_list.token_idx_next(1) while token and not token.match(sqlparse.tokens.Punctuation, ')'): tmp.append(token) # grab the next token, this times including whitespace - token = token_list.token_next(token, skip_ws=False) + tidx, token = token_list.token_idx_next(tidx, skip_ws=False) # split on ",", except when on end of statement if token and token.match(sqlparse.tokens.Punctuation, ','): definitions.append(tmp) tmp = [] - token = token_list.token_next(token) + tidx, token = token_list.token_idx_next(tidx) if tmp and isinstance(tmp[0], sqlparse.sql.Identifier): definitions.append(tmp) return definitions @@ -41,7 +41,7 @@ if __name__ == '__main__': parsed = sqlparse.parse(SQL)[0] # extract the parenthesis which holds column definitions - par = parsed.token_next_by(i=sqlparse.sql.Parenthesis) + _, par = parsed.token_idx_next_by(i=sqlparse.sql.Parenthesis) columns = extract_definitions(par) for column in columns: -- cgit v1.2.1