(define-module (here-strings)
#:use-module (ice-9 match))
(define (read-here-string c port)
(unless (and (char=? #\" (read-char port))
(char=? #\" (read-char port)))
(error "Invalid here-string syntax"))
(let loop ((chars '()))
(match chars
((#\" #\" #\" . chars)
(list->string (reverse! chars)))
(_ (let ((c (read-char port)))
(if (eof-object? c)
(error "EOF within here-string")
(loop (cons c chars))))))))
(read-hash-extend #\" read-here-string)