[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] escape single backslash when printing symb
From: |
Felix |
Subject: |
Re: [Chicken-hackers] [PATCH] escape single backslash when printing symbols |
Date: |
Tue, 12 Feb 2013 22:43:56 +0100 (CET) |
From: Felix <address@hidden>
Subject: [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).
>
Ack. Introduces a bug. Here a corrected version.
cheers,
felix
>From 092bd7c89a0bfafb4ff3841ac7654253fd80efcb 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..7d820ef 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 ((or (eq? #\# c) (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