Class: FieldVisualizer

Inherits:
Visualizer show all
Defined in:
lib/resyma/program/traverse.rb

Instance Method Summary collapse

Methods inherited from Visualizer

#def_node, #def_state, #initialize, #node_of, #output, #shorten, #viz!, #viz_matcher

Constructor Details

This class inherits a constructor from Visualizer

Instance Method Details

#label_of(parsetree) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/resyma/program/traverse.rb', line 8

def label_of(parsetree)
  label = super(parsetree)
  id = parsetree.field.id
  start = parsetree.field.start.values.map(&:to_a).flatten
  trans = parsetree.field.trans.values.map(&:to_a).flatten
  label = "#{label}\##{id}\\n"

  unless start.empty?
    label += "START\n"
    start.each do |tuple2|
      label += "#{tuple2.p},#{tuple2.q.id}/#{tuple2.belongs_to}\\n"
    end
  end

  unless trans.empty?
    label += "TRANS\\n"
    trans.each do |tuple4|
      label +=
        "#{tuple4.p},#{tuple4.q.id},#{tuple4.p_},#{tuple4.q_.id}" +
        "/#{tuple4.belongs_to}\\n"
    end
  end
  label
end