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

Sync() protected method

Make sure index i in tokens has a token.
protected Sync ( int i ) : bool
i int
return bool
        protected internal virtual bool Sync(int i)
        {
            System.Diagnostics.Debug.Assert(i >= 0);
            int n = i - tokens.Count + 1;
            // how many more elements we need?
            //System.out.println("sync("+i+") needs "+n);
            if (n > 0)
            {
                int fetched = Fetch(n);
                return fetched >= n;
            }
            return true;
        }