class Yadriggy::ForLoop

For statement.

Attributes

body[R]

@return [ASTnode] the loop body.

set[R]

@return [ASTnode] the elements.

vars[R]

@return [Array<ASTnode>] the variables.

Public Class Methods

new(sexp) click to toggle source
# File lib/yadriggy/ast.rb, line 1186
def initialize(sexp)
  if sexp[1][0] == :var_field
    @vars = [ to_node(sexp[1][1]) ]
  else
    @vars = to_nodes(sexp[1])
  end
  @set = to_node(sexp[2])
  @body = Exprs.make(sexp[3])
  add_children(@vars)
  add_child(@set)
  add_child(@body)
end
tag() click to toggle source
# File lib/yadriggy/ast.rb, line 1184
def self.tag() :for end

Public Instance Methods

accept(evaluator) click to toggle source

A method for Visitor pattern. @param [Eval] evaluator the visitor of Visitor pattern. @return [void]

# File lib/yadriggy/ast.rb, line 1202
def accept(evaluator)
  evaluator.for_loop(self)
end