Class: Riml::Compiler::NodesVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/compiler.rb

Instance Method Summary collapse

Methods inherited from Visitor

#initialize, #visit

Constructor Details

This class inherits a constructor from Riml::Compiler::Visitor

Instance Method Details

#compile(nodes) ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/compiler.rb', line 143

def compile(nodes)
  nodes.each_with_index do |node, i|
    visitor = visitor_for_node(node)
    node.parent_node = nodes
    next_node = nodes.nodes[i+1]
    if ElseNode === next_node
      node.force_newline = true
    end
    node.accept(visitor)
  end
  nodes.compiled_output
end