Source

ocaml-indent / reader.mli

camlspotter 3e9a340 






















(** This module provides the same functionality of [Lexing.from_function] 
    but the actual substring can be retrievable from the obtained tokens.
*)

type t (** The reader type *)

val create_from_channel : in_channel -> t
(** Creation from [in_channel] *)

val lex : t -> (Lexing.lexbuf -> 'a) -> 'a
(** Run a lexing function once over the reader *)

val substring : t -> int -> int -> string
(** [substring t pos len] returns the substring of [t] *)

val substring_of_region : t -> Pos.Region.t -> string
(** Same as [substring] but by [Pos.Region.t] *)

val region : t -> Pos.Region.t
(** Returns the reader's internal lexbuf's current region. *)

val current_substring : t -> string
(** Returns the reader's internal lexbuf's current region's substring. *)