diff --git a/scripts/if2spdl/If.py b/scripts/if2spdl/If.py index f65db28..f8ca181 100644 --- a/scripts/if2spdl/If.py +++ b/scripts/if2spdl/If.py @@ -5,6 +5,7 @@ # Objects and stuff for the intermediate format # import copy # To copy objects +import os # For path functions class Message(object): @@ -370,10 +371,8 @@ class AuthenticateRule(GoalRule): class Protocol(list): def setFilename(self, filename): - # TODO untested - parts = filename.split("/") - self.path = "".join(parts[:-1]) - self.filename = parts[-1] + self.path = os.path.dirname(filename) + self.filename = os.path.basename(filename) # Get head of filename (until first dot) def getBaseName(self): diff --git a/scripts/if2spdl/Ifparser.py b/scripts/if2spdl/Ifparser.py index c75e7d3..d659cb5 100755 --- a/scripts/if2spdl/Ifparser.py +++ b/scripts/if2spdl/Ifparser.py @@ -266,22 +266,18 @@ def ifParser(): # Determine (un)typedness from this line def typeSwitch(line): - try: - global typedversion + global typedversion - typeflag = Literal("#") + "option" + Literal("=") + oneOf ("untyped","typed") - res = typeflag.parseString(line) - if res[3] == "untyped": - typedversion = False - elif res[3] == "typed": - typeversion = True - else: - print "Cannot determine whether typed or untyped." - raise ParseException + typeflag = Literal("#") + "option" + Literal("=") + oneOf ("untyped","typed") + res = typeflag.parseString(line) + if res[3] == "untyped": + typedversion = False + elif res[3] == "typed": + typeversion = True + else: + print "Cannot determine whether typed or untyped." + raise ParseException - except: - print "Unexpected error while determining (un)typedness of the line", line - str = "Detected " if not typedversion: str += "un"