Module Gobba.Errors

type location =
| Location of Stdlib.Lexing.position * Stdlib.Lexing.position

delimited location

| Nowhere

no location

The location of a lexeme in code

val location_of_lex : Stdlib.Lexing.lexbuf -> location

Get the location of a lexeme

type internalerrort =
| Fatal of string
| InternalFailure of string
| WrongPrimitiveArgs
| IndexOutOfBounds
| TypeError of string
| UnboundVariable of string
| ListError of string
| DictError of string
| FileNotFoundError of string
| PurityError of string
| SyntaxError of string

Exceptions

val pp_internalerrort : Ppx_deriving_runtime.Format.formatter -> internalerrort -> Ppx_deriving_runtime.unit
val show_internalerrort : internalerrort -> Ppx_deriving_runtime.string
exception InternalError of location * internalerrort * Types.stackframe
val sraises : Stdlib.Lexing.lexbuf -> string -> Types.stackframe -> 'a

Utility function to raise a syntax error quickly

val sraise : Stdlib.Lexing.lexbuf -> string -> 'a
val iraises : internalerrort -> Types.stackframe -> 'a

Utility function to raise an internal error without a location

val iraise : internalerrort -> 'a
val traises : string -> Types.stackframe -> 'a

Utility function to raise a type error without a location

val traise : string -> 'a
val print_location : location -> string

Print the location of a lexeme

val print_message : ?⁠color:Gobba.Types.T.color -> ?⁠loc:location -> string -> string -> unit

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

val print_error : (location * internalerrort * 'a) -> unit

Print the caught error

val print_stacktrace : ('a * 'b * Types.stackframe) -> int -> unit