X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fparse-defmacro.lisp;h=8ee93ec437159a403c90e24e1fad72d8ff615197;hb=bee53328c93be3433477821131ab805557476c8b;hp=eb9efae80fd18daf7b374b315a289888057185bf;hpb=a530bbe337109d898d5b4a001fc8f1afa3b5dc39;p=sbcl.git diff --git a/src/code/parse-defmacro.lisp b/src/code/parse-defmacro.lisp index eb9efae..8ee93ec 100644 --- a/src/code/parse-defmacro.lisp +++ b/src/code/parse-defmacro.lisp @@ -11,9 +11,6 @@ (in-package "SB!KERNEL") -(file-comment - "$Header$") - ;;; variables for accumulating the results of parsing a DEFMACRO. (Declarations ;;; in DEFMACRO are the reason this isn't as easy as it sounds.) (defvar *arg-tests* nil) ; tests that do argument counting at expansion time @@ -23,7 +20,7 @@ (defvar *user-lets* nil) ; LET bindings that the user has explicitly supplied (declaim (type list *user-lets*)) -;; the default default for unsupplied optional and keyword args +;; the default default for unsupplied &OPTIONAL and &KEY args (defvar *default-default* nil) ;;; temps that we introduce and might not reference @@ -154,14 +151,11 @@ minimum (1+ minimum) maximum (1+ maximum))) ((eq now-processing :optionals) - (when (> (length var) 3) - (cerror "Ignore extra noise." - "more than variable, initform, and suppliedp ~ - in &optional binding: ~S" - var)) - (push-optional-binding (car var) (cadr var) (caddr var) - `(not (null ,path)) `(car ,path) - name error-kind error-fun) + (destructuring-bind (varname &optional initform supplied-p) + var + (push-optional-binding varname initform supplied-p + `(not (null ,path)) `(car ,path) + name error-kind error-fun)) (setq path `(cdr ,path) maximum (1+ maximum))) ((eq now-processing :keywords) @@ -278,14 +272,15 @@ ((symbolp value-var) (push-let-binding value-var path nil supplied-var init-form)) (t - (error "Illegal optional variable name: ~S" value-var)))) + (error "illegal optional variable name: ~S" value-var)))) (defun defmacro-error (problem kind name) - (error "Illegal or ill-formed ~A argument in ~A~@[ ~S~]." + (error "illegal or ill-formed ~A argument in ~A~@[ ~S~]" problem kind name)) -;;; Determine whether KEY-LIST is a valid list of keyword/value pairs. Do not -;;; signal the error directly, 'cause we don't know how it should be signaled. +;;; Determine whether KEY-LIST is a valid list of keyword/value pairs. +;;; Do not signal the error directly, 'cause we don't know how it +;;; should be signaled. (defun verify-keywords (key-list valid-keys allow-other-keys) (do ((already-processed nil) (unknown-keyword nil) @@ -300,8 +295,6 @@ (return (values :dotted-list key-list))) ((null (cdr remaining)) (return (values :odd-length key-list))) - ((member (car remaining) already-processed) - (return (values :duplicate (car remaining)))) ((or (eq (car remaining) :allow-other-keys) (member (car remaining) valid-keys)) (push (car remaining) already-processed))