Example usage for org.antlr.v4.runtime DiagnosticErrorListener DiagnosticErrorListener

List of usage examples for org.antlr.v4.runtime DiagnosticErrorListener DiagnosticErrorListener

Introduction

In this page you can find the example usage for org.antlr.v4.runtime DiagnosticErrorListener DiagnosticErrorListener.

Prototype

public DiagnosticErrorListener(boolean exactOnly) 

Source Link

Document

Initializes a new instance of DiagnosticErrorListener , specifying whether all ambiguities or only exact ambiguities are reported.

Usage

From source file:org.elasticsearch.xpack.sql.parser.SqlParser.java

License:Open Source License

private void debug(SqlBaseParser parser) {

    // when debugging, use the exact prediction mode (needed for diagnostics as well)
    parser.getInterpreter().setPredictionMode(PredictionMode.SLL);

    parser.addParseListener(parser.new TraceListener());

    parser.addErrorListener(new DiagnosticErrorListener(false) {
        @Override/*w  w w.ja  va  2  s  .c  o m*/
        public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
                BitSet conflictingAlts, ATNConfigSet configs) {
        }

        @Override
        public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
                int prediction, ATNConfigSet configs) {
        }
    });
}