Search in sources :

Example 1 with ScimFilterParser

use of io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterParser in project jans by JanssenProject.

the class ScimFilterParserService method getParseTree.

private ParseTree getParseTree(String filter, ScimFilterErrorListener errorListener) {
    ANTLRInputStream input = new ANTLRInputStream(filter);
    ScimFilterLexer lexer = new ScimFilterLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    ScimFilterParser parser = new ScimFilterParser(tokens);
    parser.setTrimParseTree(true);
    parser.removeErrorListeners();
    parser.addErrorListener(errorListener);
    return parser.filter();
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) ScimFilterLexer(io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterLexer) ScimFilterParser(io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterParser) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream)

Example 2 with ScimFilterParser

use of io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterParser in project oxTrust by GluuFederation.

the class ScimFilterParserService method getParser.

private ScimFilterParser getParser(String filter) throws Exception {
    log.info(" getParser() ");
    // Get lexer
    ANTLRInputStream input = new ANTLRInputStream(filter);
    ScimFilterLexer lexer = new ScimFilterLexer(input);
    // Get list of matched tokens
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    // Pass tokens to the parser
    ScimFilterParser parser = new ScimFilterParser(tokens);
    parser.setBuildParseTree(true);
    parser.setTrimParseTree(true);
    parser.setProfile(true);
    parser.removeErrorListeners();
    parser.setErrorHandler(new ScimFilterErrorHandler());
    return parser;
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) ScimFilterLexer(org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterLexer) ScimFilterParser(org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterParser) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream) ScimFilterErrorHandler(org.gluu.oxtrust.service.antlr.scimFilter.exception.ScimFilterErrorHandler)

Example 3 with ScimFilterParser

use of io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterParser in project oxTrust by GluuFederation.

the class ScimFilterParserService method getParseTree.

private ParseTree getParseTree(String filter, ScimFilterErrorListener errorListener) {
    ANTLRInputStream input = new ANTLRInputStream(filter);
    ScimFilterLexer lexer = new ScimFilterLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    ScimFilterParser parser = new ScimFilterParser(tokens);
    parser.setTrimParseTree(true);
    parser.removeErrorListeners();
    parser.addErrorListener(errorListener);
    return parser.filter();
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) ScimFilterLexer(org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterLexer) ScimFilterParser(org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterParser) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream)

Aggregations

ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)3 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)3 ScimFilterLexer (org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterLexer)2 ScimFilterParser (org.gluu.oxtrust.service.antlr.scimFilter.antlr4.ScimFilterParser)2 ScimFilterLexer (io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterLexer)1 ScimFilterParser (io.jans.scim.service.antlr.scimFilter.antlr4.ScimFilterParser)1 ScimFilterErrorHandler (org.gluu.oxtrust.service.antlr.scimFilter.exception.ScimFilterErrorHandler)1