Search in sources :

Example 1 with SightlyLexer

use of org.apache.sling.scripting.sightly.impl.parser.expr.generated.SightlyLexer in project sling by apache.

the class ExpressionParser method createParser.

private SightlyParser createParser(String string) {
    SightlyLexer lexer = new SightlyLexer(new ANTLRInputStream(string));
    lexer.removeErrorListeners();
    lexer.addErrorListener(new SightlyParserErrorListener());
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    SightlyParser parser = new SightlyParser(tokenStream);
    parser.removeErrorListeners();
    parser.addErrorListener(new SightlyParserErrorListener());
    return parser;
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) SightlyLexer(org.apache.sling.scripting.sightly.impl.parser.expr.generated.SightlyLexer) SightlyParser(org.apache.sling.scripting.sightly.impl.parser.expr.generated.SightlyParser) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream)

Aggregations

ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 SightlyLexer (org.apache.sling.scripting.sightly.impl.parser.expr.generated.SightlyLexer)1 SightlyParser (org.apache.sling.scripting.sightly.impl.parser.expr.generated.SightlyParser)1