From: Joe Marshall Date: Mon, 29 Mar 2010 18:16:32 +0000 (-0700) Subject: Handle edge case of : as a symbol. X-Git-Tag: 20100708-Gtk~71^2~7 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=17433b03b1464c45515fbceb34fa09a28eb02311;p=mit-scheme.git Handle edge case of : as a symbol. --- 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)))