package core_extended

  1. Overview
  2. Docs
exception Bad_csv_formatting of string list * string

Row up to the error, and the field with the error up to the point of failure

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 current_line_number : 'a t -> int
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 ] -> ?start_line_number:int -> fields_used:int array option -> init:'a -> f: (line_number:int -> 'a -> string Delimited_kernel__.Append_only_buffer.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).

val at_beginning_of_row : 'a t -> bool
OCaml

Innovation. Community. Security.