X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/7605e373dc975bf8e69f57d9e0ce99a2d9d774c7..7dca21e9e346a9793fa455e55111085e1174c44c:/src/module-parse.lisp diff --git a/src/module-parse.lisp b/src/module-parse.lisp index 014e7e3..2d81de1 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -140,14 +140,15 @@ (define-pluggable-parser module file (scanner pset) ;; `load' string `;' (declare (ignore pset)) (flet ((common (name type what thunk) - (find-file scanner - (merge-pathnames name - (make-pathname :type type - :case :common)) - what - thunk))) + (when name + (find-file scanner + (merge-pathnames name + (make-pathname :type type + :case :common)) + what + thunk)))) (with-parser-context (token-scanner-context :scanner scanner) - (parse (or (seq ("import" (name :string) #\;) + (parse (or (seq ("import" (name (must :string)) (nil (must #\;))) (common name "SOD" "module" (lambda (path true) (handler-case @@ -160,8 +161,12 @@ (define-pluggable-parser module file (scanner pset) *module*)))) (file-error (error) (cerror* "Error reading module ~S: ~A" + path error)) + (error (error) + (cerror* "Unexpected error reading ~ + module ~S: ~A" path error)))))) - (seq ("load" (name :string) #\;) + (seq ("load" (name (must :string)) (nil (must #\;))) (common name "LISP" "Lisp file" (lambda (path true) (handler-case @@ -206,7 +211,7 @@ (define-pluggable-parser module lisp (scanner pset) (scanner-step scanner) (values sexp t t)) (values '((:id "lisp")) nil nil))) - #\;) + (nil (must #\;))) (eval sexp))))) ;;;-------------------------------------------------------------------------- @@ -240,7 +245,7 @@ (define-pluggable-parser class-item initargs (scanner class pset) (car declarator) pset init scanner)) #\,)) - #\;))))) + (nil (must #\;))))))) (defun parse-class-body (scanner pset name supers) ;; class-body ::= `{' class-item* `}'