diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-13 18:03:00 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-03-13 18:03:00 +0100 |
commit | 77a40a1b44afddde7bdb15278a199584e8670b95 (patch) | |
tree | b899a102ba120e4504318d18ac1ff68a69d2c7d6 /Lisp | |
parent | 9bcf5f61465b954837dea6472c7bdd6972d81f8b (diff) |
Internal type declaration reader macro: Generate correct declarations.
darcs-hash:47ff07daa62d35ea3d9408b49ed8d059e31b9f6b
Diffstat (limited to 'Lisp')
-rw-r--r-- | Lisp/internal-reader-syntax.lisp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Lisp/internal-reader-syntax.lisp b/Lisp/internal-reader-syntax.lisp index e7bade8..b466163 100644 --- a/Lisp/internal-reader-syntax.lisp +++ b/Lisp/internal-reader-syntax.lisp @@ -35,11 +35,13 @@ (defun enable-type-declaration-syntax () (save-readtable) - (set-dispatch-macro-character #\# #\? #'read-type-declaration)) + (set-dispatch-macro-character #\# #\? #'read-type-declaration) + (values)) (defun disable-type-declaration-syntax () - (restore-readtable)) + (restore-readtable) + (values)) (defun read-type-declaration (stream subchar argument) @@ -77,15 +79,20 @@ (loop for x = (read in nil eof-value nil) until (eq x eof-value) collect x))) - (typedecl-parts (split-sequence:split-sequence '-> - typedecl - :test - #'eq - :count 2)) + (typedecl-parts + (split-sequence:split-sequence '-> + typedecl + :test #'(lambda (x y) + (and (symbolp x) + (symbolp y) + (string= + (symbol-name x) + (symbol-name y)))) + :count 2)) (function-name (cadr defun-form)) (arg-types (first typedecl-parts)) (return-types (second typedecl-parts))) `(progn - (declaim (ftype ,function-name - (function (,@arg-types) (values ,@return-types)))) + (declaim (ftype (function (,@arg-types) (values ,@return-types)) + ,function-name)) ,defun-form)))) |