class Atomy::Grammar::AST::Node

Attributes

line[RW]

Public Class Methods

basename() click to toggle source
# File lib/atomy/node/meta.rb, line 4
def basename
  @basename ||= name.split("::").last.to_sym
end

Public Instance Methods

accept(x) click to toggle source
# File lib/atomy/node/meta.rb, line 35
def accept(x)
  name = :"visit_#{self.class.basename.downcase}"

  if x.respond_to?(name)
    x.send(name, self)
  else
    x.visit(self)
  end
end
attributes() click to toggle source
# File lib/atomy/node/meta.rb, line 25
def attributes
  names = []

  each_attribute do |name, _|
    names << name
  end

  names
end
children() click to toggle source
# File lib/atomy/node/meta.rb, line 15
def children
  names = []

  each_child do |name, _|
    names << name
  end

  names
end
construct(gen) click to toggle source
# File lib/atomy/node/constructable.rb, line 5
def construct(gen)
  raise "no #construct for #{self.class}"
end
each_attribute() click to toggle source
# File lib/atomy/node/meta.rb, line 12
def each_attribute
end
each_child() click to toggle source
# File lib/atomy/node/meta.rb, line 9
def each_child
end
through() click to toggle source

Recreate the node, calling the block for sub-nodes and using its return value in place of the node

# File lib/atomy/node/meta.rb, line 47
def through
  dup
end

Private Instance Methods

push_node(gen, name) click to toggle source
# File lib/atomy/node/constructable.rb, line 11
def push_node(gen, name)
  gen.push_cpath_top
  gen.find_const(:Atomy)
  gen.find_const(:Grammar)
  gen.find_const(:AST)
  gen.find_const(name)
end