jasom / nyaml

A lisp native YAML parser
MIT License
24 stars 8 forks source link

= NYAML a Native YAML parser for Common Lisp :toc:

NYAML allows parsing https://yaml.org[YAML] documents without relying on libyaml.

== API

Generic Function PARSE:: + Syntax::: parse input &key multi-document-p => parsed-document + Arguments and Values::: + input A pathname or an input-stream or a string multi-document-p a boolean indicating if the input may contain multiple documents + Description::: +

parse consumes and parses the entire input as a YAML file.

If input is a string, it parses it as is.

If input is a stream with an element-type that is a subtype of character then the entire stream is parsed as a string.

If input is a stream of element-type '(unsigned-byte 8) the encoding is detected per the YAML specification, and then it is decoded and parsed as a string.

Mapping of YAML types to Lisp::: This is configurable (see below) but the default is: +

Variable *NULL*:: Initial Value::: :NULL Description::: The value that null objects from YAML will be parsed as

Variable *FALSE* :: Initial Value::: NIL Description::: The value that false boolean objects from YAML will be parsed as

Variable *MAKE-MAP* :: Initial Value::: A function that creates an empty hash-table with test of cl:equal Description::: Called whenever a map is encountered in the YAML parse tree

Variable *MAP-INSERT* :: Initial Value::: A function that inserts a key into a hash-table and returns the table Description::: A function with a lambda list of (map key value) that takes an existing map created with *make-map*, and returns a new map that includes a mapping from key to value. May modify the map argument. + This is called for every map entry encountered in the YAML parse tree

Variable *LIST-TO-SEQ* :: Initial Value::: A function that coerces its argument to a simple-vector Description::: A function with a lambda list of (list) that takes a list of items and returns the sequence representation for that list. + This is called once for every sequence in the YAML parse tree

== Limitations

== Known Incompatibilities with cl-yaml

== TODOs