reporter
Report
report
label
collect-report
current-report-collection
color
color:  red
color:  blue
8.2

reporter

racket.tw <racket@racket.tw>

 (require reporter) package: reporter

struct

(struct Report ())

The report structure, all fields were private to avoid any hack based on this. report constructs this structure, directly print it would get report to stdout.

procedure

(report #:target target    
  #:message msg    
  #:labels label*    
  [#:error-code err-code    
  #:hint hint])  Report?
  target : srcloc?
  msg : string?
  label* : (listof Label)
  err-code : string? = #f
  hint : string? = #f
constructor of Report.

Usage:
(report #:target loc
        #:message "type mismatched"
        #:labels (list (label expect-type-loc (format "expected ~a" expect-type) #:color (color:blue))
                       (label actual-expr-loc (format "actual ~a" actual-type) #:color (color:red)))
        #:error-code "E0001")

Recommend using (raise Report?) and catch it in any place you want to collect them.

procedure

(label target msg [#:color color])  Label?

  target : srcloc?
  msg : string?
  color : color? = #f
target points out where the hint are going to, msg is the hint message, color is the color of hint message.

syntax

(collect-report body ...)

This form works like most normal block like when, with its wrapping one can collect a raised Report, find a suitable level put it can help one report more error at once.

parameter

(current-report-collection)  (listof Report)

(current-report-collection reports)  void?
  reports : (listof Report)
This parameter stands for collecting report from collect-report, using it can get all reports current collected, with this one can simply print out all reports or do more operations on it.

struct

(struct color ())

It could be color:red or color:blue

struct

(struct color:red ())

struct

(struct color:blue ())