Class: Yadriggy::Label

Inherits:
Name show all
Defined in:
lib/yadriggy/ast.rb,
lib/yadriggy/ast_value.rb

Overview

Label such as length:.

Instance Attribute Summary

Attributes inherited from Name

#column, #line_no

Attributes inherited from ASTnode

#parent, #usertype

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Name

#to_sym

Methods inherited from ASTnode

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

Constructor Details

#initialize(sexp) ⇒ Label

Returns a new instance of Label.



163
164
165
# File 'lib/yadriggy/ast.rb', line 163

def initialize(sexp)
  super([:@label, sexp[1].chop, sexp[2]])
end

Class Method Details

.tagObject



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

def self.tag() :@label 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.



175
176
177
# File 'lib/yadriggy/ast.rb', line 175

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

#const_valueObject

Gets the name of this label.



140
# File 'lib/yadriggy/ast_value.rb', line 140

def const_value() @name end

#nameString

Returns the label name. For example, if this object represents length:, then "length" (without a colon) is returned.

Returns:

  • (String)

    the label name. For example, if this object represents length:, then "length" (without a colon) is returned.



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

def name() super end

#valueObject

Gets the name of this label.



136
# File 'lib/yadriggy/ast_value.rb', line 136

def value() @name end