(defun read-whitespace (stream)
(iterate
(with part = (make-instance 'whitespace-part))
(initially (setf (start-position part) (1+ (file-position stream))))
(while (whitespacep (peek-char nil stream nil nil)))
(read-char stream)
(finally (setf (end-position part) (file-position stream)))
(finally (return-from read-whitespace part))))
Source Context