Cpp backend: take note of dead states when building table

This commit is contained in:
Robin Jadoul 2016-05-25 21:26:52 +02:00
parent 842867bab4
commit daddd47c43
1 changed files with 4 additions and 0 deletions

View File

@ -61,9 +61,13 @@ namespace lxs { namespace backends {
std::vector<templ::TemplateContext> 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);
}