Antlr4.Runtime.CommonTokenStream.Lb C# (CSharp) Method

Lb() protected method

protected Lb ( int k ) : IToken
k int
return IToken
        protected internal override IToken Lb(int k)
        {
            if (k == 0 || (p - k) < 0)
            {
                return null;
            }
            int i = p;
            int n = 1;
            // find k good tokens looking backwards
            while (n <= k && i > 0)
            {
                // skip off-channel tokens
                i = PreviousTokenOnChannel(i - 1, channel);
                n++;
            }
            if (i < 0)
            {
                return null;
            }
            return tokens[i];
        }