package delimited_parsing

  1. Overview
  2. Docs

At the lowest level, we model csv parsing as a fold over string arrays, one array per row. It is up to you to interpret the header row.

type 'a t
val acc : 'a t -> 'a

At any moment, the result of folding over all complete rows seen so far.

val set_acc : 'a t -> 'a -> 'a t

Can be used to set or clear the current acc

val create : ?strip:bool -> ?sep:char -> ?quote:[ `No_quoting | `Using of char ] -> fields_used:int array option -> init:'a -> f:(int -> 'a -> string Fast_queue.t -> 'a) -> unit -> 'a t
val input : 'a t -> ?pos:int -> ?len:int -> Core.Bytes.t -> 'a t

input t ?pos ?len s parses the first len characters of s, starting at position pos. pos defaults to 0 and len defaults to reading up to the end of s.

val input_string : 'a t -> ?pos:int -> ?len:int -> string -> 'a t
val finish : 'a t -> 'a t

finish t forces an end-of-row. Raises if end-of-row is not permitted here (e.g., within a quoted field). It is permitted to input after a finish.

OCaml

Innovation. Community. Security.