class Yadriggy::ArrayRef

Array reference.

Attributes

array[R]

@return [ASTnode] the array object.

indexes[R]

@return [Array<ASTnode>] all the comma-separated indexes.

It may be an empty array.

Public Class Methods

new(sexp) click to toggle source
# File lib/yadriggy/ast.rb, line 1014
def initialize(sexp)
  @array = to_node(sexp[1])
  args_block = sexp[2]
  if args_block.nil?
    @indexes = []
  else
    args = has_tag?(args_block, :args_add_block)[1]
    @indexes = to_nodes(args)
  end

  add_child(@array)
  add_children(@indexes)
end
tag() click to toggle source
# File lib/yadriggy/ast.rb, line 1012
def self.tag() :aref end

Public Instance Methods

accept(evaluator) click to toggle source

A method for Visitor pattern. @param [Eval] evaluator the visitor of Visitor pattern. @return [void]

# File lib/yadriggy/ast.rb, line 1031
def accept(evaluator)
  evaluator.array_ref(self)
end