def preconfigure(self): CQLGrammar.preconfigure(self) self.cmp_single = u':'.split()
# -*- coding: utf-8 -*- # (c) 2014-2016 Andreas Motl, Elmyra UG import re import types import logging import StringIO from pyparsing import ParseResults from patzilla.util.cql.pyparsing.parser import CQLGrammar from patzilla.util.cql.pyparsing.util import walk_token_results, token_to_triple from patzilla.util.cql.knowledge import indexes_publication_number from patzilla.util.numbers.normalize import normalize_patent from patzilla.util.data.convert import shrink_list log = logging.getLogger(__name__) grammar = CQLGrammar() def parse_cql(cql): """ Helper function for doctests """ from . import CQL c = CQL(cql) return c.parse() def tokens_to_cql(tokens): """ Reproduce CQL query string from parsed tokens >>> tokens = parse_cql('foo=bar and baz=(qux or quux)') >>> tokens_to_cql(tokens)