public Token PeekToken() { if (tokens.Count > 0) { return(tokens.Peek()); } else { if (sourceStream.IsEmpty()) { return(Token.Empty); } else { Token tok; while ((tok = sourceStream.ReadToken()) != Token.Empty) { tokens.Enqueue(tok); if (maxBufferSize != 0 && tokens.Count >= maxBufferSize) { break; } } if (tokens.Count > 0) { return(tokens.Peek()); } else { return(Token.Empty); } } } }
/// <summary> /// Reads the next token and removes it from the list /// </summary> /// <returns>the next toke</returns> private Token ReadToken() { return(_tokenStream.ReadToken()); }