class Bade::AST::Node

Attributes

children[RW]

@return [Array<Bade::Node>]

lineno[R]

@return [Int] line number

type[R]

@return [Symbol] type of this node

Public Class Methods

new(type, lineno: nil) click to toggle source
# File lib/bade/ast/node.rb, line 23
def initialize(type, lineno: nil)
  @type = type
  @children = []
  @lineno = lineno
end

Public Instance Methods

==(other) click to toggle source

@param other [Node]

@return [Bool]

# File lib/bade/ast/node.rb, line 42
def ==(other)
  return false unless self.class == other.class

  type == other.type && children == other.children
end
inspect() click to toggle source
# File lib/bade/ast/node.rb, line 34
def inspect
  to_s
end
to_s() click to toggle source
# File lib/bade/ast/node.rb, line 29
def to_s
  require_relative 'string_serializer'
  StringSerializer.new(self).to_s
end