def ValidateTree(self, queries, additional_visitors=(),
                   max_alter_rows=100000, # for AlterChecker
                   allowed_engines=('InnoDB',), # for CreateTableChecker
                   fail_fast=False,
                   ):
    """Validate a parse tree.

    Args:
      tokens: pyparsing parse tree

    Returns:
      Whether the tree validated
    """
    visitors = [
        ShardSetChecker(self._schema),
        AlterChecker(self._schema, max_alter_rows=max_alter_rows),
        CreateDatabaseChecker(self._schema),
        DropDatabaseChecker(self._schema),
        CreateTableChecker(self._schema, allowed_engines=allowed_engines),
        DropTableChecker(self._schema),
        ReplaceChecker(self._schema),
        ColumnChecker(self._schema),
    ] + list(additional_visitors)

    # We iterate query-by-query, so each visitor can modify the token tree and
    # things happen in the right order.
    for query in queries:
      self._CheckCancelled()
      assert query.getName() == 'query', (
          'Invalid second-level token: %s' % (query.getName()))
      logging.debug('Visiting: %s', query)
      for visitor in visitors:
        visitor.visit([query])
        if fail_fast and (visitor.Errors() or visitor.Warnings()):
          self._Finalize(visitors)
          return False
      if self._callback:
        self._callback(self._loc)

    self._Finalize(visitors)
    return not self._errors and not self._warnings
dataset/ETHPy150Open google/mysql-tools/parser_lib/validator.py/Validator.ValidateTree/original