Module: Yoda::AST::Vnode::Positional
- Included in:
- Yoda::AST::Vnode
- Defined in:
- lib/yoda/ast/vnode.rb
Instance Method Summary collapse
- #location ⇒ Parsing::Location?
- #positionally_include?(target) ⇒ boolean
- #positionally_nearest_child(target) ⇒ Vnode
- #range ⇒ Range?
- #source_map ⇒ Parser::Source::Map?
Instance Method Details
#location ⇒ Parsing::Location?
109 110 111 |
# File 'lib/yoda/ast/vnode.rb', line 109 def location source_map && Parsing::Location.of_ast_location(source_map) end |
#positionally_include?(target) ⇒ boolean
125 126 127 |
# File 'lib/yoda/ast/vnode.rb', line 125 def positionally_include?(target) range && range.include?(target) end |
#positionally_nearest_child(target) ⇒ Vnode
131 132 133 134 135 136 137 |
# File 'lib/yoda/ast/vnode.rb', line 131 def positionally_nearest_child(target) if positionally_include?(target) children.find { |child| child.positionally_include?(target) }&.positionally_nearest_child(target) || self else nil end end |
#range ⇒ Range?
114 115 116 |
# File 'lib/yoda/ast/vnode.rb', line 114 def range source_map && Parsing::Range.of_ast_location(source_map) end |
#source_map ⇒ Parser::Source::Map?
119 120 121 |
# File 'lib/yoda/ast/vnode.rb', line 119 def source_map nil end |