public void Dispose() { if (this.reader != null) { this.reader.Dispose(); this.reader = null; } }
CharStream(CharStream.Reader reader) { if (reader == null) { throw new ObjectDisposedException("reader"); } this.reader = reader; var currentPosition = this.reader.CurrentPosition; var current = (this.reader.Peek() == CharStream.Reader.EOF) ? Option.None <IPair <Char, Position> >() : Option.Some <IPair <Char, Position> >( Pair.Return <Char, Position>((Char)this.reader.Read(), currentPosition)); this.Current = current; this.restStream = Delayed.Return(() => new CharStream(this.reader)); }