/*
 [The "BSD license"]
 Copyright (c) 2011 Terence Parr
 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
 3. The name of the author may not be used to endorse or promote products
    derived from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.antlr.v4.runtime;

/** Bail out of parser at first syntax error. Do this to use it:
 *      myparser.setErrorHandler(new BailErrorStrategy<Token>());
 */
public class BailErrorStrategy extends DefaultErrorStrategy<Token> {
    /** Instead of recovering from exception e, Re-throw wrote it wrapped
     *  in a generic RuntimeException so it is not caught by the
     *  rule function catches.  Exception e is the "cause" of the
     *  RuntimeException.
     */
    @Override
    public void recover(BaseRecognizer recognizer, RecognitionException e) {
        throw new RuntimeException(e);
    }

    /** Make sure we don't attempt to recover inline; if the parser
     *  successfully recovers, it won't throw an exception.
     */
    @Override
    public Token recoverInline(BaseRecognizer recognizer)
        throws RecognitionException
    {
        throw new RuntimeException(new InputMismatchException(recognizer));
    }

    /** Make sure we don't attempt to recover from problems in subrules. */
    @Override
    public void sync(BaseRecognizer recognizer) { }
}

@@ -1632,16 +1632,24 @@
 Strategy
+%3CSymbol%3E
  extends
@@ -1670,21 +1670,22 @@
 trategy%3C
-Token
+Symbol
 %3E %7B%0A    
@@ -1963,32 +1963,40 @@
 r(BaseRecognizer
+%3CSymbol%3E
  recognizer, Rec
@@ -2225,21 +2225,22 @@
  public 
-Token
+Symbol
  recover
@@ -2252,32 +2252,40 @@
 e(BaseRecognizer
+%3CSymbol%3E
  recognizer)%0A   
@@ -2488,32 +2488,32 @@
 /%0A    @Override%0A
-
     public void 
@@ -2531,16 +2531,24 @@
 cognizer
+%3CSymbol%3E
  recogni

Add type parameter to BailErrorStrategy since the class may safely be used with any type of recognizer