AdaYaml’s parser has a quite simple interface. Basically, you call one of the Set_Input procedures to tell the parser where to read the YAML character stream from and then start querying events with Next.


Input can be either a String or a polymorphic Yaml.Source.Instance'Class. AdaYaml provides two implementations for sources:

You can provide an own implementation of Yaml.Source.Instance for sources not covered by AdaYaml, e.g. a network stream.

Querying Events

Parsing is lazy. The next event is typically only parsed from the input when you query it. This means that if the input contains any syntax errors, Next will only raise an exception after all parseable events in front of the syntax error have been yielded.

By convention, the parser has finished after it emits a Stream_End token. Subsequent calls to Next will always yield another Stream_End token.

Error Handling

A call to Next can typically yield two exceptions:

In addition, standard Ada exceptions that can be raised are: