This package provides a Gerbil YAML processor using liblmdb
.
You need to have libyaml
installed in your system.
In ubuntu:
$ sudo apt install libyaml-dev
To install the package in your $GERBIL_PATH
(~/.gerbil
by default):
$ gerbil pkg install github.com/mighty-gerbils/gerbil-libyaml
To use bindings from this package:
(import :clan/text/yaml)
(yaml-key-format) -> formatter
(yaml-key-format new-formatter) -> old-formatter
A parameter that controls how string keys are stored in mappings. YAML allows non-string keys in mappings (e.g. numbers, sequences, and other mappings). These are not affected by this parameter.
No conversion is done by default.
To convert map keys to symbols:
> (parameterize ((yaml-key-format string->symbol))
(hash-keys (car (yaml-load-string "foo: bar"))))
(foo)
To convert map keys to keywords:
> (parameterize ((yaml-key-format string->keyword))
(hash-keys (car (yaml-load-string "foo: bar"))))
(foo:)
(yaml-load filename) -> any | error
filename := string
Loads a YAML data from given filename. Signals an error if fails to parse YAML.
(yaml-load-string str) -> any | error
str := string of YAML data
Parses a YAML data from str. Signals an error if fails to parse YAML.
(yaml-dump filename . args)
filename := string
Dumps the arguments to a YAML file.
© 2017-2023 The Gerbil Core Team and contributors; License: LGPLv2.1 and Apache 2.0
Originally written by vyzo.