Class: Yadriggy::Paren
- Includes:
- AstHelper
- Defined in:
- lib/yadriggy/ast.rb
Overview
Parenthesis.
Instance Attribute Summary collapse
-
#expression ⇒ ASTnode
readonly
The expression surrounded with the parentheses.
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ Paren
constructor
A new instance of Paren.
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) ⇒ Paren
Returns a new instance of Paren.
412 413 414 415 416 |
# File 'lib/yadriggy/ast.rb', line 412 def initialize(sexp) e = if sexp[1][0].is_a?(Array) then sexp[1][0] else sexp[1] end @expression = to_node(e) add_child(@expression) end |
Instance Attribute Details
#expression ⇒ ASTnode (readonly)
Returns the expression surrounded with the parentheses.
408 409 410 |
# File 'lib/yadriggy/ast.rb', line 408 def expression @expression end |
Class Method Details
.tag ⇒ Object
410 |
# File 'lib/yadriggy/ast.rb', line 410 def self.tag() :paren end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
421 422 423 |
# File 'lib/yadriggy/ast.rb', line 421 def accept(evaluator) evaluator.paren(self) end |