whileStatement method

Stmt whileStatement()

Implementation

Stmt whileStatement() {
  consume(TokenType.LEFT_PAREN, "Expect '(' after 'while'.");
  Expr condition = expression();
  consume(TokenType.RIGHT_PAREN, "Expect ')' after condition.");
  Stmt body = statement();

  return While(condition, body);
}