package ppxlib

  1. Overview
  2. Docs
Standard library for ppx rewriters

Install

Dune Dependency

Authors

Maintainers

Sources

ppxlib-0.25.1.tbz
sha256=a51b3868029e62ff14a0f2bd8d278dacfc0c3fc5b22d484a296be90c53e4ffd7
sha512=6a6d9af49344e901cc9e6da7bcf38c2973705c8cee4cff1c64c0393e9ccc55a6abec1f58d5b56d0807939a3741bec722ee7bfc244f94619167a30438f182488a

doc/ppxlib/Ppxlib/Location/index.html

Module Ppxlib.LocationSource

Overrides the Location module of OCaml

There are less functions in this module. However the API should be more stable than the Location module of OCaml.

Sourcetype t = Astlib.Location.t = {
  1. loc_start : Lexing.position;
  2. loc_end : Lexing.position;
  3. loc_ghost : bool;
}
Sourceval in_file : string -> t

Return an empty ghost range located in a given file.

Sourceval set_filename : t -> string -> t

Set the pos_fname both in loc_start and loc_end. Leave the rest as is.

Sourceval none : t

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

Sourceval init : Lexing.lexbuf -> string -> unit

Set the file name and line number of the lexbuf to be the start of the named file.

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

Raise a located error. Should be avoided as much as possible, in favor of error_extensionf.

Sourceval of_lexbuf : Lexing.lexbuf -> t

Return the location corresponding to the last matched regular expression

Sourceval report_exception : Stdppx.Caml.Format.formatter -> exn -> unit

Report an exception on the given formatter

Sourceval print : Stdppx.Caml.Format.formatter -> t -> unit

Prints File "...", line ..., characters ...-...:

Sourcetype nonrec 'a loc = 'a Astlib.Location.loc = {
  1. txt : 'a;
  2. loc : t;
}
Sourceval compare_pos : Lexing.position -> Lexing.position -> int
Sourceval compare : t -> t -> int
Sourcemodule Error : sig ... end
Sourceval error_extensionf : loc:t -> ('a, Format.formatter, unit, string Astlib.Location.loc * Astlib.Ast_412.Parsetree.payload) format4 -> 'a

Returns an error extension node. When encountered in the AST, the compiler recognizes it and displays the error properly.

Sourceexception Error of Error.t
OCaml

Innovation. Community. Security.