Antlr4.Runtime.DefaultErrorStrategy.ReportNoViableAlternative C# (CSharp) Method

ReportNoViableAlternative() protected method

This is called by ReportError(Parser, RecognitionException) when the exception is a NoViableAltException .
protected ReportNoViableAlternative ( Parser recognizer, NoViableAltException e ) : void
recognizer Parser the parser instance
e NoViableAltException the recognition exception
return void
        protected internal virtual void ReportNoViableAlternative(Parser recognizer, NoViableAltException e)
        {
            ITokenStream tokens = ((ITokenStream)recognizer.InputStream);
            string input;
            if (tokens != null)
            {
                if (e.StartToken.Type == TokenConstants.EOF)
                {
                    input = "<EOF>";
                }
                else
                {
                    input = tokens.GetText(e.StartToken, e.OffendingToken);
                }
            }
            else
            {
                input = "<unknown input>";
            }
            string msg = "no viable alternative at input " + EscapeWSAndQuote(input);
            NotifyErrorListeners(recognizer, msg, e);
        }