yaml

Parse and generate YAML 1.1/1.2 files
IN THIS PACKAGE
Module Yaml . Stream
module Mark : sig ... end

Position information for an event

module Event : sig ... end

Definition of an individual event during a processing stream

Parsing functions

type parser

parser tracks the state of generating Event.t values.

val parser : string -> ( parser, [> `Msg of string ] ) result

parser () will allocate a fresh parser state.

val do_parse : parser -> (Event.t * Event.pos) res

do_parse parser will generate the next parsing event from an initialised parser.

Serialisation functions

type emitter

emitter tracks the state of generating Event.t values for YAML output.

val emitter : ?len:int -> unit -> emitter res

emitter ?len () will allocate a new emitter state. Due to a temporary limitation in the implementation, len decides how large the fixed size buffer that the output is written into is. In the future, len will be redundant as the buffer will be dynamically allocated.

val emitter_buf : emitter -> Bytes.t
val emit : emitter -> Event.t -> unit res
val document_start : ?version:version -> ?implicit:bool -> emitter -> unit res
val document_end : ?implicit:bool -> emitter -> unit res
val scalar : scalar -> emitter -> unit res
val alias : emitter -> string -> unit res
val stream_start : emitter -> encoding -> unit res
val stream_end : emitter -> unit res
val sequence_start : ?anchor:string -> ?tag:string -> ?implicit:bool -> ?style:layout_style -> emitter -> unit res
val sequence_end : emitter -> unit res
val mapping_start : ?anchor:string -> ?tag:string -> ?implicit:bool -> ?style:layout_style -> emitter -> unit res
val mapping_end : emitter -> unit res
val emitter_written : emitter -> int
val get_version : unit -> int * int * int

library_version () returns the major, minor and patch version of the underlying libYAML implementation.