From 77a40a1b44afddde7bdb15278a199584e8670b95 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Thu, 13 Mar 2008 18:03:00 +0100 Subject: Internal type declaration reader macro: Generate correct declarations. darcs-hash:47ff07daa62d35ea3d9408b49ed8d059e31b9f6b --- Lisp/internal-reader-syntax.lisp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Lisp') 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)))) -- cgit v1.2.3