The peeking text editor allows infinite peeking compared to the normal text reader which only allows one character at a time.
Inheritance: System.IO.TextReader
Exemplo n.º 1
0
        /// <summary>
        /// Parses a collection of code elements from a stream reader.
        /// </summary>
        /// <param name="reader">Code stream reader</param>
        /// <returns>A collection of parsed code elements.</returns>
        public ReadOnlyCollection <ICodeElement> Parse(TextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            List <ICodeElement> codeElements = new List <ICodeElement>();

            Reset();
            var peekingTextReader = reader as PeekingTextReader;

            if (peekingTextReader != null)
            {
                _reader = peekingTextReader;
            }
            else
            {
                _reader = new PeekingTextReader(reader);
            }

            codeElements = DoParseElements();

            return(codeElements.AsReadOnly());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses a collection of code elements from a stream reader.
        /// </summary>
        /// <param name="reader">Code stream reader</param>
        /// <returns>A collection of parsed code elements.</returns>
        public ReadOnlyCollection<ICodeElement> Parse(TextReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            List<ICodeElement> codeElements = new List<ICodeElement>();

            Reset();
            var peekingTextReader = reader as PeekingTextReader;
            if (peekingTextReader != null)
                _reader = peekingTextReader;
            else
                _reader = new PeekingTextReader(reader);

            codeElements = DoParseElements();

            return codeElements.AsReadOnly();
        }