Antlr4.Runtime.BufferedTokenStream.NextTokenOnChannel C# (CSharp) Method

NextTokenOnChannel() protected method

Given a starting index, return the index of the next token on channel.
Given a starting index, return the index of the next token on channel. Return i if tokens[i] is on channel. Return the index of the EOF token if there are no tokens on channel between i and EOF.
protected NextTokenOnChannel ( int i, int channel ) : int
i int
channel int
return int
        protected internal virtual int NextTokenOnChannel(int i, int channel)
        {
            Sync(i);
            if (i >= Size)
            {
                return Size - 1;
            }
            IToken token = tokens[i];
            while (token.Channel != channel)
            {
                if (token.Type == TokenConstants.EOF)
                {
                    return i;
                }
                i++;
                Sync(i);
                token = tokens[i];
            }
            return i;
        }