Module Touist.Err

This is where the compiler errors are managed.

We call a 'message' an error or a warning. Two cases for displaying the errors:

Rules for good error or warning messages:

type msg_type =
| Error
| Warning
type during =
| Usage
| Parse
| Lex
| Eval
| Sat
| Cnf
| Prenex
type loc = Lexing.position * Lexing.position
type msg = msg_type * during * string * loc option
exception TouistFatal of msg

Print the errors

val string_of_loc : ?⁠fmt:string ‑> loc ‑> string
val string_of_msg : ?⁠width:int ‑> ?⁠color:bool ‑> ?⁠fmt:string ‑> msg ‑> string
val string_of_type : msg_type ‑> string
val string_of_during : during ‑> string
val get_loc : loc ‑> int * int * int * int

get_loc translates a 'loc' to an understandable tuple that contains (num_line, num_col, token_start, token_end).

Give errors

val warn : msg ‑> unit
val fatal : msg ‑> 'a

Change the error formatting

val wrap_width : int Pervasives.ref
val format : string Pervasives.ref
val loc_format : string Pervasives.ref
val color : bool Pervasives.ref
val discard_warnings : bool Pervasives.ref