Skip to content

Commit

Permalink
Refactor sg_parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarawneh committed May 14, 2018
1 parent e6c4d54 commit bf927b5
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions sg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,13 @@ def load_sg(file):

words = line.split()

if words[0] in ignored:
pass

elif words[0] == ".model":
sg["model"] = words[1]

elif words[0] == ".inputs":
sg["inputs"] = words[1:]

elif words[0] == ".outputs":
sg["outputs"] = words[1:]

elif words[0] == ".marking":
sg["initial_state"] = words[1][1:-1]

elif words[0][0] == ".":
raise Exception("Unsupported statement: %s" % words[0])

else:
sg["transitions"].append(words)
if words[0] in ignored: pass
elif words[0] == ".model": sg["model"] = words[1]
elif words[0] == ".inputs": sg["inputs"] = words[1:]
elif words[0] == ".outputs": sg["outputs"] = words[1:]
elif words[0] == ".marking": sg["initial_state"] = words[1][1:-1]
elif words[0][0] == ".": raise Exception("Unsupported statement: %s" % words[0])
else: sg["transitions"].append(words)

return sg

Expand Down

0 comments on commit bf927b5

Please sign in to comment.