68std::ostream&
print_node(std::ostream& os,
const NodeType& node, PrintCharF&& print_char) {
69 if (node.is_accepting()) os <<
" \"" << &node <<
"\" [shape=doublecircle];\n";
70 if (node.is_erroring()) os <<
" \"" << &node <<
"\" [shape=square];\n";
72 absl::flat_hash_map<const NodeType*, std::vector<Range>> node2transitions;
73 node.for_transitions([&](
auto c,
auto to) {
74 if (!node2transitions.contains(to))
75 node2transitions.emplace(to, std::vector<Range>{
79 node2transitions[to].push_back({c, c});
82 for (
auto& [to, ranges] : node2transitions) {
85 for (
auto& [lo, hi] : ranges) {
86 os <<
" \"" << &node <<
"\" -> \"" << to <<
"\" [label=\"" << std::forward<PrintCharF>(print_char)(lo);
87 if (lo != hi) os <<
"-" << std::forward<PrintCharF>(print_char)(hi);
89 if (lo != hi) os <<
"-" << hi;