X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/8db2259b25024c83cda8a1d0869b282d115983d7..abbdf025d78ec4c39146b46a3a067d0534165abf:/src/frontend.lisp diff --git a/src/frontend.lisp b/src/frontend.lisp index 7648e2d..d3d9d9d 100644 --- a/src/frontend.lisp +++ b/src/frontend.lisp @@ -24,7 +24,7 @@ ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (cl:defpackage #:sod-frontend - (:use #:common-lisp #:optparse #:sod #:sod-parser) + (:use #:common-lisp #:sod-utilities #:optparse #:sod #:sod-parser) (:shadowing-import-from #:optparse #:int)) (cl:in-package #:sod-frontend) @@ -38,6 +38,9 @@ (exercise) ;;;-------------------------------------------------------------------------- ;;; The main program. +(defvar-unbound *option-parser* + "The program's main option parser.") + (eval-when (:compile-toplevel :load-toplevel :execute) (defopthandler dirpath (var arg) () "Convert the argument into a pathname with a directory component @@ -113,12 +116,13 @@ (define-program (list output-reasons 'keyword)))) ;; Actually parse the options. - (unless (and (option-parse-try - (do-options () - (nil (rest) - (setf args rest)))) - (or builtinsp args)) - (die-usage)) + (let ((*option-parser* (make-option-parser))) + (unless (and (option-parse-try + (do-options (:parser *option-parser*) + (nil (rest) + (setf args rest)))) + (or builtinsp args)) + (die-usage))) ;; Do the main parsing job. (labels ((hack-module (module)