'Ctor.
Parses the input query into the class as a pre-compiled query, allowing
for a later call to Bind() to bind arguments as defined in the
documentation.
Args:
query_string: properly formatted GQL query string.
namespace: the namespace to use for this query.
Raises:
datastore_errors.BadQueryError: if the query is not parsable.'

def __init__(self, query_string, _app=None, _auth_domain=None, namespace=None):

    self.__app = _app
    self.__namespace = namespace
    self.__auth_domain = _auth_domain
    self.__symbols = self.TOKENIZE_REGEX.findall(query_string)
    initial_error = None
    for backwards_compatibility_mode in xrange(len(self.RESERVED_KEYWORDS)):
        self.__InitializeParseState()
        self.__active_reserved_words = self.__GenerateReservedWords(backwards_compatibility_mode)
        try:
            self.__Select()
        except datastore_errors.BadQueryError as error:
            logging.log(LOG_LEVEL, initial_error)
            if (not initial_error):
                initial_error = error
        else:
            break
    else:
        raise initial_error
