;;; predicates for testing character attributes
-#!-sb-fluid (declaim (inline whitespacep))
-(defun whitespacep (char &optional (rt *readtable*))
+;;; the [1] and [2] here refer to ANSI glossary entries for
+;;; "whitespace".
+#!-sb-fluid (declaim (inline whitespace[1]p whitespace[2]p))
+(defun whitespace[1]p (char)
+ (test-attribute char +char-attr-whitespace+ *standard-readtable*))
+(defun whitespace[2]p (char &optional (rt *readtable*))
(test-attribute char +char-attr-whitespace+ rt))
(defmacro constituentp (char &optional (rt '*readtable*))
really-to-readtable))
(defun set-syntax-from-char (to-char from-char &optional
- (to-readtable *readtable*)
- (from-readtable ()))
+ (to-readtable *readtable*) (from-readtable ()))
#!+sb-doc
- "Causes the syntax of TO-CHAR to be the same as FROM-CHAR in the
- optional readtable (defaults to the current readtable). The
- FROM-TABLE defaults to the standard Lisp readtable when NIL."
+ "Causes the syntax of TO-CHAR to be the same as FROM-CHAR in the optional
+readtable (defaults to the current readtable). The FROM-TABLE defaults to the
+standard Lisp readtable when NIL."
(let ((really-from-readtable (or from-readtable *standard-readtable*)))
(let ((att (get-cat-entry from-char really-from-readtable))
(mac (get-raw-cmt-entry from-char really-from-readtable))
(loop
(let ((char (read-char stream eof-error-p *eof-object*)))
(cond ((eofp char) (return eof-value))
- ((whitespacep char))
+ ((whitespace[2]p char))
(t
(let* ((macrofun (get-coerced-cmt-entry char *readtable*))
(result (multiple-value-list
(unless (or (eql result eof-value) recursivep)
(let ((next-char (read-char stream nil nil)))
(unless (or (null next-char)
- (whitespacep next-char))
+ (whitespace[2]p next-char))
(unread-char next-char stream))))
result))
(%reader-error
stream
"Nothing appears before . in list.")))
- ((whitespacep nextchar)
+ ((whitespace[2]p nextchar)
(setq nextchar (flush-whitespace stream))))
(rplacd listtail
;; Return list containing last thing.
(return-from parse-integer (values nil end))
(parse-error "no non-whitespace characters in string ~S.")))
(declare (fixnum i))
- (unless (whitespacep (char string i)) (return i))))
+ (unless (whitespace[1]p (char string i)) (return i))))
(minusp nil)
(found-digit nil)
(result 0))
(setq result (+ weight (* result radix))
found-digit t))
(junk-allowed (return nil))
- ((whitespacep char)
+ ((whitespace[1]p char)
(loop
(incf index)
(when (= index end) (return))
- (unless (whitespacep (char string index))
+ (unless (whitespace[1]p (char string index))
(parse-error "junk in string ~S")))
(return nil))
(t