From 689c294e91a706248d2963b5cb8811ebf9d33d0e Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Sun, 13 Sep 2015 13:34:45 -0500 Subject: [PATCH] Remove dependency on unstable/error. --- .../syntax/parse/private/runtime-report.rkt | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/racket/collects/syntax/parse/private/runtime-report.rkt b/racket/collects/syntax/parse/private/runtime-report.rkt index 0cd3ad2f0a..e129526ec4 100644 --- a/racket/collects/syntax/parse/private/runtime-report.rkt +++ b/racket/collects/syntax/parse/private/runtime-report.rkt @@ -3,7 +3,6 @@ racket/format syntax/stx racket/struct - unstable/error syntax/srcloc "minimatch.rkt" syntax/parse/private/residual @@ -175,6 +174,11 @@ complicated. (define (error/reports ctx reports) (error/report ctx (car reports) (pair? (cdr reports)))) +(define (format-if prefix val) + (if val + (format "\n ~a: ~a" prefix val) + "")) + (define (error/report ctx report more?) (let* ([message (report-message report)] [context (report-context report)] @@ -183,13 +187,18 @@ complicated. [sub-stx (report-stx report)] [within-stx (report-within-stx report)] [message - (compose-error-message - who message - '("at" maybe) (stx-if-loc sub-stx) - '("within" maybe) (stx-if-loc within-stx) - '("in" maybe) (stx-if-loc stx) - '("parsing context" multi maybe) context - '("note" maybe) (and more? "additional errors omitted"))] + (format "~a: ~a~a~a~a~a~a" + who message + (format-if "at" (stx-if-loc sub-stx)) + (format-if "within" (stx-if-loc within-stx)) + (format-if "in" (stx-if-loc stx)) + (if (null? context) + "" + (apply string-append + "\n parsing context: " + (for/list ([c (in-list context)]) + (format "\n ~a" c)))) + (format-if "note" (and more? "additional errors omitted")))] [message (if (error-print-source-location) (let ([source-stx (or stx sub-stx within-stx)])