Example #1
0
        protected sealed override void Rewind(Positioned <int> bookmark)
        {
            if (_bufPos == _bufSize && _current.HasValue)
            {
                // we were writing to the buffer before the rewind,
                // so don't forget to store the last value
                PushBuf(_current.GetValueOrDefault());
            }
            _bufPos  = bookmark.Value;
            _current = _bufPos >= _bufSize
                ? Maybe.Nothing <TToken>()
                : Maybe.Just(Buffer[_bufPos]);

            _sourcePos = bookmark.Pos;
        }
Example #2
0
 protected sealed override void Rewind(Positioned <int> bookmark)
 {
     _pos = bookmark.Value;
     SetCurrent();
     _sourcePos = bookmark.Pos;
 }