Class: Loxxy::Ast::LoxWhileStmt

Inherits:
LoxCompoundExpr show all
Defined in:
lib/loxxy/ast/lox_while_stmt.rb

Instance Attribute Summary collapse

Attributes inherited from LoxCompoundExpr

#subnodes

Attributes inherited from LoxNode

#position

Instance Method Summary collapse

Methods inherited from LoxCompoundExpr

#accept

Methods inherited from LoxNode

#accept, #done!

Methods included from ASTVisitee

#define_accept, #snake_case

Constructor Details

#initialize(aPosition, condExpr, theBody) ⇒ LoxWhileStmt

Returns a new instance of LoxWhileStmt.

Parameters:



14
15
16
17
# File 'lib/loxxy/ast/lox_while_stmt.rb', line 14

def initialize(aPosition, condExpr, theBody)
  super(aPosition, [condExpr])
  @body = theBody
end

Instance Attribute Details

#bodyLoxNode (readonly)

Returns body of the while loop (as a statement).

Returns:

  • (LoxNode)

    body of the while loop (as a statement)



9
10
11
# File 'lib/loxxy/ast/lox_while_stmt.rb', line 9

def body
  @body
end

Instance Method Details

#conditionLoxNode

Accessor to the condition expression

Returns:



21
22
23
# File 'lib/loxxy/ast/lox_while_stmt.rb', line 21

def condition
  subnodes[0]
end