Class: Riml::Compiler::WhileNodeVisitor
- Defined in:
- lib/riml/compiler.rb
Instance Method Summary collapse
Methods inherited from Visitor
Constructor Details
This class inherits a constructor from Riml::Compiler::Visitor
Instance Method Details
#compile(node) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/riml/compiler.rb', line 110 def compile(node) node.condition.force_newline = true node.compiled_output = "while " node.compiled_output << "!" if UntilNode === node node.condition.accept visitor_for_node(node.condition) node.body.accept NodesVisitor.new(:propagate_up_tree => false) node.body.compiled_output.each_line do |line| node.compiled_output << node.indent + line end node.compiled_output << "endwhile\n" end |