Pure OCaml Yaml 1.2 reader and writer using Bytesrw
at main 1.0 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: ISC 4 ---------------------------------------------------------------------------*) 5 6(** YAML parser - converts tokens to semantic events via state machine *) 7 8type t 9 10(** {2 Constructors} *) 11 12val of_string : string -> t 13(** Create parser from a string *) 14 15val of_scanner : Scanner.t -> t 16(** Create parser from a scanner *) 17 18val of_input : Input.t -> t 19(** Create parser from an input source *) 20 21val of_reader : Bytesrw.Bytes.Reader.t -> t 22(** Create parser from a Bytes.Reader *) 23 24(** {2 Event Access} *) 25 26val next : t -> Event.spanned option 27(** Get next event *) 28 29(** {2 Iteration} *) 30 31val iter : (Event.spanned -> unit) -> t -> unit 32(** Iterate over all events *) 33 34val fold : ('a -> Event.spanned -> 'a) -> 'a -> t -> 'a 35(** Fold over all events *) 36 37val to_list : t -> Event.spanned list 38(** Convert to list of events *)