X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/4b8e5c0347115ff30841f1d1e71afe59ecb6c82c..a1985b3cf0ca42f573b8599ec50a0f162a26c314:/src/parser/scanner-proto.lisp diff --git a/src/parser/scanner-proto.lisp b/src/parser/scanner-proto.lisp index bd7e160..a1ded51 100644 --- a/src/parser/scanner-proto.lisp +++ b/src/parser/scanner-proto.lisp @@ -7,7 +7,7 @@ ;;;----- Licensing notice --------------------------------------------------- ;;; -;;; This file is part of the Sensble Object Design, an object system for C. +;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ (:documentation "Capture the SCANNER's current place and return it.") (:method (scanner) - (error "Scanner ~S doesn't support rewinding." scanner))) + (error "Scanner ~S doesn't support rewinding" scanner))) (export 'scanner-restore-place) (defgeneric scanner-restore-place (scanner place) @@ -99,9 +99,12 @@ if you wanted to circumvent the cleanup then you should have used `with-parser-place', which does all of this in the meta-level." (once-only (scanner) - `(let ((,place (scanner-capture-place ,scanner))) - (unwind-protect (progn ,@body) - (scanner-release-place ,scanner ,place))))) + (multiple-value-bind (docs decls body) (parse-body body :docp nil) + (declare (ignore docs)) + `(let ((,place (scanner-capture-place ,scanner))) + ,@decls + (unwind-protect (progn ,@body) + (when ,place (scanner-release-place ,scanner ,place))))))) ;;;-------------------------------------------------------------------------- ;;; Character scanner protocol.