diff options
author | Ludovic Court`es | 2007-08-28 14:40:42 +0000 |
---|---|---|
committer | Ludovic Court`es | 2007-08-28 14:40:42 +0000 |
commit | 40ecaa4ffb5e6e95910783caf06ae75d81359641 (patch) | |
tree | 2b8ec11fd23ede2053e3b622857b2fc0648c0543 | |
parent | 85fc6c18201084839339584ad458f6c4ce1a1ffb (diff) | |
parent | f0c79b60862138deb10286e8fe3edece3755dcdf (diff) | |
download | skribilo-40ecaa4ffb5e6e95910783caf06ae75d81359641.tar.gz skribilo-40ecaa4ffb5e6e95910783caf06ae75d81359641.tar.lz skribilo-40ecaa4ffb5e6e95910783caf06ae75d81359641.zip |
ast: Provide better error messages.
* src/guile/skribilo/ast.scm (handle-ast-error)[show-location]: Use it
in all cases. Internationalized error messages.
git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-153
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | src/guile/skribilo/ast.scm | 33 |
2 files changed, 37 insertions, 13 deletions
@@ -2,6 +2,23 @@ # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2 # +2007-08-28 14:40:42 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-153 + + Summary: + ast: Provide better error messages. + Revision: + skribilo--devo--1.2--patch-153 + + * src/guile/skribilo/ast.scm (handle-ast-error)[show-location]: Use it + in all cases. Internationalized error messages. + + modified files: + ChangeLog src/guile/skribilo/ast.scm + + new patches: + lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-95 + + 2007-08-28 14:40:03 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-152 Summary: diff --git a/src/guile/skribilo/ast.scm b/src/guile/skribilo/ast.scm index 3ed33c9..746cbbf 100644 --- a/src/guile/skribilo/ast.scm +++ b/src/guile/skribilo/ast.scm @@ -123,41 +123,48 @@ (define (handle-ast-error c) ;; Issue a user-friendly error message for error condition C. + (define (show-location obj) + (let ((location (and (ast? obj) (ast-loc obj)))) + (if (location? location) + (format (current-error-port) "~a:~a:~a: " + (location-file location) + (location-line location) + (location-column location))))) + (cond ((ast-orphan-error? c) - (let* ((node (ast-orphan-error:ast c)) - (location (and (ast? node) (ast-loc node)))) - (format (current-error-port) "orphan node: ~a~a~%" - node - (if (location? location) - (string-append " " - (location-file location) ":" - (location-line location)) - "")))) + (let ((node (ast-orphan-error:ast c))) + (show-location node) + (format (current-error-port) (_ "orphan node: ~a~%") + node))) ((ast-cycle-error? c) (let ((object (ast-cycle-error:object c))) + (show-location object) (format (current-error-port) - "cycle found in AST: ~a~%" object))) + (_ "cycle found in AST: ~a~%") object))) ((markup-unknown-option-error? c) (let ((markup (markup-unknown-option-error:markup c)) (option (markup-unknown-option-error:option c))) + (show-location markup) (format (current-error-port) - "~a: unknown markup option for `~a'~%" + (_ "~a: unknown markup option for `~a'~%") option markup))) ((markup-already-bound-error? c) (let ((markup (markup-already-bound-error:markup c)) (ident (markup-already-bound-error:ident c))) + (show-location markup) (format (current-error-port) - "`~a' (~a): markup identifier already bound~%" + (_ "`~a' (~a): markup identifier already bound~%") ident (if (markup? markup) (markup-markup markup) markup)))) (else - (format (current-error-port) "undefined resolution error: ~a~%" + (format (current-error-port) + (_ "undefined AST error: ~a~%") c)))) (register-error-condition-handler! ast-error? handle-ast-error) |