From 17433b03b1464c45515fbceb34fa09a28eb02311 Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Mon, 29 Mar 2010 11:16:32 -0700 Subject: [PATCH] Handle edge case of : as a symbol. --- src/runtime/parse.scm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/runtime/parse.scm b/src/runtime/parse.scm index 4e4ad435b..5d5ece9e8 100644 --- a/src/runtime/parse.scm +++ b/src/runtime/parse.scm @@ -362,17 +362,25 @@ USA. (define (handler:symbol port db ctx char) ctx (receive (string quoted? final) (parse-atom port db (list char)) - (declare (ignore quoted?)) (if (and (eq? final #\:) - (eq? (db-keyword-style db) 'SUFFIX)) + (eq? (db-keyword-style db) 'SUFFIX) + ;; Nasty edge case: A bare colon. Treat as a symbol + ;; unless quoted. + (or (not (= (string-length string) 1)) + quoted?)) (string->keyword (string-head string (- (string-length string) 1))) (string->symbol string)))) (define (handler:prefix-keyword port db ctx char) (if (eq? (db-keyword-style db) 'PREFIX) (receive (string quoted? final) (parse-atom port db '()) - (declare (ignore quoted? final)) - (string->keyword string)) + (declare (ignore final)) + (if (and (zero? (string-length string)) + (not quoted?)) + ;; Nasty edge case: A bare colon. Treat as a symbol + ;; unless quoted. + (string->symbol ":") + (string->keyword string))) ;; If prefix-style keywords are not in use, just ;; tail call the symbol handler. (handler:symbol port db ctx char))) -- 2.25.1