Cpp backend: take note of dead states when building table
This commit is contained in:
parent
842867bab4
commit
daddd47c43
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue