From daddd47c4301f6a88bec0af32cf493f9d0fc41af Mon Sep 17 00:00:00 2001 From: Robin Jadoul Date: Wed, 25 May 2016 21:26:52 +0200 Subject: [PATCH] Cpp backend: take note of dead states when building table --- src/backends/cpp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backends/cpp.cpp b/src/backends/cpp.cpp index 7aa4ebe..64fd7d6 100644 --- a/src/backends/cpp.cpp +++ b/src/backends/cpp.cpp @@ -61,9 +61,13 @@ namespace lxs { namespace backends { std::vector row; for (int i = 0; i < num_transitions_per_state; i++) { State to = dfa.delta.find(s)->second.find(reverse_trans[i])->second; + if (to == deadState) + to = dfa.numStates; //The new Dead state name row.push_back(templ::make_map({{"state", templ::make_string(std::to_string(to))}})); } } + // NOTE: there is no transition table entry for the dead state + // since the algorithm should never loop in the dead state return templ::make_array(table); }