Add more accepting state information to dot output

This commit is contained in:
Robin Jadoul 2016-05-29 13:14:08 +02:00
parent 329f58bd89
commit 80fa3383fd
1 changed files with 24 additions and 15 deletions

View File

@ -14,12 +14,15 @@ namespace lxs {
for (State state = 0; state < d.numStates; state++)
{
s += std::to_string(state) + " [label=\"" + std::to_string(state) + "\"";
std::string label = std::to_string(state);
s += std::to_string(state) + " [";
if (state == d.starting)
s += " color=yellow";
if (d.accepting.count(state) > 0)
s += " color=green shape=doublecircle";
s += "]\n";
s += "color=yellow";
if (d.accepting.count(state) > 0) {
s += "color=green shape=doublecircle";
label += "\\np=" + std::to_string(d.priority.find(state)->second) + "\\nac=" + d.acceptingToken.find(state)->second;
}
s += " label=\"" + label + "\"]\n";
}
for (const auto& tmp : d.delta)
@ -41,12 +44,15 @@ namespace lxs {
for (State state = 0; state < n.numStates; state++)
{
s += std::to_string(state) + " [label=\"" + std::to_string(state) + "\"";
std::string label = std::to_string(state);
s += std::to_string(state) + " [";
if (state == n.starting)
s += " color=yellow";
if (n.accepting.count(state) > 0)
s += " color=green shape=doublecircle";
s += "]\n";
s += "color=yellow";
if (n.accepting.count(state) > 0) {
s += "color=green shape=doublecircle";
label += "\\np=" + std::to_string(n.priority.find(state)->second) + "\\nac=" + n.acceptingToken.find(state)->second;
}
s += " label=\"" + label + "\"]\n";
}
for (const auto& tmp : n.delta)
@ -69,12 +75,15 @@ namespace lxs {
for (State state = 0; state < e.numStates; state++)
{
s += std::to_string(state) + " [label=\"" + std::to_string(state) + "\"";
std::string label = std::to_string(state);
s += std::to_string(state) + " [";
if (state == e.starting)
s += " color=yellow";
if (e.accepting.count(state) > 0)
s += " color=green shape=doublecircle";
s += "]\n";
s += "color=yellow";
if (e.accepting.count(state) > 0) {
s += "color=green shape=doublecircle";
label += "\\np=" + std::to_string(e.priority.find(state)->second) + "\\nac=" + e.acceptingToken.find(state)->second;
}
s += " label=\"" + label + "\"]\n";
}
for (const auto& tmp : e.delta)