Class: Yadriggy::Label
- Defined in:
- lib/yadriggy/ast.rb,
lib/yadriggy/ast_value.rb
Overview
Label such as length:
.
Instance Attribute Summary
Attributes inherited from Name
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#const_value ⇒ Object
Gets the name of this label.
-
#initialize(sexp) ⇒ Label
constructor
A new instance of Label.
-
#name ⇒ String
The label name.
-
#value ⇒ Object
Gets the name of this label.
Methods inherited from Name
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
.tag ⇒ Object
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.
175 176 177 |
# File 'lib/yadriggy/ast.rb', line 175 def accept(evaluator) evaluator.label(self) end |
#const_value ⇒ Object
Gets the name of this label.
140 |
# File 'lib/yadriggy/ast_value.rb', line 140 def const_value() @name end |
#name ⇒ String
Returns 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 |
#value ⇒ Object
Gets the name of this label.
136 |
# File 'lib/yadriggy/ast_value.rb', line 136 def value() @name end |