package gobba

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

    delimited location

    *)
  2. | Nowhere
    (*

    no location

    *)

The location of a lexeme in code

val location_of_lex : Lexing.lexbuf -> location

Get the location of a lexeme

type internalerrort =
  1. | Fatal of string
  2. | InternalFailure of string
  3. | WrongPrimitiveArgs
  4. | IndexOutOfBounds
  5. | TypeError of string
  6. | UnboundVariable of string
  7. | ListError of string
  8. | DictError of string
  9. | FileNotFoundError of string
  10. | PurityError of string
  11. | SyntaxError of string

Exceptions

val show_internalerrort : internalerrort -> Ppx_deriving_runtime.string
exception InternalError of location * internalerrort * Types.stackframe

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

val sraises : Lexing.lexbuf -> string -> Types.stackframe -> 'a

Utility function to raise a syntax error quickly

val sraise : 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
OCaml

Innovation. Community. Security.