X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fsharpm.lisp;h=6615bb92b7e572284d495715a36f9bdeb6b70ec1;hb=01044af1b8d69fc3899dc0417064c1512223223d;hp=f0a11683135a80a2f59e1f305a31aacf3bb513f2;hpb=8eb6f7d3da3960c827b704e23b5a47008274be7d;p=sbcl.git diff --git a/src/code/sharpm.lisp b/src/code/sharpm.lisp index f0a1168..6615bb9 100644 --- a/src/code/sharpm.lisp +++ b/src/code/sharpm.lisp @@ -14,7 +14,7 @@ ;;; FIXME: Is it standard to ignore numeric args instead of raising errors? (defun ignore-numarg (sub-char numarg) (when numarg - (warn "A numeric argument was ignored in #~D~A." numarg sub-char))) + (warn "A numeric argument was ignored in #~W~A." numarg sub-char))) ;;;; reading arrays and vectors: the #(, #*, and #A readmacros @@ -92,16 +92,17 @@ (make-array (dims) :initial-contents contents)) (unless (typep seq 'sequence) (%reader-error stream - "#~DA axis ~D is not a sequence:~% ~S" + "#~WA axis ~W is not a sequence:~% ~S" dimensions axis seq)) (let ((len (length seq))) (dims len) - (unless (= axis (1- dimensions)) - (when (zerop len) - (%reader-error stream - "#~DA axis ~D is empty, but is not ~ - the last dimension." - dimensions axis)) + (unless (or (= axis (1- dimensions)) + ;; ANSI: "If some dimension of the array whose + ;; representation is being parsed is found to be + ;; 0, all dimensions to the right (i.e., the + ;; higher numbered dimensions) are also + ;; considered to be 0." + (= len 0)) (setq seq (elt seq 0)))))))) ;;;; reading structure instances: the #S readmacro @@ -118,13 +119,13 @@ (%reader-error stream "non-list following #S: ~S" body)) (unless (symbolp (car body)) (%reader-error stream "Structure type is not a symbol: ~S" (car body))) - (let ((class (sb!xc:find-class (car body) nil))) - (unless (typep class 'sb!xc:structure-class) + (let ((classoid (find-classoid (car body) nil))) + (unless (typep classoid 'structure-classoid) (%reader-error stream "~S is not a defined structure type." (car body))) (let ((def-con (dd-default-constructor (layout-info - (class-layout class))))) + (classoid-layout classoid))))) (unless def-con (%reader-error stream "The ~S structure does not have a default constructor." @@ -157,13 +158,13 @@ ((not radix) (%reader-error stream "radix missing in #R")) ((not (<= 2 radix 36)) - (%reader-error stream "illegal radix for #R: ~D" radix)) + (%reader-error stream "illegal radix for #R: ~D." radix)) (t (let ((res (let ((*read-base* radix)) (read stream t nil t)))) (unless (typep res 'rational) (%reader-error stream - "#~A (base ~D) value is not a rational: ~S." + "#~A (base ~D.) value is not a rational: ~S." sub-char radix res)) @@ -183,12 +184,12 @@ ;; substitutes in arrays and structures as well as lists. The first arg is an ;; alist of the things to be replaced assoc'd with the things to replace them. (defun circle-subst (old-new-alist tree) - (cond ((not (typep tree '(or cons (array t) structure-object))) + (cond ((not (typep tree '(or cons (array t) structure-object standard-object))) (let ((entry (find tree old-new-alist :key #'second))) (if entry (third entry) tree))) ((null (gethash tree *sharp-equal-circle-table*)) (setf (gethash tree *sharp-equal-circle-table*) t) - (cond ((typep tree 'structure-object) + (cond ((typep tree '(or structure-object standard-object)) (do ((i 1 (1+ i)) (end (%instance-length tree))) ((= i end)) @@ -408,9 +409,9 @@ (set-dispatch-macro-character #\# #\| #'sharp-vertical-bar) (set-dispatch-macro-character #\# #\p #'sharp-p) (set-dispatch-macro-character #\# #\P #'sharp-p) - (set-dispatch-macro-character #\# #\ #'sharp-illegal) (set-dispatch-macro-character #\# #\) #'sharp-illegal) (set-dispatch-macro-character #\# #\< #'sharp-illegal) - ;; FIXME: Should linefeed/newline go in this list too? - (dolist (cc '#.(list tab-char-code form-feed-char-code return-char-code)) + (set-dispatch-macro-character #\# #\Space #'sharp-illegal) + (dolist (cc '#.(list tab-char-code form-feed-char-code return-char-code + line-feed-char-code backspace-char-code)) (set-dispatch-macro-character #\# (code-char cc) #'sharp-illegal)))