package dolmen

  1. Overview
  2. Docs
A parser library

Install

Dune Dependency

Authors

Maintainers

Sources

dolmen-0.4.1.tar.gz
md5=55a97ff61dd8398e38570272ae7e3964
sha512=83f71037eb568d5449ff2d968cb50a0b105c9712e0bd29497d1f95683698f394860a11d4dee2a2a41163504e395ef068c3974901fca11894d671684fe438fc51

doc/dolmen.std/Dolmen_std/ParseLocation/index.html

Module Dolmen_std.ParseLocationSource

Standard implementation of file locations.

Interface definition

An anstract module type for providing locations. Used as argumentby much of the functors provided in Dolmen. This module (ParseLocation) implements this specification.

Concrete positions

Sourcetype t = {
  1. file : string;
  2. start_line : int;
  3. start_column : int;
  4. stop_line : int;
  5. stop_column : int;
}
Sourceexception Uncaught of t * exn
Sourceexception Lexing_error of t * string
Sourceexception Syntax_error of t * string

Exceptions that may occur during parsing

Sourceval hash : t -> int
Sourceval eq : t -> t -> bool

Hash and equality

Sourceval mk : string -> int -> int -> int -> int -> t
Sourceval mk_pair : string -> (int * int) -> (int * int) -> t

Construction functions

Sourceval pp : Buffer.t -> t -> unit
Sourceval fmt : Format.formatter -> t -> unit
Sourceval fmt_hint : Format.formatter -> t -> unit

Printing functions

Sourceval combine : t -> t -> t

Location that spans the two given positions. The file is assumed to be the same in both case, and is chosen from one of the two positions.

Sourceval combine_list : t list -> t

N-ary version of combine.

Sourceval smaller : t -> t -> bool

smaller p1 p2 is true if p1 is included in p2, ie p1 is a sub-location of p2 (interval inclusion)

Lexbuf

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

Change the file name used for positions in this lexbuf

Sourceval mk_lexbuf : [ `Stdin | `File of string ] -> Lexing.lexbuf * (unit -> unit)

Returns the lexbuf associetd with the given file or stdin, with the correct filename, together with a function to close the associated file descriptor.

Sourceval of_lexbuf : Lexing.lexbuf -> t

Recover a position from a lexbuf

OCaml

Innovation. Community. Security.