Example usage for org.antlr.v4.tool Grammar createLexerInterpreter

List of usage examples for org.antlr.v4.tool Grammar createLexerInterpreter

Introduction

In this page you can find the example usage for org.antlr.v4.tool Grammar createLexerInterpreter.

Prototype

public LexerInterpreter createLexerInterpreter(CharStream input) 

Source Link

Usage

From source file:org.opencypher.tools.grammar.Antlr4TestUtils.java

License:Apache License

private static void parseWithListeners(Grammar grammar, String query, ANTLRErrorListener lexerListener,
        ANTLRErrorListener parserListener) {
    LexerInterpreter lexer = grammar.createLexerInterpreter(new ANTLRInputStream(query));
    ParserInterpreter parser = grammar.createParserInterpreter(new CommonTokenStream(lexer));
    lexer.removeErrorListeners();//  w  w  w  . j a  v a  2  s.  co  m
    parser.removeErrorListeners();
    lexer.addErrorListener(lexerListener);
    parser.addErrorListener(parserListener);
    parser.parse(grammar.getRule(Antlr4.PREFIX + "Cypher").index);
}