From: Matt Birkholz Date: Tue, 8 May 2012 18:41:27 +0000 (-0700) Subject: bug#36430: Write should escape symbols that look special. X-Git-Tag: release-9.2.0~247^2~16 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=4d355831458961f1643a7fcd7c1fc010d8ecef46;p=mit-scheme.git bug#36430: Write should escape symbols that look special. (write '|#f|) now emits "|#f|", not "#f". --- diff --git a/src/runtime/unpars.scm b/src/runtime/unpars.scm index adeaaf997..bde57101a 100644 --- a/src/runtime/unpars.scm +++ b/src/runtime/unpars.scm @@ -367,7 +367,8 @@ USA. (and (char-set-member? char-set/number-leaders (string-ref s 0)) (string->number s)) (and (fix:> (string-length s) 1) - (looks-like-keyword? s))) + (or (looks-special? s) + (looks-like-keyword? s)))) (begin (*unparse-char #\|) (let ((end (string-length s))) @@ -387,6 +388,9 @@ USA. (*unparse-char #\|)) (*unparse-string s))) +(define (looks-special? string) + (char=? (string-ref string 0) #\#)) + (define (looks-like-keyword? string) (case (environment-lookup *environment* '*PARSER-KEYWORD-STYLE*) ((PREFIX)