Class: Yadriggy::Dots

Inherits:
Binary show all
Defined in:
lib/yadriggy/ast.rb

Overview

Range.

Instance Attribute Summary

Attributes inherited from Binary

#left, #op, #right

Attributes inherited from ASTnode

#parent, #usertype

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Binary

#const_value, #const_value_in_class, tag, #value, #value_in_class

Methods included from AstHelper

#has_tag?, #to_node, #to_nodes

Methods inherited from ASTnode

#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value, #value_in_class

Constructor Details

#initialize(sexp) ⇒ Dots

Returns a new instance of Dots.



684
685
686
687
688
689
690
# File 'lib/yadriggy/ast.rb', line 684

def initialize(sexp)
  @left = to_node(sexp[1])
  @op = if sexp[0] == :dot2 then :'..' else :'...' end
  @right = to_node(sexp[2])
  add_child(@left)
  add_child(@right)
end

Class Method Details

.tagsObject



682
# File 'lib/yadriggy/ast.rb', line 682

def self.tags() [:dot2, :dot3] end

Instance Method Details

#accept(evaluator) ⇒ void

This method returns an undefined value.

A method for Visitor pattern.

Parameters:

  • evaluator (Eval)

    the visitor of Visitor pattern.



695
696
697
# File 'lib/yadriggy/ast.rb', line 695

def accept(evaluator)
  evaluator.dots(self)
end