X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=mysql2sql%2Fprint_tokens.py;h=2ed63412bfa77123038b1ea2e90c06e4353e6ad9;hb=86cd5e14538aa1a7a39614c62163fb940459d90b;hp=bfcaad9fca3097757a49a2c4c38037f7ab7c34ec;hpb=5a4f7d7f75c22d57a2cb8ffefce423832893a13f;p=sqlconvert.git diff --git a/mysql2sql/print_tokens.py b/mysql2sql/print_tokens.py index bfcaad9..2ed6341 100644 --- a/mysql2sql/print_tokens.py +++ b/mysql2sql/print_tokens.py @@ -7,26 +7,11 @@ except ImportError: from StringIO import StringIO except ImportError: from io import StringIO -from sqlparse.sql import TokenList -def print_subtree(token_list, outfile=sys.stdout, ident=0): - for token in token_list: - outfile.write(" "*ident) - outfile.write(repr(token)) - outfile.write("\n") - if isinstance(token, TokenList): - print_subtree(token, outfile, ident+4) - - -def print_tokens(token_list, outfile=sys.stdout, level=0): - for token in token_list: - if not isinstance(token, TokenList): - outfile.write(token.normalized) - if isinstance(token, TokenList): - print_tokens(token, outfile, level+1) - if level == 0: - outfile.write(';\n') +def print_tokens(token_list, outfile=sys.stdout): + for token in token_list.flatten(): + outfile.write(token.normalized) def get_tokens_str(token_list):