public virtual IToken NextToken()
{
if (i >= tokens.Count)
{
if (eofToken == null)
{
int start = -1;
if (tokens.Count > 0)
{
int previousStop = tokens[tokens.Count - 1].StopIndex;
if (previousStop != -1)
{
start = previousStop + 1;
}
}
int stop = Math.Max(-1, start - 1);
eofToken = _factory.Create(Tuple.Create((ITokenSource)this, InputStream), TokenConstants.EOF, "EOF", TokenConstants.DefaultChannel, start, stop, Line, Column);
}
return eofToken;
}
IToken t = tokens[i];
if (i == tokens.Count - 1 && t.Type == TokenConstants.EOF)
{
eofToken = t;
}
i++;
return t;
}