synchronize method

void synchronize()

Implementation

void synchronize() {
  advance();
  while (!isAtEnd()) {
    if (previous().type == TokenType.SEMICOLON) return;
    switch (peek().type) {
      case TokenType.CLASS:
      case TokenType.FUN:
      case TokenType.VAR:
      case TokenType.FOR:
      case TokenType.IF:
      case TokenType.WHILE:
      case TokenType.PRINT:
      case TokenType.RETURN:
        return;
    }
    advance();
  }
}