Class: IcAgent::Ast::Nodes::StatementNode

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/ic_agent/ast/nodes/statement_nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#child_countObject

Returns the value of attribute child_count.



7
8
9
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 7

def child_count
  @child_count
end

#depthObject

Returns the value of attribute depth.



7
8
9
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 7

def depth
  @depth
end

Instance Method Details

#add_childObject



25
26
27
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 25

def add_child
  @child_count ||= 0 + 1
end

#elements_to_sObject



21
22
23
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 21

def elements_to_s
  elements.map(&:to_s).join("\n")
end

#source_contentObject



29
30
31
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 29

def source_content
  self.text_value.strip
end

#titleObject



9
10
11
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 9

def title
  :named_node
end

#to_arrayObject



13
14
15
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 13

def to_array
  [title] + elements.map(&:to_array)
end

#to_sObject



17
18
19
# File 'lib/ic_agent/ast/nodes/statement_nodes.rb', line 17

def to_s
  "#{title.to_s.upcase} #{elements_to_s}"
end