module Maccro::DSL::ASTNodeWrapper
Public Instance Methods
capture(ast, placeholders)
click to toggle source
# File lib/maccro/dsl/node.rb, line 28 def capture(ast, placeholders) self.children.each_with_index do |c, i| if c.is_a?(ASTNodeWrapper) c.capture(ast.children[i], placeholders) end end end
children()
click to toggle source
Calls superclass method
# File lib/maccro/dsl/node.rb, line 6 def children @child_nodes ||= super end
match?(node)
click to toggle source
# File lib/maccro/dsl/node.rb, line 14 def match?(node) return false unless node.is_a?(ASTNodeWrapper) return false if node.type != self.type self.children.each_with_index do |c, i| if c.is_a?(ASTNodeWrapper) return false unless c.match?(node.children[i]) else return false unless c == node.children[i] end end # same type, all children match with others true end
to_code_range()
click to toggle source
# File lib/maccro/dsl/node.rb, line 10 def to_code_range CodeRange.from_node(self) end