improved error message in the case where ->i is used as an identifier

This commit is contained in:
Robby Findler 2010-08-10 16:00:51 -05:00
parent d15fc5c102
commit 5fb1c730ba

View File

@ -49,19 +49,21 @@ code does the parsing and validation of the syntax.
(struct pre/post (vars exp)) (struct pre/post (vars exp))
(define (parse-->i stx) (define (parse-->i stx)
(let-values ([(raw-mandatory-doms raw-optional-doms (if (identifier? stx)
id/rest-id pre-cond range post-cond) (raise-syntax-error #f "expected ->i to follow an open parenthesis" stx)
(pull-out-pieces stx)]) (let-values ([(raw-mandatory-doms raw-optional-doms
(let ([candidate id/rest-id pre-cond range post-cond)
(istx (append (parse-doms stx #f raw-mandatory-doms) (pull-out-pieces stx)])
(parse-doms stx #t raw-optional-doms)) (let ([candidate
id/rest-id (istx (append (parse-doms stx #f raw-mandatory-doms)
pre-cond (parse-doms stx #t raw-optional-doms))
(parse-range stx range) id/rest-id
post-cond)]) pre-cond
(ensure-wf-names stx candidate) (parse-range stx range)
(ensure-no-cycles stx candidate) post-cond)])
candidate))) (ensure-wf-names stx candidate)
(ensure-no-cycles stx candidate)
candidate))))
(define (ensure-wf-names stx istx) (define (ensure-wf-names stx istx)
(let ([km (make-hash)] (let ([km (make-hash)]