Ejemplo n.º 1
0
        /// <summary>
        /// Gets the next token from the input and makes it the current token.
        /// This method should only be called if hasMoreTokens() is true.
        /// Initially there is no current token.
        /// </summary>
        public void Advance()
        {
            // var tokenBuffer = _tokens[_currentTokenIdx];

            HasMoreTokens = _tokens.Count > _currentTokenIdx + 1 ? true : false;

            if (HasMoreTokens)
            {
                _currentToken = _tokens[_currentTokenIdx];
                TokenType     = _currentToken.Type;
                CurrentToken  = _currentToken.Token;

                _currentTokenIdx++;


                NextToken = _tokens[_currentTokenIdx];
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the next token from the input and makes it the current token. 
        /// This method should only be called if hasMoreTokens() is true. 
        /// Initially there is no current token.
        /// </summary>
        public void Advance()
        {
            // var tokenBuffer = _tokens[_currentTokenIdx];

            HasMoreTokens = _tokens.Count > _currentTokenIdx + 1 ? true : false;

            if (HasMoreTokens)
            {
                _currentToken = _tokens[_currentTokenIdx];
                TokenType = _currentToken.Type;
                CurrentToken = _currentToken.Token;

                _currentTokenIdx++;

                NextToken = _tokens[_currentTokenIdx];
            }
        }