package b0

  1. Overview
  2. Docs
Software construction and deployment kit

Install

Dune Dependency

Authors

Maintainers

Sources

b0-0.0.1.tbz
sha256=dba2fc571f39f3b8e87ee55c77bdec7ec6a5ddc7d99b8b20aeda848af546be04
md5=51ee1d66acc4d7f87bdceac1341b7711

doc/b00_kit/B00_lines/index.html

Module B00_lines

Parse text lines.

And do it regardless of the platform line ending convention.

Lines

A line is ends either with "\n" or with "\r\n".

val of_string : string -> string list

of_string s are s's lines, including empty ones. In particular, this is [""] on the empty string.

val fold : ?file:B00_std.Fpath.t -> string -> (int -> string -> 'a -> 'a) -> 'a -> ('a, string) Stdlib.result

fold ~file data f acc folds f with acc over the lines of data assuming it came from file. f is given the one-based line number, the line and the accumulator, it may use err to error which turns it in an Error _ for file via err_file.

If data is "" this returns acc.

Parse errors

val err : int -> ('a, Stdlib.Format.formatter, unit, 'b) Stdlib.format4 -> 'a

err n fmt formats an error message for line n as "%d:" ^^ fmt and raises Failure with no trace.

val err_file : ?file:B00_std.Fpath.t -> string -> ('a, string) Stdlib.result

err_file ~file e is the error message e for file file formatted as "%a:%s" Fpath.pp_unquoted f s

OCaml

Innovation. Community. Security.