I've heard that it's possible to hook the lisp reader to control how
tokenization / syntax / etc works. Is there any way to change read so
that when it raises "end-of-file" it can also provide a restart to
continue parsing at the same point? For effeciency's sake, it would be
nice if I didn't have to start over with reading at the beginning of
the stream.
My eventual goal is to be able to write code to read s-exprs from a
socket like so:
(let ((stream (make-socket-stream socket)))
(handler-bind ((end-of-file
(case (socket-select socket :timeout 1000)
(t (read-more)) ; invoke restart
(nil (error "Timed out")))))
(read stream)))
Is this is any way possible?