package minicaml

  1. Overview
  2. Docs
module T = ANSITerminal
type location =
  1. | Location of Stdlib.Lexing.position * Stdlib.Lexing.position
    (*

    delimited location

    *)
  2. | Nowhere
    (*

    no location

    *)
val location_of_lex : Stdlib.Lexing.lexbuf -> location
exception Error of location * string * string

Exception Error (loc, err, msg) indicates an error of type err with error message msg, occurring at location loc.

error ~loc ~kind raises an error of the given kind. The kfprintf magic allows one to write msg using a format string.

val error : ?kind:string -> ?loc:location -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a
val print_location : location -> Stdlib.Format.formatter -> unit
val print_message : ?color:T.color -> ?loc:location -> string -> ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

Print a message at a given location loc of message type msg_type.

val print_error : (location * string * string) -> unit

Print the caught error

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

A fatal error reported by the toplevel.

val syntax_error : ?loc:location -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'c

A syntax error reported by the toplevel

val wrap_syntax_errors : (Stdlib.Lexing.lexbuf -> 'a) -> Stdlib.Lexing.lexbuf -> 'b

Parser wrapper that catches syntax-related errors and converts them to errors.

val print_position : Stdlib.Lexing.lexbuf -> string