]> git.phdru.name Git - sqlconvert.git/commitdiff
Parse command-line queries separately
authorOleg Broytman <phd@phdru.name>
Wed, 3 Aug 2016 20:49:42 +0000 (23:49 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 3 Aug 2016 20:49:42 +0000 (23:49 +0300)
scripts/print_subtree.py

index 8a37d957f08b69bc2c0a5629a7e20822e06ddcef..100fa649c313a2713cda1e9b753e1bc565831bef 100755 (executable)
@@ -23,14 +23,15 @@ def test():
     print("----------")
 
 
-def main(query):
-    for parsed in parse(query):
+def main(*queries):
+    for query in queries:
+        for parsed in parse(query):
+            print("----------")
+            requote_names(parsed)
+            print_tokens(parsed)
+            print()
+            parsed._pprint_tree()
         print("----------")
-        requote_names(parsed)
-        print_tokens(parsed)
-        print()
-        parsed._pprint_tree()
-    print("----------")
 
 if __name__ == '__main__':
     if len(sys.argv) <= 1:
@@ -39,5 +40,5 @@ if __name__ == '__main__':
     if sys.argv[1] == '-t':
         test()
     else:
-        query = ';'.join(sys.argv[1:])
-        main(query)
+        queries = sys.argv[1:]
+        main(*queries)