Improves the error reporting and documentation for `define-relation'
This commit is contained in:
parent
9a485064ed
commit
743ccafd15
|
@ -1462,7 +1462,7 @@
|
|||
(when (null? (cdr more))
|
||||
(raise-syntax-error syn-error-name
|
||||
(format "expected a pattern to follow ~a" (syntax-e (car more)))
|
||||
stx))
|
||||
stx (car more)))
|
||||
(loop (cddr more)
|
||||
(cons (cadr more) arg-pats))]
|
||||
[else
|
||||
|
@ -1490,7 +1490,8 @@
|
|||
[_
|
||||
(raise-syntax-error
|
||||
syn-error-name
|
||||
"expected the name of the meta-function, followed by its contract (or no name and no contract)"
|
||||
(format "expected the name of the ~a, followed by its contract (or no name and no contract)"
|
||||
(if relation? "relation" "meta-function"))
|
||||
stx
|
||||
rest)])]))
|
||||
|
||||
|
|
|
@ -1042,6 +1042,7 @@ and @racket[#f] otherwise.
|
|||
|
||||
@defform/subs[#:literals ()
|
||||
(define-relation language
|
||||
relation-contract
|
||||
[(name @#,ttpattern ...) @#,tttterm ...] ...)
|
||||
([relation-contract (code:line)
|
||||
(code:line id ⊂ pat x ... x pat)
|
||||
|
|
|
@ -929,7 +929,10 @@
|
|||
'failed)
|
||||
'passed))
|
||||
|
||||
|
||||
(test-syn-err
|
||||
(define-relation grammar R)
|
||||
#rx"expected the name of the relation")
|
||||
|
||||
; ;; ; ;; ;
|
||||
; ; ; ; ;
|
||||
; ;; ;; ;;; ;; ; ;; ;; ;;;; ;;;;; ;;; ;;; ;; ;; ;; ;; ;;; ; ;;; ;;;;; ;;; ;;; ;; ;;
|
||||
|
|
Loading…
Reference in New Issue
Block a user