Example usage for org.antlr.v4.runtime BailErrorStrategy subclass-usage

List of usage examples for org.antlr.v4.runtime BailErrorStrategy subclass-usage

Introduction

In this page you can find the example usage for org.antlr.v4.runtime BailErrorStrategy subclass-usage.

Usage

From source file com.espertech.esper.epl.parse.Antlr4ErrorStrategy.java

public class Antlr4ErrorStrategy extends BailErrorStrategy {
    public void reportError(Parser recognizer, RecognitionException e) {
        // Antlr has an issue handling LexerNoViableAltException as then offending token can be null
        // Try: "select a.b('aa\") from A"
        if (e instanceof LexerNoViableAltException && e.getOffendingToken() == null) {
            return;

From source file org.harctoolbox.irp.ErrorStrategy.java

/**
 * This implementation of ANTLRErrorStrategy responds to syntax errors
 * by immediately canceling the parse operation with a
 * {@link ParseCancellationException}. The implementation ensures that the
 * {@link ParserRuleContext#exception} field is set for all parse tree nodes
 * that were not completed prior to encountering the error.