From 4d355831458961f1643a7fcd7c1fc010d8ecef46 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Tue, 8 May 2012 11:41:27 -0700 Subject: [PATCH] bug#36430: Write should escape symbols that look special. (write '|#f|) now emits "|#f|", not "#f". --- src/runtime/unpars.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.25.1