--- /dev/null
+#| -*-Scheme-*-
+
+Copyright (C) 2010 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Keywords
+;;; package: (runtime keyword)
+
+(declare (usual-integrations))
+\f
+
+;;; *KEYWORD-STYLE*
+;;
+;; Should be one of DSSSL CL BOTH SRFI-88 or #f.
+(define *keyword-style* #f)
+
non-canon-symbol-quoted))
(fix:= (string-length s) 0)
(and (char-set-member? char-set/number-leaders (string-ref s 0))
- (string->number s)))
+ (string->number s))
+ (looks-like-keyword? s))
(begin
(*unparse-char #\|)
(let ((end (string-length s)))
(*unparse-char #\|))
(*unparse-string s))))
+(define (looks-like-keyword? string)
+ (case (environment-lookup *environment* '*KEYWORD-STYLE*)
+ ((BOTH)
+ (or (char=? (string-ref string 0) #\:)
+ (char=? (string-ref string (- (string-length string) 1)) #\:)))
+ ((CL)
+ (char=? (string-ref string 0) #\:))
+ ((DSSSL SRFI-88)
+ (char=? (string-ref string (- (string-length string) 1)) #\:))
+ (else #f)))
+
(define (unparse/character character)
(if (or *slashify?*
(not (char-ascii? character)))