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

GetHiddenTokensToLeft() public method

Collect all tokens on specified channel to the left of the current token up until we see a token on Lexer.DefaultTokenChannel . If channel is -1 , find any non default channel token.
public GetHiddenTokensToLeft ( int tokenIndex, int channel ) : IList
tokenIndex int
channel int
return IList
        public virtual IList<IToken> GetHiddenTokensToLeft(int tokenIndex, int channel)
        {
            LazyInit();
            if (tokenIndex < 0 || tokenIndex >= tokens.Count)
            {
                throw new ArgumentOutOfRangeException(tokenIndex + " not in 0.." + (tokens.Count - 1));
            }
            if (tokenIndex == 0)
            {
                // obviously no tokens can appear before the first token
                return null;
            }
            int prevOnChannel = PreviousTokenOnChannel(tokenIndex - 1, Lexer.DefaultTokenChannel);
            if (prevOnChannel == tokenIndex - 1)
            {
                return null;
            }
            // if none onchannel to left, prevOnChannel=-1 then from=0
            int from = prevOnChannel + 1;
            int to = tokenIndex - 1;
            return FilterForChannel(from, to, channel);
        }

Same methods

BufferedTokenStream::GetHiddenTokensToLeft ( int tokenIndex ) : IList