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(** YAML scalar quoting detection *)
7
8val needs_quoting : string -> bool
9(** Check if a string value needs quoting in YAML output.
10 Returns true if the string:
11 - Is empty
12 - Starts with an indicator character
13 - Is a reserved word (null, true, false, yes, no, etc.)
14 - Contains characters that would be ambiguous
15 - Looks like a number *)
16
17val needs_double_quotes : string -> bool
18(** Check if a string requires double quotes (vs single quotes).
19 Returns true if the string contains characters that need escape sequences. *)
20
21val choose_style : string -> [> `Plain | `Single_quoted | `Double_quoted ]
22(** Choose the appropriate quoting style for a string value *)