package grace

  1. Overview
  2. Docs
A fancy diagnostics library that allows your compilers to exit with grace

Install

dune-project
 Dependency

Authors

Maintainers

Sources

grace-0.3.0.tbz
sha256=6948979d6ffb5e596773baead81e9ceef36726d6956261bdd62abb2666a45bfc
sha512=db8b39cc9a77d919ab3123bb4047bb6c672c61db9fc6810951e267b2b113c4ac07266ef57188c6db0c02cb4d43d054204cd66ebc91648dbd1da1228022b0e67b

doc/grace/Grace/Diagnostic/index.html

Module Grace.DiagnosticSource

Diagnostic types and constructors.

Sourcetype ('a, 'b) format = ('a, Grace_std.Format.formatter, unit, 'b) format4

The type of format strings associated with messages.

  1. The input is always a Format.formatter
  2. The result of %a and %t printing functions is unit.
Sourcemodule Severity : sig ... end

The type of severity.

Sourcemodule Priority : sig ... end

The type of priority. These are used to style the primary and secondary causes of a diagnostic.

Sourcemodule Message : sig ... end
Sourcemodule Label : sig ... end
Sourcetype 'code t = {
  1. severity : Severity.t;
    (*

    The overall severity of the diagnostic.

    *)
  2. message : Message.t;
    (*

    The main message associated with the diagnostic. These should not include control characters (such as the newline character \n). To support compact rendering, the message should be specific enough to make sense on its own, without the additional context provided by labels and notes.

    *)
  3. code : 'code option;
    (*

    The (optional) error code assicoated with the diagnostic

    *)
  4. labels : Label.t list;
    (*

    Labels that describe the cause of the diagnostic. The order of the labels has no meaning, Grace's rendering engine will determine the order they appear.

    *)
  5. notes : Message.t list;
    (*

    Notes that are associated with the primary cause of the diagnostic.

    *)
}

The type of diagnostics.

include Sexplib0.Sexpable.S1 with type 'code t := 'code t
Sourceval t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
Sourceval create : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> Severity.t -> Message.t -> 'code t

create severity message constructs a diagnostic with the message.

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

    @param labels

    used to describe the cause of the diagnostic.

  • parameter code

    the error code of the diagnostic.

Sourceval createf : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> Severity.t -> ('a, 'code t) format -> 'a

createf severity fmt ... formats a message and constructs a diagnostic.

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

    @param labels

    used to describe the cause of the diagnostic.

  • parameter code

    the error code of the diagnostic.

Sourceval kcreatef : ?notes:Message.t list -> ?labels:Label.t list -> ?code:'code -> ('code t -> 'b) -> Severity.t -> ('a, 'b) format -> 'a

kcreatef kont severity fmt ... is equivalent to kont (createf severity fmt ...).

  • parameter notes

    additional notes associated with the primary cause of the diagnostic.

  • parameter labels

    used to describe the cause of the diagnostic.