Пример #1
0
    def __loadOwnFormat(self, path):
        print("Start loading own format...")
        file = open(path, mode='r')
        fileContent = file.readlines()
        file.close()

        stateList = []
        transitionList = []
        marker = 0

        for item in fileContent:
            # skip comments
            if "#" in item:
                marker = marker + 1
                continue
                pass
            # add states to the list
            if marker == 1:
                state = State()
                state.setName(item[:-1])
                stateList.append(state)
                pass
            # add transitions to list
            if marker == 2:
                transition = self.__decodeTransitionFromLine(item, stateList)
                transitionList.append(transition)
                pass
            pass

        return stateList, transitionList
        pass