diff options
author | Harald Welte <laforge@osmocom.org> | 2020-03-27 00:28:53 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2020-09-15 10:47:45 +0200 |
commit | 46bc6d25d62321b5bac0c6b8615e684f14ae293f (patch) | |
tree | febd0e27324ef265d65edba4831405fff63c35b6 /script_format.py | |
parent | 1e42420e576cf8f1626ee4d1500aa46890937135 (diff) |
HACK: support for SIM factory file formatssysmocom/factory
Change-Id: I23cd37fc06b6e2d21964fd4f2694d9ee3c6012d4
Diffstat (limited to 'script_format.py')
-rw-r--r-- | script_format.py | 13 |
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) |