package core_extended

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

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 Delimited_kernel__.Append_only_buffer.t -> 'a) -> unit -> 'a t
val input : 'a t -> ?pos:int -> ?len:int -> Core_kernel.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.

val is_at_beginning_of_row : _ t -> bool

Returns true if the parser is at the beginning of a row


Innovation. Community. Security.