* fixed bug 343: SB-KERNEL:INSTANCE-LAMBDA is no longer necessary
for funcallable-instance functions, and is no different from
regular LAMBDA.
+ * bug fix: PARSE-INTEGER no longer depends on the whitespaceness of
+ characters in the current readtable. (reported by Nicholas Neuss)
* optimizations: REMOVE-DUPLICATES now runs in linear time on
lists in some cases. This partially fixes bug 384.
* flush all standard streams before prompting in the REPL and the
eof-error-p
stream t)))
((or (eq char stream)
- (not (sb-impl::whitespacep char)))
+ (not (sb-impl::whitespace[2]p char)))
(unless (eq char stream)
(funcall-stm-handler j-unread-char encap t))
(if (eq char stream) eof-value char))))
((eq peek-type t)
(do ((char (sb-gray:stream-read-char stream)
(sb-gray:stream-read-char stream)))
- ((or (eq char :eof) (not (sb-impl::whitespacep char)))
+ ((or (eq char :eof) (not (sb-impl::whitespace[2]p char)))
(cond ((eq char :eof)
(sb-impl::eof-or-lose stream eof-error-p eof-value))
(t
;;; 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*))
(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
(do ((char (read-char-no-hang stream nil nil nil)
(read-char-no-hang stream nil nil nil)))
((null char) nil)
- (cond ((not (whitespacep char))
+ (cond ((not (whitespace[1]p char))
(unread-char char stream)
(return t)))))
\f
((eql ,peek-type t)
(do ((,char-var ,char-var ,read-form))
((or (eql ,char-var ,read-eof)
- (not (whitespacep ,char-var)))
+ (not (whitespace[2]p ,char-var)))
(cond ((eql ,char-var ,read-eof)
,(if eof-detected-form
eof-detected-form
(assert (equal '((0 . "A") (1 . "B"))
(coerce (read-from-string "#((0 . \"A\") (1 . \"B\"))")
'list)))
+
+;;; parse-integer uses whitespace[1] not whitespace[2] as its
+;;; definition of whitespace to skip.
+(let ((*readtable* (copy-readtable)))
+ (set-syntax-from-char #\7 #\Space)
+ (assert (= 710 (parse-integer "710"))))
+
+(let ((*readtable* (copy-readtable)))
+ (set-syntax-from-char #\7 #\Space)
+ (assert (string= (format nil "~7D" 1) " 1")))
(with-standard-io-syntax
(open "/dev/null"))
+
+;;; PEEK-CHAR T uses whitespace[2]
+(let ((*readtable* (copy-readtable)))
+ (assert (char= (peek-char t (make-string-input-stream " a")) #\a))
+ (set-syntax-from-char #\Space #\a)
+ (assert (char= (peek-char t (make-string-input-stream " a")) #\Space)))
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.3.35"
+"0.9.3.36"