Module: Riml::Visitable
- Includes:
- Walkable
- Included in:
- AssignNode, CallNode, CatchNode, ClassDefinitionNode, ControlStructure, CurlyBracePart, CurlyBraceVariable, DefNode, DefaultParamNode, DictGetNode, ElseNode, ElseifNode, ForNode, GetCurlyBraceNameNode, GetSpecialVariableNode, GetVariableByScopeAndDictNameNode, GetVariableNode, KeywordNode, ListOrDictGetNode, LiteralNode, MultiAssignNode, Nodes, ObjectInstantiationNode, OperatorNode, ReturnNode, SplatNode, StringLiteralConcatNode, StringNode, SuperNode, TryNode, UnletVariableNode, WrapInParensNode
- Defined in:
- lib/riml/nodes.rb
Constant Summary collapse
- EMPTY_CHILDREN =
[].freeze
Instance Attribute Summary collapse
- #compiled_output ⇒ Object
-
#force_newline ⇒ Object
Returns the value of attribute force_newline.
-
#parent_node ⇒ Object
(also: #parent)
Returns the value of attribute parent_node.
-
#parser_info ⇒ Object
Returns the value of attribute parser_info.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #children ⇒ Object
- #force_newline_if_child_call_node? ⇒ Boolean
- #location_info ⇒ Object
Methods included from Walkable
#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with
Instance Attribute Details
#compiled_output ⇒ Object
19 20 21 |
# File 'lib/riml/nodes.rb', line 19 def compiled_output @compiled_output ||= '' end |
#force_newline ⇒ Object
Returns the value of attribute force_newline.
14 15 16 |
# File 'lib/riml/nodes.rb', line 14 def force_newline @force_newline end |
#parent_node ⇒ Object Also known as: parent
Returns the value of attribute parent_node.
14 15 16 |
# File 'lib/riml/nodes.rb', line 14 def parent_node @parent_node end |
#parser_info ⇒ Object
Returns the value of attribute parser_info.
14 15 16 |
# File 'lib/riml/nodes.rb', line 14 def parser_info @parser_info end |
#scope ⇒ Object
Returns the value of attribute scope.
14 15 16 |
# File 'lib/riml/nodes.rb', line 14 def scope @scope end |
Instance Method Details
#accept(visitor) ⇒ Object
10 11 12 |
# File 'lib/riml/nodes.rb', line 10 def accept(visitor) visitor.visit(self) end |
#children ⇒ Object
25 26 27 |
# File 'lib/riml/nodes.rb', line 25 def children EMPTY_CHILDREN end |
#force_newline_if_child_call_node? ⇒ Boolean
41 42 43 |
# File 'lib/riml/nodes.rb', line 41 def force_newline_if_child_call_node? true end |
#location_info ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/riml/nodes.rb', line 29 def location_info n = self while n != nil && !n.parser_info n = n.parent end if n.nil? return Constants::UNKNOWN_LOCATION_INFO end filename = parser_info[:filename] || Constants::COMPILED_STRING_LOCATION "#{filename}:#{parser_info[:lineno]}" end |