HACK: support for SIM factory file formats

Change-Id: I23cd37fc06b6e2d21964fd4f2694d9ee3c6012d4
This commit is contained in:
Harald Welte
2020-03-27 00:28:53 +01:00
parent 1e42420e57
commit 46bc6d25d6
5 changed files with 367 additions and 0 deletions

13
script_format.py Normal file
View File

@@ -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)