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 parser events *)
7
8type t =
9 | Stream_start of { encoding : Encoding.t }
10 | Stream_end
11 | Document_start of {
12 version : (int * int) option;
13 implicit : bool;
14 }
15 | Document_end of { implicit : bool }
16 | Alias of { anchor : string }
17 | Scalar of {
18 anchor : string option;
19 tag : string option;
20 value : string;
21 plain_implicit : bool;
22 quoted_implicit : bool;
23 style : Scalar_style.t;
24 }
25 | Sequence_start of {
26 anchor : string option;
27 tag : string option;
28 implicit : bool;
29 style : Layout_style.t;
30 }
31 | Sequence_end
32 | Mapping_start of {
33 anchor : string option;
34 tag : string option;
35 implicit : bool;
36 style : Layout_style.t;
37 }
38 | Mapping_end
39
40type spanned = {
41 event : t;
42 span : Span.t;
43}
44
45val pp : Format.formatter -> t -> unit
46(** Pretty-print an event *)
47
48val pp_spanned : Format.formatter -> spanned -> unit
49(** Pretty-print a spanned event *)