// Private helper used to check for newlines and transform and record as necessary. Returns the // possibly translated character read. private int ReadChar() { int c = ReadOne(); if (c != -1) { _position++; } if (c == '\r') { Debug.Assert(_lastChar == -1); // we can't Peek here because Peek() won't block for more input int next = _reader.Read(); if (next == '\n') { _position++; _terminators |= TerminatorStyles.CrLf; } else { _lastChar = next; _terminators |= TerminatorStyles.Cr; } c = '\n'; } else if (c == '\n') { _terminators |= TerminatorStyles.Lf; } return(c); }
// Private helper used to check for newlines and transform and record as necessary. Returns the // possibly translated character read. private int ReadChar() { int c = reader.Read(); if (c != -1) { position++; } if (c == '\r' && reader.Peek() == '\n') { c = reader.Read(); position++; terminators |= TerminatorStyles.CrLf; } else if (c == '\r') { c = '\n'; terminators |= TerminatorStyles.Cr; } else if (c == '\n') { terminators |= TerminatorStyles.Lf; } return(c); }
public PythonUniversalReader(TextReader /*!*/ reader, Encoding /*!*/ encoding, long position) : base(reader, encoding, position) { _terminators = TerminatorStyles.None; }
// Private helper used to check for newlines and transform and record as necessary. Returns the // possibly translated character read. private int ReadChar() { int c = reader.Read(); if (c != -1) position++; if (c == '\r' && reader.Peek() == '\n') { c = reader.Read(); position++; terminators |= TerminatorStyles.CrLf; } else if (c == '\r') { c = '\n'; terminators |= TerminatorStyles.Cr; } else if (c == '\n') { terminators |= TerminatorStyles.Lf; } return c; }
public PythonUniversalReader(Stream stream, Encoding encoding) : base(stream, encoding) { if (stream.CanSeek) position = stream.Position; reader = new StreamReader(stream, encoding); terminators = TerminatorStyles.None; }
public PythonUniversalReader(Stream stream, Encoding encoding) : base(stream, encoding) { reader = new StreamReader(stream, encoding); terminators = TerminatorStyles.None; }