Antlr4.Runtime.BailErrorStrategy.Recover C# (CSharp) Method

Recover() public method

Instead of recovering from exception e , re-throw it wrapped in a ParseCanceledException so it is not caught by the rule function catches. Use System.Exception.InnerException() to get the original RecognitionException .
public Recover ( Parser recognizer, RecognitionException e ) : void
recognizer Parser
e RecognitionException
return void
        public override void Recover(Parser recognizer, RecognitionException e)
        {
            for (ParserRuleContext context = recognizer.Context; context != null; context = ((ParserRuleContext)context.Parent))
            {
                context.exception = e;
            }
            throw new ParseCanceledException(e);
        }