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

GetMissingSymbol() private method

private GetMissingSymbol ( Parser recognizer ) : IToken
recognizer Parser
return IToken
        protected internal virtual IToken GetMissingSymbol(Parser recognizer)
        {
            IToken currentSymbol = recognizer.CurrentToken;
            IntervalSet expecting = GetExpectedTokens(recognizer);
            int expectedTokenType = expecting.MinElement;
            // get any element
            string tokenText;
            if (expectedTokenType == TokenConstants.EOF)
            {
                tokenText = "<missing EOF>";
            }
            else
            {
                tokenText = "<missing " + recognizer.Vocabulary.GetDisplayName(expectedTokenType) + ">";
            }
            IToken current = currentSymbol;
            IToken lookback = ((ITokenStream)recognizer.InputStream).LT(-1);
            if (current.Type == TokenConstants.EOF && lookback != null)
            {
                current = lookback;
            }
            return ConstructToken(((ITokenStream)recognizer.InputStream).TokenSource, expectedTokenType, tokenText, current);
        }