From e783e65bc434b69ad73684c035aac345878ba6e9 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/module-parse.lisp (read-module): Use requested pathname for location. Organization: Straylight/Edgeware From: Mark Wooding The default behaviour for `charbuf-scanner' is to use the pathname from its underlying stream; but (at least on some implementations) this is an absolute pathname which is actually rather annoying in error messages. Instead, arrange for `read-module' to attach the namestring of the pathname it was given directly to the scanner. This will be the correct possibly-relative pathname to the module file, because `find-file' has already done that part of the work, but it will be relative if that's how it was specified on the command line, if it was found by merging with a relative pathname in the `*module-dirs*' list, or if it was imported by a name relative to a module with a relative pathname. --- src/module-parse.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/module-parse.lisp b/src/module-parse.lisp index 211f2c7..f90f360 100644 --- a/src/module-parse.lisp +++ b/src/module-parse.lisp @@ -103,7 +103,8 @@ (define-module (pathname :location location :truename truename) (let* ((*readtable* (copy-readtable)) (*package* (find-package '#:sod-user)) (char-scanner (make-instance 'charbuf-scanner - :stream f-stream)) + :stream f-stream + :filename (namestring pathname))) (scanner (make-instance 'sod-token-scanner :char-scanner char-scanner))) (with-default-error-location (scanner) -- [mdw]