From 1048375003478e9b4d7e1027d26869197653cda4 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 1 Apr 2016 22:41:01 -0400 Subject: [PATCH] Read literal whitespace chars --- scheme/read.sld | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scheme/read.sld b/scheme/read.sld index 99f647b5..b77039b5 100644 --- a/scheme/read.sld +++ b/scheme/read.sld @@ -448,12 +448,14 @@ (in-port:get-cnum ptbl)))))) (define (loop buf) (let ((c (peek-char fp))) - (if (or (eof-object? c) - (char-whitespace? c) - (and (> (length buf) 0) - (equal? c #\)))) - (done buf) - (loop (cons (read-char fp) buf))))) + (cond + ((or (eof-object? c) + (and (char-whitespace? c) (> (length buf) 0)) + (and (> (length buf) 0) + (equal? c #\)))) + (done buf)) + (else + (loop (cons (read-char fp) buf)))))) (loop '())) (define (read-str fp buf ptbl)