diff --git a/asai/Asai/Diagnostic/index.html b/asai/Asai/Diagnostic/index.html index 186075c..624821d 100644 --- a/asai/Asai/Diagnostic/index.html +++ b/asai/Asai/Diagnostic/index.html @@ -1,5 +1,5 @@ -Diagnostic (asai.Asai.Diagnostic)

Module Asai.Diagnostic

The definition of diagnostics and some utility functions.

Types

type severity =
  1. | Hint
  2. | Info
  3. | Warning
  4. | Error
  5. | Bug

The type of severity.

module type Code = sig ... end

The signature of message code. An implementer should specify the message code used in their library or application.

type text = Stdlib.Format.formatter -> unit

The type of text.

When we render a diagnostic, the layout engine of the rendering backend should be the one making layout choices. Therefore, we cannot pass already formatted strings. Instead, a text is defined to be a function that takes a formatter and uses it to render the content. The following two conditions must be satisfied:

  1. All string (and char) literals must be encoded using UTF-8.
  2. All string (and char) literals must not contain control characters (such as newlines \n). It is okay to have break hints (such as @, and @ ) but not literal control characters. This means you should avoid pre-formatted strings, and if you must use them, use text to convert newline characters. Control characters include `U+0000-001F` (C0 controls), `U+007F` (backspace), and `U+0080-009F` (C1 controls); in particular, `U+000A` (newline) is a C0 control character. These characters are banned because they would mess up the cursor position.
type message = text Span.located

A message is a located text.

type backtrace = message Bwd.bwd

A backtrace is a (backward) list of messages.

type 'code t = {
  1. severity : severity;
    (*

    Severity of the diagnostic.

    *)
  2. code : 'code;
    (*

    The message code.

    *)
  3. message : message;
    (*

    The main message.

    *)
  4. backtrace : backtrace;
    (*

    The backtrace leading to this diagnostic.

    *)
  5. additional_messages : message list;
    (*

    Additional messages relevant to the main message that are not part of the backtrace.

    *)
}

The type of diagnostics.

Constructions of Messages

val text : string -> text

text str converts the string str into a text, converting each '\n' into a call to Format.pp_force_newline.

val textf : ('a, Stdlib.Format.formatter, unit, text) Stdlib.format4 -> 'a

textf format ... constructs a text. It is an alias of Format.dprintf. Note that there should not be any literal control characters (e.g., literal newline characters).

val ktextf : +Diagnostic (asai.Asai.Diagnostic)

Module Asai.Diagnostic

The definition of diagnostics and some utility functions.

Types

type severity =
  1. | Hint
  2. | Info
  3. | Warning
  4. | Error
  5. | Bug

The type of severity.

module type Code = sig ... end

The signature of message code. An implementer should specify the message code used in their library or application.

type text = Stdlib.Format.formatter -> unit

The type of text.

When we render a diagnostic, the layout engine of the rendering backend should be the one making layout choices. Therefore, we cannot pass already formatted strings. Instead, a text is defined to be a function that takes a formatter and uses it to render the content. The following two conditions must be satisfied:

  1. All string (and character) literals must be encoded using UTF-8.
  2. All string (and character) literals must not contain control characters (such as newlines \n). It is okay to have break hints (such as @, and @ ) but not literal control characters. This means you should avoid pre-formatted strings, and if you must use them, use text to convert newline characters. Control characters include `U+0000-001F` (C0 controls), `U+007F` (backspace), and `U+0080-009F` (C1 controls); in particular, `U+000A` (newline) is a C0 control character. These characters are banned because they would mess up the cursor position.
type message = text Span.located

A message is a located text.

type backtrace = message Bwd.bwd

A backtrace is a (backward) list of messages.

type 'code t = {
  1. severity : severity;
    (*

    Severity of the diagnostic.

    *)
  2. code : 'code;
    (*

    The message code.

    *)
  3. message : message;
    (*

    The main message.

    *)
  4. backtrace : backtrace;
    (*

    The backtrace leading to this diagnostic.

    *)
  5. additional_messages : message list;
    (*

    Additional messages relevant to the main message that are not part of the backtrace.

    *)
}

The type of diagnostics.

Constructions of Messages

val text : string -> text

text str converts the string str into a text, converting each '\n' into a call to Format.pp_force_newline.

val textf : ('a, Stdlib.Format.formatter, unit, text) Stdlib.format4 -> 'a

textf format ... constructs a text. It is an alias of Format.dprintf. Note that there should not be any literal control characters (e.g., literal newline characters).

val ktextf : (text -> 'b) -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a

ktextf kont format ... is kont (textf code format ...). It is an alias of Format.kdprintf.

val message : ?loc:Span.t -> string -> message

message str converts the string str into a message.

  • parameter loc

    The location of the message (usually the code) to highlight.

val messagef :