/// <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()); }
/// <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(); }