71std::ostream&
print_node(std::ostream& os,
const NodeType& node, PrintCharF&& print_char) {
72 if (node.is_accepting()) os <<
" \"" << node.id() <<
"\" [shape=doublecircle];\n";
73 if (node.is_erroring()) os <<
" \"" << node.id() <<
"\" [shape=square];\n";
75 std::map<const NodeType*, std::vector<Range>,
typename NodeType::Lt> node2transitions;
76 node.for_transitions([&](
auto c,
auto to) {
77 if (!node2transitions.contains(to))
78 node2transitions.try_emplace(to, std::vector<Range>{
82 node2transitions[to].push_back({c, c});
85 for (
auto& [to, ranges] : node2transitions) {
88 for (
auto& [lo, hi] : ranges) {
89 os <<
" \"" << node.id() <<
"\" -> \"" << to->id() <<
"\" [label=\""
90 << std::forward<PrintCharF>(print_char)(lo);
91 if (lo != hi) os <<
"-" << std::forward<PrintCharF>(print_char)(hi);
93 if (lo != hi) os <<
"-" << hi;