Search in sources :

Example 1 with FilterOrExpressionContext

use of org.geotoolkit.cql.CQLParser.FilterOrExpressionContext in project geotoolkit by Geomatys.

the class CQL method compileFilterOrExpression.

private static Object compileFilterOrExpression(String cql) {
    try {
        // lexer splits input into tokens
        final ANTLRInputStream input = new ANTLRInputStream(cql);
        final TokenStream tokens = new CommonTokenStream(new CQLLexer(input));
        // parser generates abstract syntax tree
        final CQLParser parser = new CQLParser(tokens);
        final FilterOrExpressionContext retfilter = parser.filterOrExpression();
        return retfilter;
    } catch (RecognitionException e) {
        throw new IllegalStateException("Recognition exception is never thrown, only declared.");
    }
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) TokenStream(org.antlr.v4.runtime.TokenStream) CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) FilterOrExpressionContext(org.geotoolkit.cql.CQLParser.FilterOrExpressionContext) CQLParser(org.geotoolkit.cql.CQLParser) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) RecognitionException(org.antlr.v4.runtime.RecognitionException)

Aggregations

ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 RecognitionException (org.antlr.v4.runtime.RecognitionException)1 TokenStream (org.antlr.v4.runtime.TokenStream)1 CQLParser (org.geotoolkit.cql.CQLParser)1 FilterOrExpressionContext (org.geotoolkit.cql.CQLParser.FilterOrExpressionContext)1