diff --git a/collects/redex/private/reduction-semantics.rkt b/collects/redex/private/reduction-semantics.rkt index 61156a3284..aa36b04a94 100644 --- a/collects/redex/private/reduction-semantics.rkt +++ b/collects/redex/private/reduction-semantics.rkt @@ -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)])])) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 96578b757b..d1e7ce1605 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -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) diff --git a/collects/redex/tests/tl-test.rkt b/collects/redex/tests/tl-test.rkt index 88c85818c7..68fbd204c7 100644 --- a/collects/redex/tests/tl-test.rkt +++ b/collects/redex/tests/tl-test.rkt @@ -929,7 +929,10 @@ 'failed) 'passed)) - + (test-syn-err + (define-relation grammar R) + #rx"expected the name of the relation") + ; ;; ; ;; ; ; ; ; ; ; ; ;; ;; ;;; ;; ; ;; ;; ;;;; ;;;;; ;;; ;;; ;; ;; ;; ;; ;;; ; ;;; ;;;;; ;;; ;;; ;; ;;