[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] escape single backslash when printing symbols
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] escape single backslash when printing symbols |
Date: |
Tue, 12 Feb 2013 22:41:11 +0100 (CET) |
The attached patch fixes the printer to escape #\\ in symbols.
Without this patch, such symbols can not be read in (the backslash
is treated as an escape for the following character).
cheers,
felix
>From e4d01c08ad6aa7d7c335d4238c6c974bf1393ff3 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Tue, 12 Feb 2013 22:38:45 +0100
Subject: [PATCH] escape single backslash in symbols when printing
---
library.scm | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/library.scm b/library.scm
index 3cabd3d..b723924 100644
--- a/library.scm
+++ b/library.scm
@@ -3167,7 +3167,7 @@ EOF
(let ([csp (case-sensitive)]
[ksp (keyword-style)]
[length-limit (##sys#print-length-limit)]
- [special-characters '(#\( #\) #\, #\[ #\] #\{ #\} #\' #\" #\; #\
#\` #\|)] )
+ [special-characters '(#\( #\) #\, #\[ #\] #\{ #\} #\' #\" #\; #\
#\` #\| #\\)] )
(define (outstr port str)
(if length-limit
@@ -3224,8 +3224,7 @@ EOF
(cond ((eq? len 0) #f)
((eq? len 1)
(let ((c (##core#inline "C_subchar" str 0)))
- (cond ((or (eq? #\. c) (eq? #\# c) (eq? #\; c) (eq? #\, c)
(eq? #\| c))
- #f)
+ (cond ((eq? #\# c) #f)
((specialchar? c) #f)
((char-numeric? c) #f)
(else #t))))
@@ -3235,8 +3234,8 @@ EOF
(let ((c (##core#inline "C_subchar" str 0)))
(cond ((or (char-numeric? c)
(eq? c #\+)
- (eq? c #\-)
- (eq? c #\.) )
+ (eq? c #\.)
+ (eq? c #\-) )
(not (##sys#string->number str)) )
((eq? c #\:) (not (eq? ksp #:prefix)))
((and (eq? c #\#)
--
1.7.0.4
- [Chicken-hackers] [PATCH] escape single backslash when printing symbols,
Felix <=