whileStatement method

AstNode whileStatement()

Implementation

AstNode whileStatement() {
  consume(TokenType.leftParen, "Expect '(' after 'while'.");
  AstNode condition = expression();
  consume(TokenType.rightParen, "Expect ')' after while condition.");
  AstNode body = statement();
  return WhileStatement(condition, body);
}