package ppx_core

  1. Overview
  2. Docs

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.

type t = Ppx_ast__.Import.Location.t = {
  1. loc_start : Lexing.position;
  2. loc_end : Lexing.position;
  3. loc_ghost : Base.Bool.t;
}
val in_file : Base.String.t -> t

Return an empty ghost range located in a given file.

val none : t

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

val raise_errorf : ?loc:t -> ('a, Caml.Format.formatter, Base.Unit.t, 'b) Pervasives.format4 -> 'a

Raise a located error. The exception is caught by ppx_driver and handled appropriately

val of_lexbuf : Lexing.lexbuf -> t

Return the location corresponding to the last matched regular expression

val report_exception : Caml.Format.formatter -> Base.Exn.t -> Base.Unit.t

Report an exception on the given formatter

val print : Caml.Format.formatter -> t -> Base.Unit.t

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

type nonrec 'a loc = 'a Ppx_ast__.Import.Location.loc = {
  1. txt : 'a;
  2. loc : t;
}
module Error : sig ... end
exception Error of Error.t
OCaml

Innovation. Community. Security.