Methods

Journey::NFA::Dot

Public Instance Methods

to_dot() click to toggle source
    # File lib/journey/nfa/dot.rb, line 6
 6:       def to_dot
 7:         edges = transitions.map { |from, sym, to|
 8:           "  #{from} -> #{to} [label=\"#{sym || 'ε'}\"];"
 9:         }
10: 
11:         #memo_nodes = memos.values.flatten.map { |n|
12:         #  label = n
13:         #  if Journey::Route === n
14:         #    label = "#{n.verb.source} #{n.path.spec}"
15:         #  end
16:         #  "  #{n.object_id} [label=\"#{label}\", shape=box];"
17:         #}
18:         #memo_edges = memos.map { |k, memos|
19:         #  (memos || []).map { |v| "  #{k} -> #{v.object_id};" }
20:         #}.flatten.uniq
21: 
22:         digraph nfa {  rankdir=LR;  node [shape = doublecircle];  #{accepting_states.join ' '};  node [shape = circle];#{edges.join "\n"}}
23:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.