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

FilterForChannel() protected method

protected FilterForChannel ( int from, int to, int channel ) : IList
from int
to int
channel int
return IList
        protected internal virtual IList<IToken> FilterForChannel(int from, int to, int channel)
        {
            IList<IToken> hidden = new List<IToken>();
            for (int i = from; i <= to; i++)
            {
                IToken t = tokens[i];
                if (channel == -1)
                {
                    if (t.Channel != Lexer.DefaultTokenChannel)
                    {
                        hidden.Add(t);
                    }
                }
                else
                {
                    if (t.Channel == channel)
                    {
                        hidden.Add(t);
                    }
                }
            }
            if (hidden.Count == 0)
            {
                return null;
            }
            return hidden;
        }