** --arch option can be used to specify the architecture to build for.
(Mainly useful for building 32-bit SBCL's on x86-64 hosts, not
full-blows cross-compilation.)
+ * enhancement: extended package prefix syntax <pkgname>::<form-in-package>
+ which allows specifying the name of the package for a whole form.
* enhancement: when *READ-EVAL* is true, arrays with element type other than
T can be printed readably using #.-based syntax. (Thanks to Robert Brown)
* enhancement: MAKE-ALIEN signals a storage-condition instead of returning a
it still has quite a few. @xref{Contributed Modules}.
@menu
+* Reader Extensions::
* Garbage Collection::
* Metaobject Protocol::
* Support For Unix::
* Efficiency Hacks::
@end menu
+@node Reader Extensions
+@comment node-name, next, previous, up
+@section Reader Extensions
+@cindex Reader Extensions
+
+SBCL supports extended package prefix syntax, which allows specifying
+the package to read an arbitrary form in:
+
+@lisp
+<package-name>::<form-in-package>
+@end lisp
+
+Example:
+
+@lisp
+ 'foo::(bar quux zot) == '(foo::bar foo::quux foo::zot)
+@end lisp
+
@node Garbage Collection
@comment node-name, next, previous, up
@section Garbage Collection
(defun read-token (stream firstchar)
#!+sb-doc
- "This function is just an fsm that recognizes numbers and symbols."
+ "Default readmacro function. Handles numbers, symbols, and SBCL's
+extended <package-name>::<form-in-package> syntax."
;; Check explicitly whether FIRSTCHAR has an entry for
;; NON-TERMINATING in CHARACTER-ATTRIBUTE-TABLE and
;; READ-DOT-NUMBER-SYMBOL in CMT. Report an error if these are
(case (char-class char attribute-array attribute-hash-table)
(#.+char-attr-delimiter+
(unread-char char stream)
- (simple-reader-error stream
- "illegal terminating character after a colon: ~S"
- char))
+ (if package-designator
+ (let ((*package* (%find-package-or-lose package-designator)))
+ (return (read stream t nil t)))
+ (simple-reader-error stream
+ "illegal terminating character after a double-colon: ~S"
+ char)))
(#.+char-attr-single-escape+ (go SINGLE-ESCAPE))
(#.+char-attr-multiple-escape+ (go MULT-ESCAPE))
(#.+char-attr-package-delimiter+
RETURN-SYMBOL
(casify-read-buffer escapes)
(let ((found (if package-designator
- (find-package package-designator)
+ (%find-package-or-lose package-designator)
(sane-package))))
- (unless found
- (error 'simple-reader-package-error :stream stream
- :format-arguments (list package-designator)
- :format-control "package ~S not found"))
-
(if (or (zerop colons) (= colons 2) (eq found *keyword-package*))
(return (intern* *read-buffer* *ouch-ptr* found))
(multiple-value-bind (symbol test)
(reader-error ()
:error)))))
-(with-test (:name set-syntax-from-char-dispatch-macro-char)
+(with-test (:name :set-syntax-from-char-dispatch-macro-char)
(let ((rt (copy-readtable)))
(make-dispatch-macro-character #\! nil rt)
(set-dispatch-macro-character #\! #\! (constantly 'bang^2) rt)
(assert (eq 'bang^2 (maybe-bang)))
(set-syntax-from-char #\! #\! rt)
(assert (eq '!! (maybe-bang))))))
+
+(with-test (:name :read-in-package-syntax)
+ (assert (equal '(sb-c::a (sb-kernel::x sb-kernel::y) sb-c::b)
+ (read-from-string "sb-c::(a sb-kernel::(x y) b)"))))