package minicaml

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

    delimited location

    *)
  2. | Nowhere
    (*

    no location

    *)
val location_of_lex : 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, Format.formatter, unit, 'b) format4 -> 'a
val print_location : location -> Format.formatter -> unit
val print_message : ?color:T.color -> ?loc:location -> string -> ('a, Format.formatter, unit, unit) 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, Format.formatter, unit, 'b) format4 -> 'a

A fatal error reported by the toplevel.

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

A syntax error reported by the toplevel

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

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

val print_position : Lexing.lexbuf -> string
OCaml

Innovation. Community. Security.