X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/1d8cc67a3f4ded443f5efc673a616883cbae9c50..ca0c10c49568d1d340296ae9e613f32a6a31bfc9:/src/parser/parser-proto.lisp diff --git a/src/parser/parser-proto.lisp b/src/parser/parser-proto.lisp index d458e70..4c04208 100644 --- a/src/parser/parser-proto.lisp +++ b/src/parser/parser-proto.lisp @@ -77,6 +77,7 @@ (cl:in-package #:sod-parser) ;;;-------------------------------------------------------------------------- ;;; Utilities. +(export 'combine-parser-failures) (defun combine-parser-failures (failures) "Combine the failure indicators listed in FAILURES. @@ -151,10 +152,9 @@ (defmacro defparse (name bvl &body body) ((,context ,ctxclass) (,head (eql ',name)) ,tail) ,@doc (declare (ignorable ,context)) - (block ,name - (destructuring-bind ,bvl ,tail - ,@decls - ,@body))))))) + (destructuring-bind ,bvl ,tail + ,@decls + (block ,name ,@body))))))) (export '(with-parser-context parse)) (defmacro with-parser-context ((class &rest initargs) &body body) @@ -572,7 +572,11 @@ (defmacro define-pluggable-parser (symbol tag (&rest bvl) &body body) If a parser with the given TAG is already attached to SYMBOL then the new parser replaces the old one; otherwise it is added to the collection." - `(pluggable-parser-add ',symbol ',tag (lambda ,bvl ,@body))) + (multiple-value-bind (docs decls body) (parse-body body) + `(pluggable-parser-add ',symbol ',tag + (lambda ,bvl + ,@docs ,@decls + (block ,symbol ,@body))))) ;;;-------------------------------------------------------------------------- ;;; Rewindable parser context protocol.