summaryrefslogtreecommitdiff
path: root/Lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-12-04 21:17:37 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-12-04 21:17:37 +0100
commit31ad74e07ca4b77ffbfdc104b403efda61487e40 (patch)
treec00e222aff97b4b4936247af0fbe3280dd6f72f3 /Lisp
parent03fd82e89b41bbeafa900be8581a3eb8d78c2758 (diff)
Add function IN-METHOD-SYNTAX.
darcs-hash:d988f9cdc21410c6910aa52e0f396a2ebc7216fb
Diffstat (limited to 'Lisp')
-rw-r--r--Lisp/defpackage.lisp1
-rw-r--r--Lisp/reader-syntax.lisp15
2 files changed, 12 insertions, 4 deletions
diff --git a/Lisp/defpackage.lisp b/Lisp/defpackage.lisp
index 074e8ab..3c560e5 100644
--- a/Lisp/defpackage.lisp
+++ b/Lisp/defpackage.lisp
@@ -25,6 +25,7 @@
#:shutdown-runtime
#:install-reader-syntax
#:enable-method-syntax
+ #:in-method-syntax
#:enable-objective-c-syntax
#:disable-method-syntax
#:disable-objective-c-syntax
diff --git a/Lisp/reader-syntax.lisp b/Lisp/reader-syntax.lisp
index 18174d2..905807d 100644
--- a/Lisp/reader-syntax.lisp
+++ b/Lisp/reader-syntax.lisp
@@ -22,6 +22,16 @@
(defvar *bracket-syntax-macro-chars* (list))
+(defun in-method-syntax ()
+ ;; FIXME: Document.
+ (setq *readtable* (copy-readtable *readtable*))
+ (push (get-dispatch-macro-character #\# #\/) *method-syntax-macro-chars*)
+ (set-dispatch-macro-character #\# #\/ #'(lambda (stream char arg)
+ (declare (ignore char arg))
+ (read-objective-c-method stream)))
+ (values))
+
+
(defun enable-method-syntax ()
"Install a **reader macro** that makes method calls look nicer.
@@ -76,10 +86,7 @@ __selector__s registered by way of __collect-methods__.
__enable-objective-c-syntax__"
(save-readtable)
- (push (get-dispatch-macro-character #\# #\/) *method-syntax-macro-chars*)
- (set-dispatch-macro-character #\# #\/ #'(lambda (stream char arg)
- (declare (ignore char arg))
- (read-objective-c-method stream)))
+ (in-method-syntax)
(values))