Pure OCaml Yaml 1.2 reader and writer using Bytesrw
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Block scalar chomping indicators *)
7
8type t =
9 | Strip (** Remove final line break and trailing empty lines *)
10 | Clip (** Keep final line break, remove trailing empty lines (default) *)
11 | Keep (** Keep final line break and trailing empty lines *)
12
13let to_string = function Strip -> "strip" | Clip -> "clip" | Keep -> "keep"
14let pp fmt t = Format.pp_print_string fmt (to_string t)
15let of_char = function '-' -> Some Strip | '+' -> Some Keep | _ -> None
16let to_char = function Strip -> Some '-' | Clip -> None | Keep -> Some '+'
17let equal a b = a = b