Esempio n. 1
0
        /// <summary>
        /// Sets the current iterator position to a previous position returned by GetCurrentPosition.
        /// After a call to this method, GetNextToken returns the token FOLLOWING the current position.
        /// </summary>
        public void SeekToPosition(object iteratorPosition)
        {
            // Restore iterators positions
            currentPosition = (CopyTokensLinesIteratorPosition)iteratorPosition;
            if (currentPosition.ImportedDocumentIterator != null)
            {
                currentPosition.ImportedDocumentIterator.SeekToPosition(currentPosition.ImportedDocumentIteratorPosition);
            }

            // Restore current line & current token
            if (currentPosition.LineIndex >= 0)
            {
                currentLine = tokensLines[currentPosition.LineIndex];
            }
            else
            {
                currentLine = null;
            }
            if (currentPosition.TokenIndexInLine >= 0 && currentLine != null)
            {
                currentTokenInMainDocument = currentLine.TokensWithCompilerDirectives[currentPosition.TokenIndexInLine];
            }
            else
            {
                currentTokenInMainDocument = null;
            }
        }
        /// <summary>
        /// Sets the current iterator position to a previous position returned by GetCurrentPosition.
        /// After a call to this method, GetNextToken returns the token FOLLOWING the current position.
        /// </summary>
        public void SeekToPosition(object iteratorPosition)
        {
            // Restore iterators positions
            currentPosition = (CopyTokensLinesIteratorPosition)iteratorPosition;
            if(currentPosition.ImportedDocumentIterator != null)
            {
                currentPosition.ImportedDocumentIterator.SeekToPosition(currentPosition.ImportedDocumentIteratorPosition);
            }

            // Restore current line & current token
            if (currentPosition.LineIndex >= 0)
            {
                currentLine = tokensLines[currentPosition.LineIndex];
            }
            else
            {
                currentLine = null;
            }
            if (currentPosition.TokenIndexInLine >= 0 && currentLine != null)
            {
                currentTokenInMainDocument = currentLine.TokensWithCompilerDirectives[currentPosition.TokenIndexInLine];
            }
            else
            {
                currentTokenInMainDocument = null;
            }
        }