Class: SyntaxTree::Bf::Loop

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/bf/nodes.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(nodes:, location:) ⇒ Loop

Returns a new instance of Loop.



43
44
45
46
# File 'lib/syntax_tree/bf/nodes.rb', line 43

def initialize(nodes:, location:)
  @nodes = nodes
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



41
42
43
# File 'lib/syntax_tree/bf/nodes.rb', line 41

def location
  @location
end

#nodesObject (readonly)

Returns the value of attribute nodes.



41
42
43
# File 'lib/syntax_tree/bf/nodes.rb', line 41

def nodes
  @nodes
end

Instance Method Details

#accept(visitor) ⇒ Object



48
49
50
# File 'lib/syntax_tree/bf/nodes.rb', line 48

def accept(visitor)
  visitor.visit_loop(self)
end

#child_nodesObject Also known as: deconstruct



52
53
54
# File 'lib/syntax_tree/bf/nodes.rb', line 52

def child_nodes
  nodes
end

#deconstruct_keys(keys) ⇒ Object



58
59
60
# File 'lib/syntax_tree/bf/nodes.rb', line 58

def deconstruct_keys(keys)
  { nodes: nodes, location: location }
end