/// <summary> /// Parses .svc file content from the specified reader. /// </summary> /// <param name="reader">The reader to read file content.</param> /// <returns>Next state.</returns> public SvcDirectiveParserState Parse(TextReader reader) { Contract.Requires(reader != null); using (var wrappedReader = new LineCountingTextReader(this, reader)) { int c = wrappedReader.Read(); if (c == -1) { this.OnUnexpectedEof(); } if (this.CanSkipWhitespace && Char.IsWhiteSpace(( char )c)) { return(this); } switch (CharUnicodeInfo.GetUnicodeCategory(( char )c)) { case UnicodeCategory.Control: case UnicodeCategory.OtherNotAssigned: { throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "Unexpectedly char 'u+{0:x4}' at line:{1}, position:{2}", c, this.LineNumber, this.Position ) ); } } return(this.ParseCore(( char )c, wrappedReader)); } }
/// <summary> /// Parses .svc file content from the specified reader. /// </summary> /// <param name="reader">The reader to read file content.</param> /// <returns>Next state.</returns> public SvcDirectiveParserState Parse( TextReader reader ) { Contract.Requires( reader != null ); using ( var wrappedReader = new LineCountingTextReader( this, reader ) ) { int c = wrappedReader.Read(); if ( c == -1 ) { this.OnUnexpectedEof(); } if ( this.CanSkipWhitespace && Char.IsWhiteSpace( ( char )c ) ) { return this; } switch ( CharUnicodeInfo.GetUnicodeCategory( ( char )c ) ) { case UnicodeCategory.Control: case UnicodeCategory.OtherNotAssigned: { throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "Unexpectedly char 'u+{0:x4}' at line:{1}, position:{2}", c, this.LineNumber, this.Position ) ); } } return this.ParseCore( ( char )c, wrappedReader ); } }