module DrgDSL::Ast::Node

Public Class Methods

included(node_class) click to toggle source
# File lib/drgdsl/ast.rb, line 19
def included(node_class)
  node_classes << node_class
end
node_classes() click to toggle source
# File lib/drgdsl/ast.rb, line 15
def node_classes
  @node_classes ||= []
end
type(node_class) click to toggle source
# File lib/drgdsl/ast.rb, line 23
def type(node_class)
  node_class.to_s[/\w+$/]
end

Public Instance Methods

==(other) click to toggle source
# File lib/drgdsl/ast.rb, line 62
def ==(other)
  type == other.type && hash == other.hash
end
Also aliased as: eql?
accept(visitor) click to toggle source
# File lib/drgdsl/ast.rb, line 28
def accept(visitor)
  visitor.visit(self)
end
eql?(other)
Alias for: ==
hash() click to toggle source

@return [Integer] object hash for this AST node. Node instances for the

same expression should always return the same hash code. This is
useful for optimizations.
# File lib/drgdsl/ast.rb, line 58
def hash
  raise NotImplementedError
end
mdc_equality?() click to toggle source

@return [Boolean] whether this node represents a MDC equality check,

e.g. "MDC = '01'"
# File lib/drgdsl/ast.rb, line 40
def mdc_equality?
  false
end
pretty_print(**pretty_printer_options) click to toggle source
# File lib/drgdsl/ast.rb, line 68
def pretty_print(**pretty_printer_options)
  accept PrettyPrinter.new(**pretty_printer_options)
end
Also aliased as: to_s
sep_equality?() click to toggle source

@return [Boolean] whether this node represents a SEP equality check,

e.g. "SEP = '07'"
# File lib/drgdsl/ast.rb, line 46
def sep_equality?
  false
end
to_hash() click to toggle source

@return [Hash] Hash representation of the node

# File lib/drgdsl/ast.rb, line 51
def to_hash
  raise NotImplementedError
end
to_s(**pretty_printer_options)
Alias for: pretty_print
type() click to toggle source

Class name of the concrete node without the module name. Do not override. Used by Visitor to determine which method to call.

# File lib/drgdsl/ast.rb, line 34
def type
  Node.type(self.class)
end