reporter
Report
report
Label
label
collect-report
current-report-collection
Color
8.12

reporter🔗ℹ

Lîm Tsú-thuàn <dannypsnl@gmail.com>

 (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 'blue)
                       (label actual-expr-loc (format "actual ~a" actual-type) #:color 'red))
        #:error-code "E0001")

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

struct

(struct Label ())

The label structure, all fields were private to avoid any hack just like Report. label constructs this structure.

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.

syntax

Color

This is a define-type generated thing, basically are an union of symbols.