aboutsummaryrefslogtreecommitdiff
path: root/src/guile/skribilo/lib.scm
diff options
context:
space:
mode:
authorLudovic Courtes2005-07-02 12:40:07 +0000
committerLudovic Courtes2005-07-02 12:40:07 +0000
commitce811ece0affa2b20531f4191538dc5b5bafc510 (patch)
treebcf863e2c8e5fcdc9b6f28d2c7ebf1feff720ffb /src/guile/skribilo/lib.scm
parent6269aa26309cf98d100d7580c09ccf63b504d0d8 (diff)
downloadskribilo-ce811ece0affa2b20531f4191538dc5b5bafc510.tar.gz
skribilo-ce811ece0affa2b20531f4191538dc5b5bafc510.tar.lz
skribilo-ce811ece0affa2b20531f4191538dc5b5bafc510.zip
Minor fixes for file/line error reporting.
* src/guile/skribilo/lib.scm (skribe-line-error): Removed. (skribe-ast-error): Fixed. Use `location-line' instead of `location-pos'. (skribe-error): Fixed. (%skribe-warn): Use the file and line number of CURRENT-INPUT-PORT by default. * src/guile/skribilo/types.scm: Export `location-file', `location-line' and `location-pos'. (initialize): New method for `<ast>' objects, initialize slot `loc' with information from CURRENT-INPUT-PORT. (ast-location): Fixed. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-5
Diffstat (limited to 'src/guile/skribilo/lib.scm')
-rw-r--r--src/guile/skribilo/lib.scm22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm
index aaf1a8f..8667f7e 100644
--- a/src/guile/skribilo/lib.scm
+++ b/src/guile/skribilo/lib.scm
@@ -28,7 +28,7 @@
(define-module (skribilo lib)
:export (skribe-eval-location skribe-ast-error skribe-error
- skribe-type-error skribe-line-error
+ skribe-type-error
skribe-warning skribe-warning/ast
skribe-message
@@ -167,13 +167,14 @@
(let ((l (ast-loc obj))
(shape (if (markup? obj) (markup-markup obj) obj)))
(if (location? l)
- (error "~a:~a: ~a: ~a ~s" (location-file l) (location-pos l) proc msg shape)
- (error "~a: ~a ~s " proc msg shape))))
+ (error (format #f "~a:~a: ~a: ~a ~s" (location-file l)
+ (location-line l) proc msg shape))
+ (error (format #f "~a: ~a ~s " proc msg shape)))))
(define (skribe-error proc msg obj)
(if (ast? obj)
(skribe-ast-error proc msg obj)
- (error proc msg obj)))
+ (error (format #f "~a: ~a ~s" proc msg obj))))
;;;
@@ -183,17 +184,16 @@
(skribe-error proc (format "~a ~s (~a expected)" msg obj etype) #f))
-
-;;; FIXME: Peut-être virée maintenant
-(define (skribe-line-error file line proc msg obj)
- (error (format "%a:%a: ~a:~a ~S" file line proc msg obj)))
-
-
;;;
;;; SKRIBE-WARNING & SKRIBE-WARNING/AST
;;;
(define (%skribe-warn level file line lst)
(let ((port (current-error-port)))
+ (if (or (not file) (not line))
+ (begin
+ ;; XXX: This is a bit hackish, but it proves to be quite useful.
+ (set! file (port-filename (current-input-port)))
+ (set! line (port-line (current-input-port)))))
(when (and file line)
(format port "~a:~a: " file line))
(format port "warning: ")
@@ -210,7 +210,7 @@
(if (>= *skribe-warning* level)
(let ((l (ast-loc ast)))
(if (location? l)
- (%skribe-warn level (location-file l) (location-pos l) obj)
+ (%skribe-warn level (location-file l) (location-line l) obj)
(%skribe-warn level #f #f obj)))))
;;;