package ppxlib

  1. Overview
  2. Docs
Standard library for ppx rewriters

Install

Dune Dependency

Authors

Maintainers

Sources

ppxlib-0.29.1.tbz
sha256=c8ea8c8770414fdba6612e7f2d814b21a493daa974ea862a90c8e6c766e5dd79
sha512=edc468e9111cc26e31825e475fd72f55123a22fe86548e07e7d111796fecb8d60359b1b53c7eac383e5e2114cbae74dfd9c166f330e84cbeab4ddfd5797e322f

doc/ppxlib.astlib/Astlib/Location/index.html

Module Astlib.LocationSource

Source code locations (ranges of positions), used in parsetrees

type t = Ocaml_common.Location.t = {
  1. loc_start : Lexing.position;
  2. loc_end : Lexing.position;
  3. loc_ghost : bool;
}

The location type

type 'a loc = 'a Ocaml_common.Location.loc = {
  1. txt : 'a;
  2. loc : t;
}

A located type

Sourcemodule Error : sig ... end
Sourceval set_input_name : string -> unit

Set the name of the input source, e.g. the file name.

val none : t

An arbitrary value of type t; describes an empty ghost range.

Automatically reporting errors for raised exceptions

val register_error_of_exn : (exn -> Error.t option) -> unit

Each compiler module which defines a custom type of exception which can surface as a user-visible error should register a "printer" for this exception using register_error_of_exn. The result of the printer is an error value containing a location, a message, and optionally sub-messages (each of them being located as well).

exception Error of Error.t

Located exception.

Sourceval raise_errorf : ?loc:t -> ('a, Format.formatter, unit, 'b) format4 -> 'a

Raise a located exception.

val report_exception : Format.formatter -> exn -> unit

Report an exception on the given formatter

OCaml

Innovation. Community. Security.