Class: SyntaxTree::Bf::PrettyPrint

Inherits:
Visitor
  • Object
show all
Defined in:
lib/syntax_tree/bf/pretty_print.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Visitor

#visit, #visit_all, #visit_child_nodes

Constructor Details

#initialize(q) ⇒ PrettyPrint

Returns a new instance of PrettyPrint.



8
9
10
# File 'lib/syntax_tree/bf/pretty_print.rb', line 8

def initialize(q)
  @q = q
end

Instance Attribute Details

#qObject (readonly)

Returns the value of attribute q.



6
7
8
# File 'lib/syntax_tree/bf/pretty_print.rb', line 6

def q
  @q
end

Instance Method Details

#visit_decrement(node) ⇒ Object



24
25
26
# File 'lib/syntax_tree/bf/pretty_print.rb', line 24

def visit_decrement(node)
  visit_node("decrement", node)
end

#visit_increment(node) ⇒ Object



20
21
22
# File 'lib/syntax_tree/bf/pretty_print.rb', line 20

def visit_increment(node)
  visit_node("increment", node)
end

#visit_input(node) ⇒ Object



36
37
38
# File 'lib/syntax_tree/bf/pretty_print.rb', line 36

def visit_input(node)
  visit_node("input", node)
end

#visit_loop(node) ⇒ Object



16
17
18
# File 'lib/syntax_tree/bf/pretty_print.rb', line 16

def visit_loop(node)
  visit_node("loop", node)
end

#visit_output(node) ⇒ Object



40
41
42
# File 'lib/syntax_tree/bf/pretty_print.rb', line 40

def visit_output(node)
  visit_node("output", node)
end

#visit_root(node) ⇒ Object



12
13
14
# File 'lib/syntax_tree/bf/pretty_print.rb', line 12

def visit_root(node)
  visit_node("root", node)
end

#visit_shift_left(node) ⇒ Object



32
33
34
# File 'lib/syntax_tree/bf/pretty_print.rb', line 32

def visit_shift_left(node)
  visit_node("shift_left", node)
end

#visit_shift_right(node) ⇒ Object



28
29
30
# File 'lib/syntax_tree/bf/pretty_print.rb', line 28

def visit_shift_right(node)
  visit_node("shift_right", node)
end