From: Christophe Rhodes Date: Fri, 18 Jul 2003 16:14:54 +0000 (+0000) Subject: 0.8.1.45: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=38f18f2eb2a1d66d2c138a2f5e10e6be93aacb1b;p=sbcl.git 0.8.1.45: Merge patch from Nikodemus Siivola for nicer error reporting on READER-ERRORs ... frob it a bit to reduce the number of erring possibilities --- diff --git a/src/code/condition.lisp b/src/code/condition.lisp index b082c57..01421bb 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -677,11 +677,28 @@ :initform '())) (:report (lambda (condition stream) - (let ((error-stream (stream-error-stream condition))) - (format stream "READER-ERROR ~@[at ~W ~]on ~S:~%~?" - (file-position error-stream) error-stream - (reader-error-format-control condition) - (reader-error-format-arguments condition)))))) + (let* ((error-stream (stream-error-stream condition)) + (pos (file-position error-stream))) + (let (lineno colno) + (when (and pos + (< pos sb!xc:array-dimension-limit) + (file-position error-stream :start)) + (let ((string + (make-string pos + :element-type (stream-element-type error-stream)))) + (when (= pos (read-sequence string error-stream)) + (setq lineno (1+ (count #\Newline string)) + colno (- pos + (or (position #\Newline string :from-end t) 0) + 1)))) + (file-position error-stream pos)) + (format stream + "READER-ERROR ~@[at ~W ~]~ + ~@[(line ~W~]~@[, column ~W) ~]~ + on ~S:~%~?" + pos lineno colno error-stream + (reader-error-format-control condition) + (reader-error-format-arguments condition))))))) ;;;; various other (not specified by ANSI) CONDITIONs ;;;; diff --git a/version.lisp-expr b/version.lisp-expr index d97fdf9..40c8a8b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.1.44" +"0.8.1.45"