class Atomy::Grammar::AST::Infix

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/atomy/node/equality.rb, line 72
def ==(other)
  super || other.is_a?(self.class) && \
    @operator == other.operator && \
    @left == other.left && \
    @right == other.right
end
construct(gen) click to toggle source
# File lib/atomy/node/constructable.rb, line 106
def construct(gen)
  push_node(gen, :Infix)
  if @left
    @left.construct(gen)
  else
    gen.push_nil
  end
  @right.construct(gen)
  gen.push_literal(@operator)
  gen.send(:new, 3)
end
each_attribute() { |:operator, operator| ... } click to toggle source
# File lib/atomy/node/meta.rb, line 145
def each_attribute
  yield :operator, @operator
end
each_child() { |:left, left| ... } click to toggle source
# File lib/atomy/node/meta.rb, line 149
def each_child
  yield :left, @left if @left
  yield :right, @right
end
through() { |left| ... } click to toggle source
# File lib/atomy/node/meta.rb, line 154
def through
  self.class.new(@left && yield(@left), yield(@right), @operator)
end
to_s() click to toggle source
# File lib/atomy/node/pretty.rb, line 66
def to_s
  if @left
    "(#@left #@operator #@right)"
  else
    "(#@operator #@right)"
  end
end