Search in sources :

Example 1 with PredicateParser

use of com.yahoo.document.predicate.parser.PredicateParser in project vespa by vespa-engine.

the class Predicate method fromString.

public static Predicate fromString(String str) {
    ANTLRStringStream input = new ANTLRStringStream(str);
    PredicateLexer lexer = new PredicateLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    PredicateParser parser = new PredicateParser(tokens);
    try {
        return parser.predicate();
    } catch (RecognitionException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : ANTLRStringStream(org.antlr.runtime.ANTLRStringStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) PredicateLexer(com.yahoo.document.predicate.parser.PredicateLexer) PredicateParser(com.yahoo.document.predicate.parser.PredicateParser) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

PredicateLexer (com.yahoo.document.predicate.parser.PredicateLexer)1 PredicateParser (com.yahoo.document.predicate.parser.PredicateParser)1 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)1 CommonTokenStream (org.antlr.runtime.CommonTokenStream)1 RecognitionException (org.antlr.runtime.RecognitionException)1