Commit a60be41b authored by Vladimír Štill's avatar Vladimír Štill
Browse files

dfa: Report a more reasonable error if an automaton cannot be canonised

parent d008f682
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -330,6 +330,11 @@ class DFA:
                if tgt is not None and tgt not in state_map.keys():
                if tgt is not None and tgt not in state_map.keys():
                    queue.append(tgt)
                    queue.append(tgt)


        for st, _ in self.transition.keys():
            if st not in state_map:
                raise Exception("Automaton cannot be canonised, it has "
                                "unreachable states")

        return DFA(set(state_map.values()),
        return DFA(set(state_map.values()),
                   deepcopy(self.characters),
                   deepcopy(self.characters),
                   {(state_map[st], ch): state_map[tgt]
                   {(state_map[st], ch): state_map[tgt]