Skip to content

dannypsnl/reporter

Repository files navigation

reporter

Racket

Reporter is inspired from codespan. The purpose of this project is to create a util toolbox for compiler error reporting.

Installation

raco pkg install --auto reporter

Usage

Example

Take a look at example.

Current API

#lang racket

(require reporter)

(displayln
 (report
   #:error-code "E0001"
   #:message "type mismatching"
   #:target srcloc?
   #:labels (list
              (label srcloc? "cannot assign a `string` to `int` variable"
                #:color 'red)
              (label srcloc? "`x` is a `int` variable"
                #:color 'blue))
   #:hint "expected type `int`, found type `string`"))

(displayln (warning #:message "shadow the variable"
                    #:target srcloc?
                    #:labels (list
                               (label srcloc? "previous definition" #:color 'green)
                               (label srcloc? "shadow definition" #:color 'blue))
                    #:hint "rename the shadow variable"))