Class: Yadriggy::BeginEnd
- Includes:
- AstHelper
- Defined in:
- lib/yadriggy/ast.rb
Overview
begin-end.
Instance Attribute Summary collapse
-
#body ⇒ Exprs|ASTnode
readonly
The body.
-
#rescue ⇒ Rescue|nil
readonly
The rescue clause.
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ BeginEnd
constructor
A new instance of BeginEnd.
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) ⇒ BeginEnd
Returns a new instance of BeginEnd.
1555 1556 1557 1558 1559 1560 1561 |
# File 'lib/yadriggy/ast.rb', line 1555 def initialize(sexp) bodystmt = has_tag?(sexp[1], :bodystmt) @body = Exprs.make(bodystmt[1]) @rescue = Rescue.make(bodystmt[2], bodystmt[3], bodystmt[4]) add_child(@body) add_child(@rescue) end |
Instance Attribute Details
#body ⇒ Exprs|ASTnode (readonly)
Returns the body.
1549 1550 1551 |
# File 'lib/yadriggy/ast.rb', line 1549 def body @body end |
#rescue ⇒ Rescue|nil (readonly)
Returns the rescue clause.
1551 1552 1553 |
# File 'lib/yadriggy/ast.rb', line 1551 def rescue @rescue end |
Class Method Details
.tag ⇒ Object
1553 |
# File 'lib/yadriggy/ast.rb', line 1553 def self.tag() :begin end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
1566 1567 1568 |
# File 'lib/yadriggy/ast.rb', line 1566 def accept(evaluator) evaluator.begin_end(self) end |