Antlr4.Runtime.AntlrInputStream.Seek C# (CSharp) Method

Seek() public method

consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine.
consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine. If we seek backwards, just set p
public Seek ( int index ) : void
index int
return void
        public virtual void Seek(int index)
        {
            if (index <= p)
            {
                p = index;
                // just jump; don't update stream state (line, ...)
                return;
            }
            // seek forward, consume until p hits index or n (whichever comes first)
            index = Math.Min(index, n);
            while (p < index)
            {
                Consume();
            }
        }