mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 03:54:12 +02:00
Add R6RS `syntax-violation' to (rnrs syntax-case).
* module/rnrs/6/exceptions.scm: Remove dependency on (rnrs syntax-case); rewrite guard and guard0 in using syntax-rules in terms of syntax-case. * module/rnrs/6/syntax-case.scm: Add syntax-violation implementation.
This commit is contained in:
parent
2359a9a49e
commit
0c7398a7dc
2 changed files with 26 additions and 19 deletions
|
@ -22,7 +22,6 @@
|
|||
(import (rnrs base (6))
|
||||
(rnrs conditions (6))
|
||||
(rnrs records procedural (6))
|
||||
(rnrs syntax-case (6))
|
||||
(only (guile) with-throw-handler))
|
||||
|
||||
(define raise (@@ (rnrs records procedural) r6rs-raise))
|
||||
|
@ -51,22 +50,18 @@
|
|||
*unspecified*))))
|
||||
|
||||
(define-syntax guard0
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
((_ (variable cond-clause ...) body)
|
||||
(syntax (call/cc (lambda (continuation)
|
||||
(with-exception-handler
|
||||
(lambda (variable)
|
||||
(continuation (cond cond-clause ...)))
|
||||
(lambda () body)))))))))
|
||||
(syntax-rules ()
|
||||
((_ (variable cond-clause ...) body)
|
||||
(call/cc (lambda (continuation)
|
||||
(with-exception-handler
|
||||
(lambda (variable)
|
||||
(continuation (cond cond-clause ...)))
|
||||
(lambda () body)))))))
|
||||
|
||||
(define-syntax guard
|
||||
(lambda (stx)
|
||||
(syntax-case stx (else)
|
||||
((_ (variable cond-clause ... . ((else else-clause ...))) body)
|
||||
(syntax (guard0 (variable cond-clause ... (else else-clause ...))
|
||||
body)))
|
||||
((_ (variable cond-clause ...) body)
|
||||
(syntax (guard0 (variable cond-clause ... (else (raise variable)))
|
||||
body))))))
|
||||
(syntax-rules (else)
|
||||
((_ (variable cond-clause ... . ((else else-clause ...))) body)
|
||||
(guard0 (variable cond-clause ... (else else-clause ...)) body))
|
||||
((_ (variable cond-clause ...) body)
|
||||
(guard0 (variable cond-clause ... (else (raise variable))) body))))
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue