>From f5b06523300b5b8880460d7cb3f935c300d85074 Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Mon, 27 May 2013 16:18:53 +1200 Subject: [PATCH] handle CR & CRLF-terminated lines when collapsing intraline whitespace --- library.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library.scm b/library.scm index 68165d9..d8264da 100644 --- a/library.scm +++ b/library.scm @@ -2521,12 +2521,19 @@ EOF (loop (##sys#read-char-0 port) (r-cons-codepoint n lst)) ))) ((#\\ #\' #\" #\|) (loop (##sys#read-char-0 port) (cons c lst))) - ((#\newline #\space #\tab) + ((#\newline #\return #\space #\tab) ;; Read "escaped" * * (let eat-ws ((c c) (nl? #f)) (case c ((#\space #\tab) (eat-ws (##sys#read-char-0 port) nl?)) + ((#\return) + (if nl? + (loop c lst) + (let ((nc (##sys#read-char-0 port))) + (if (eq? nc #\newline) ; collapse \r\n + (eat-ws (##sys#read-char-0 port) #t) + (eat-ws nc #t))))) ((#\newline) (if nl? (loop c lst) -- 1.7.10.4