added a special case to the ->i error messages for when #:pre only has two things following

This commit is contained in:
Robby Findler 2011-01-06 19:29:02 -06:00
parent 9a0d7b419b
commit 582c8362a6

View File

@ -360,10 +360,17 @@ code does the parsing and validation of the syntax.
[_ (values #f leftover)])]
[(pre-cond leftover)
(syntax-case leftover ()
[(#:pre (id ...) pre-cond . leftover)
[(#:pre (id ...) pre-cond . pre-leftover)
(begin
(syntax-case #'pre-leftover ()
[() (raise-syntax-error
#f
"expected #:pre to be followed by at least three subterms (a sequence of identifiers, the pre-condition and the range contract), but found only two"
stx
(car (syntax->list leftover)))]
[x (void)])
(for-each (λ (x) (check-id stx x)) (syntax->list #'(id ...)))
(values (pre/post (syntax->list #'(id ...)) #'pre-cond) #'leftover))]
(values (pre/post (syntax->list #'(id ...)) #'pre-cond) #'pre-leftover))]
[_ (values #f leftover)])]
[(range leftover)
(syntax-case leftover ()