Class: Riml::Compiler::Visitor
- Inherits:
-
Object
- Object
- Riml::Compiler::Visitor
- Defined in:
- lib/compiler.rb
Overview
Base abstract visitor
Direct Known Subclasses
BinaryOperatorNodeVisitor, CatchNodeVisitor, ClassDefinitionNodeVisitor, DictGetBracketNodeVisitor, DictGetDotNodeVisitor, DrillDownVisitor, ElseNodeVisitor, ElseifNodeVisitor, ForNodeVisitor, GetSpecialVariableNodeVisitor, GetVariableByScopeAndDictNameNodeVisitor, IfNodeVisitor, LiteralNodeVisitor, MultiAssignNodeVisitor, NodesVisitor, ObjectInstantiationNodeVisitor, ReturnNodeVisitor, ScopedVisitor, StringLiteralConcatNodeVisitor, TernaryOperatorNodeVisitor, TryNodeVisitor, UnaryOperatorNodeVisitor, UnletVariableNodeVisitor, WhileNodeVisitor, WrapInParensNodeVisitor
Instance Attribute Summary collapse
-
#propagate_up_tree ⇒ Object
writeonly
Sets the attribute propagate_up_tree.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Visitor
constructor
A new instance of Visitor.
- #visit(node) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Visitor
Returns a new instance of Visitor.
27 28 29 |
# File 'lib/compiler.rb', line 27 def initialize(={}) @propagate_up_tree = [:propagate_up_tree] end |
Instance Attribute Details
#propagate_up_tree=(value) ⇒ Object
Sets the attribute propagate_up_tree
25 26 27 |
# File 'lib/compiler.rb', line 25 def propagate_up_tree=(value) @propagate_up_tree = value end |
Instance Method Details
#visit(node) ⇒ Object
31 32 33 34 35 |
# File 'lib/compiler.rb', line 31 def visit(node) output = compile(node) output << "\n" if node.force_newline and output[-1] != "\n" propagate_up_tree(node, output) end |