]> git.phdru.name Git - sqlconvert.git/commitdiff
Simplify print_tokens()
authorOleg Broytman <phd@phdru.name>
Thu, 11 Aug 2016 07:17:56 +0000 (10:17 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Aug 2016 07:17:56 +0000 (10:17 +0300)
mysql2sql/print_tokens.py

index 0f03d0357f151bc3af02380e9be94bebae0d98a9..5d104c37d0d159e0f4f8e0fdeacc97dcd1523c82 100644 (file)
@@ -12,10 +12,10 @@ from sqlparse.sql import TokenList
 
 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)
+        else:
+            outfile.write(token.normalized)
 
 
 def get_tokens_str(token_list):