@Override
    protected Token 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.get(i);
    }
Constructs a new {@link CommonTokenStream} using the specified token
source and filtering tokens to the specified channel. Only tokens whose
{@link Token#getChannel} matches {@code channel} or have the
{@link Token#getType} equal to {@link Token#EOF} will be returned by the
token stream lookahead methods.

@param tokenSource The token source.
@param channel The channel to use for filtering tokens.
runtime/Java/src/org/antlr/v4/runtime/CommonTokenStream.java