(** A type similar to the official Buffer module except we can discard the beginning or the end of the buffer. Used to convert a stringstream into a Linestream. *) type t = { mutable buf : string; mutable bpos : int; (** Beginning of valid chars *) mutable epos : int; (** End of valid chars *) } val create : int -> t (** [create size] - Create an empty buffer with SIZE characters pre-allocated. *) val make : string -> t (** [make text] - Create a buffer containing the given STRING. *) val replace : t -> string -> unit (** [replace string] - Replace a buffer's contents with the given STRING *) val length : t -> int (** [length buffer] - Return the length of the buffer's contents *) val empty : t -> bool (** [empty buffer] - Return true if buffer length is zero. *) val index : t -> char -> int (** [index buffer c] - Return index of first occurrence of character C *) val contents : t -> string (** [contents buffer] - Return the buffer's contents *) val head : t -> int -> string (** [head buffer n] - Return the first N characters *) val tail : t -> int -> string (** [tail buffer n] - Return the last N characters *) val clear : t -> unit (** [clear buffer] - Make the buffer empty. *) val discard : t -> int -> unit (** [discard buffer n] - Discard the first N characters of a buffer *) val pop : t -> int -> unit (** [pop buffer n] - Discard the last N characters of a buffer *) val add_string : t -> string -> unit (** [add_string buffer string] - Append the STRING to the current buffer contents *)