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 @@ -
Asai.Diagnostic
The definition of diagnostics and some utility functions.
module type Code = sig ... end
The signature of message code. An implementer should specify the message code used in their library or application.
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:
\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 = {
severity : severity;
Severity of the diagnostic.
*)code : 'code;
The message code.
*)message : message;
The main message.
*)backtrace : backtrace;
The backtrace leading to this diagnostic.
*)additional_messages : message list;
Additional messages relevant to the main message that are not part of the backtrace.
*)}
The type of diagnostics.
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
module type Code = sig ... end
The signature of message code. An implementer should specify the message code used in their library or application.
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:
- All string (and character) literals must be encoded using UTF-8.
- 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 = {
severity : severity;
(*Severity of the diagnostic.
*)code : 'code;
(*The message code.
*)message : message;
(*The main message.
*)backtrace : backtrace;
(*The backtrace leading to this diagnostic.
*)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.