aboutsummaryrefslogtreecommitdiffstats
path: root/script_format.py
diff options
context:
space:
mode:
Diffstat (limited to 'script_format.py')
-rw-r--r--script_format.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/script_format.py b/script_format.py
new file mode 100644
index 0000000..18d4c1c
--- /dev/null
+++ b/script_format.py
@@ -0,0 +1,13 @@
+
+class ScriptFormat():
+
+ def parse_process(self, text, stmt_cb, stmt_cb_kwargs={}):
+ p = self.parse_xform(text)
+ #print(p.pretty())
+ for stmt in p.children:
+ stmt_cb(stmt, **stmt_cb_kwargs)
+
+ def parse_process_file(self, fname, stmt_cb, stmt_cb_kwargs={}):
+ f = open(fname, "r")
+ text = f.read()
+ return self.parse_process(text, stmt_cb, stmt_cb_kwargs)