diff options
author | Ludovic Courtes | 2006-09-03 16:56:42 +0000 |
---|---|---|
committer | Ludovic Courtes | 2006-09-03 16:56:42 +0000 |
commit | 7249dc962a9f31f1c8f3d72a3a55d2112514baff (patch) | |
tree | b2ececdc4eb8cb434174247f342bb1c9e013e642 /src/guile/skribilo/resolve.scm | |
parent | 8008a4d20f277910d5524e7704db32068010a0a5 (diff) | |
download | skribilo-7249dc962a9f31f1c8f3d72a3a55d2112514baff.tar.gz skribilo-7249dc962a9f31f1c8f3d72a3a55d2112514baff.tar.lz skribilo-7249dc962a9f31f1c8f3d72a3a55d2112514baff.zip |
Added error conditions in `ast.scm'.
* src/guile/skribilo/ast.scm: Use `srfi-3[45]' and `condition' but not
`lib'.
(&ast-error): New.
(&ast-orphan-error): New.
(&ast-cycle-error): New.
(&markup-unknown-option-error): New.
(&markup-already-bound-error): New.
(handle-ast-error): New.
(markup-option): Use `raise' instead of `skribe-(type-)?error'.
(markup-option-set!): Likewise.
(markup-option-add!): Likewise.
(markup-parent): Likewise.
(document-bind-node!): Likewise.
(find1-down): Likewise.
* src/guile/skribilo/resolve.scm (&resolution-error): Removed.
(&resolution-orphan-error): Removed. Moved as `&ast-orphan-error' in
`ast.scm'. Updated users.
git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-58
Diffstat (limited to 'src/guile/skribilo/resolve.scm')
-rw-r--r-- | src/guile/skribilo/resolve.scm | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/src/guile/skribilo/resolve.scm b/src/guile/skribilo/resolve.scm index c2e2c35..ba5af6a 100644 --- a/src/guile/skribilo/resolve.scm +++ b/src/guile/skribilo/resolve.scm @@ -33,48 +33,11 @@ :export (resolve! resolve-search-parent resolve-children resolve-children* find1 resolve-counter resolve-parent resolve-ident - *document-being-resolved* - - &resolution-error resolution-error? - &resolution-orphan-error resolution-orphan-error? - resolution-orphan-error:ast)) + *document-being-resolved*)) (fluid-set! current-reader %skribilo-module-reader) - -;;; -;;; Error conditions. -;;; - -(define-condition-type &resolution-error &skribilo-error - resolution-error?) - -(define-condition-type &resolution-orphan-error &resolution-error - resolution-orphan-error? - (ast resolution-orphan-error:ast)) - - -(define (handle-resolution-error c) - ;; Issue a user-friendly error message for error condition C. - (cond ((resolution-orphan-error? c) - (let* ((node (resolution-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)) - "")))) - - (else - (format (current-error-port) "undefined resolution error: ~a~%" - c)))) - -(register-error-condition-handler! resolution-error? - handle-resolution-error) - ;;; @@ -248,7 +211,7 @@ (cadr c) n))) ((eq? (slot-ref n 'parent) 'unspecified) - (raise (condition (&resolution-orphan-error (ast n))))) + (raise (condition (&ast-orphan-error (ast n))))) (else (slot-ref n 'parent))))) @@ -281,7 +244,7 @@ (let ((c (assq (symbol-append cnt '-counter) e))) (if (not (pair? c)) (if (or (null? opt) (not (car opt)) (null? e)) - (raise (condition (&resolution-orphan-error (ast n)))) + (raise (condition (&ast-orphan-error (ast n)))) (begin (set-cdr! (last-pair e) (list (list (symbol-append cnt '-counter) 0) |