~ chicken-core (chicken-5) c29e9b2151bfd06efb1e46dd51682059770e8048


commit c29e9b2151bfd06efb1e46dd51682059770e8048
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Mar 1 11:27:51 2011 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Mar 1 11:27:51 2011 +0100

    fixes in octal string-escape reader; added test

diff --git a/library.scm b/library.scm
index 4e1aa1fb..6f0146b3 100644
--- a/library.scm
+++ b/library.scm
@@ -2389,7 +2389,7 @@ EOF
 			  (if (##sys#unicode-surrogate? n)
 			      (if (and (eqv? #\\ (##sys#read-char-0 port))
 				       (eqv? #\u (##sys#read-char-0 port)))
-				  (let* ((m (r-usequence "u" 4))
+				  (let* ((m (r-usequence "u" 4 16))
 					 (cp (##sys#surrogates->codepoint n m)))
 				    (if cp
 					(loop (##sys#read-char-0 port)
@@ -2398,7 +2398,7 @@ EOF
 				  (##sys#read-error port "unpaired escaped surrogate" n))
 			      (loop (##sys#read-char-0 port) (r-cons-codepoint n lst)) ) ))
 		       ((#\U)
-			(let ([n (r-usequence "U" 8)])
+			(let ([n (r-usequence "U" 8 16)])
 			  (if (##sys#unicode-surrogate? n)
 			      (##sys#read-error port (string-append "invalid escape (surrogate)" n))
 			      (loop (##sys#read-char-0 port) (r-cons-codepoint n lst)) )))
@@ -2413,7 +2413,7 @@ EOF
 				port 
 				"undefined escape sequence in string - probably forgot backslash"
 				c)
-			       (loop (##sys#read-char-0 port) (cons )c lst))) ) ))
+			       (loop (##sys#read-char-0 port) (cons c lst))) ) )))
 		    ((eq? term c) (##sys#reverse-list->string lst))
 		    (else (loop (##sys#read-char-0 port) (cons c lst))) ) ))
 		    
diff --git a/tests/reader-tests.scm b/tests/reader-tests.scm
index 6d3e4f76..894e8461 100644
--- a/tests/reader-tests.scm
+++ b/tests/reader-tests.scm
@@ -1,6 +1,9 @@
 ;;;; reader-tests.scm
 
 
+(use utils)
+
+
 (set-sharp-read-syntax! #\& (lambda (p) (read p) (values)))
 (set-sharp-read-syntax! #\^ (lambda (p) (read p)))
 (set-read-syntax! #\! (lambda (p) (read-line p) (values)))
@@ -19,3 +22,4 @@
 !! bye
 
 (assert (string=? output "hi\nfoo\nbaz\nbye\n"))
+(assert (string=? "   ." (with-input-from-string "\x20\u0020\U00000020\056" read-all)))
Trap