Пример #1
0
def CreateParser(query):
    """Creates a Query Parser."""
    input_string = antlr3.ANTLRStringStream(query)
    lexer = QueryLexerWithErrors(input_string)
    tokens = antlr3.CommonTokenStream(lexer)
    parser = QueryParserWithErrors(tokens)
    return parser
def CreateParser(expression):
  """Creates a Expression Parser."""
  input_string = antlr3.ANTLRStringStream(unicode_util.LimitUnicode(expression))
  lexer = ExpressionLexerWithErrors(input_string)
  tokens = antlr3.CommonTokenStream(lexer)
  parser = ExpressionParserWithErrors(tokens)
  return parser