package delimited_parsing

  1. Overview
  2. Docs

Positional parses fixed-width fields.

type header = (string * int * int) list

Specify the name, and 0-based starting position and length of each column. For example column 'foo' starting on the first character of each line and 8 characters wide would be ("foo", 0, 8). Column ranges must not overlap.

All following funtions return Error if column ranges overlap.

val of_reader : ?strip:bool -> ?skip_lines:int -> ?on_parse_error: [ `Raise | `Handle of string Core.Queue.t -> exn -> [ `Continue | `Finish ] ] -> header:header -> ?strict:bool -> Async.Reader.t -> Delimited_parsing__.Row.t Async.Pipe.Reader.t Core.Or_error.t

of_reader ?quote ?strip ?skip_lines ~sep ~header r returns a row pipe based on data read from the provided reader. sep is used as the separator between fields, and is assumed to be escaped with \ unless quote is given.

val create_reader : ?strip:bool -> ?skip_lines:int -> ?on_parse_error: [ `Raise | `Handle of string Core.Queue.t -> exn -> [ `Continue | `Finish ] ] -> header:header -> ?strict:bool -> string -> Delimited_parsing__.Row.t Async.Pipe.Reader.t Async.Deferred.Or_error.t
val of_writer : Async.Writer.t -> ?strict:bool -> header -> string list Async.Pipe.Writer.t Core.Or_error.t
val create_writer : string -> ?strict:bool -> header -> string list Async.Pipe.Writer.t Async.Deferred.Or_error.t
OCaml

Innovation. Community. Security.