protected int nextTokenOnChannel(int i, int channel) {
		sync(i);
		if (i >= size()) {
			return size() - 1;
		}

		Token token = tokens.get(i);
		while ( token.getChannel()!=channel ) {
			if ( token.getType()==Token.EOF ) {
				return i;
			}

			i++;
			sync(i);
			token = tokens.get(i);
		}

		return i;
	}
Given a starting index, return the index of the next token on channel.
Return {@code i} if {@code tokens[i]} is on channel. Return the index of
the EOF token if there are no tokens on channel between {@code i} and
EOF.
runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java