This is the cl-yaml Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:34:19 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-yaml
A YAML parser and emitter.
Fernando Borretti <eudoxiahp@gmail.com>
Fernando Borretti <eudoxiahp@gmail.com>
(GIT git@github.com:eudoxia0/cl-yaml.git)
MIT
# cl-yaml
[![Build Status](https://travis-ci.org/eudoxia0/cl-yaml.svg?branch=master)](https://travis-ci.org/eudoxia0/cl-yaml)
[![Coverage Status](https://coveralls.io/repos/eudoxia0/cl-yaml/badge.svg?branch=master)](https://coveralls.io/r/eudoxia0/cl-yaml?branch=master)
[![Quicklisp](http://quickdocs.org/badge/cl-yaml.svg)](http://quickdocs.org/cl-yaml/)
A YAML parser and emitter built on top of [libyaml][libyaml]. Uses the
[cl-libyaml][cl-libyaml] library.
# Usage
The ‘yaml‘ package exports three functions:
* ‘(parse string-or-pathname)‘: Parses a string or a pathname into Lisp values.
* ‘(emit value stream)‘: Emit a Lisp value into a stream.
* ‘(emit-to-string value)‘: Emit a Lisp value into a string.
## Parsing
“‘lisp
CL-USER> (yaml:parse "[1, 2, 3]")
(1 2 3)
CL-USER> (yaml:parse "{ a: 1, b: 2 }")
{"a" => 1, "b" => 2}
CL-USER> (yaml:parse "- Mercury
- Venus
- Earth
- Mars")
("Mercury" "Venus" "Earth" "Mars")
CL-USER> (yaml:parse "foo
—
bar" :multi-document-p t)
(:DOCUMENTS "foo" "bar")
“‘
## Emitting
“‘lisp
CL-USER> (yaml:emit-to-string (list 1 2 3))
"[1, 2, 3]"
CL-USER> (yaml:emit-to-string
(alexandria:alist-hash-table ’(("a" . 1)
("b" . 2))))
"{ b: 2, a: 1 }"
CL-USER> (yaml:emit (list t 123 3.14) *standard-output*)
[true, 123, 3.14]
“‘
# Documentation
## Type Mapping
cl-yaml uses YAML’s [Core Schema][core-schema] to map YAML values to Lisp types
an vice versa. A table showing the correspondence of values and types is shown
below:
| YAML type | Lisp type |
| ———- | —————– |
| Null | ‘nil‘ |
| Boolean | ‘t‘ and ‘nil‘ |
| Integer | Integer |
| Float | Double float |
| String | String |
| List | List |
| Map | Hash table |
| Document | ‘(:document ...)‘ |
## IEEE Floating Point Support
Common Lisp doesn’t natively support the IEEE special floating point values: NaN
(Not a number), positive infinity and negative infinity are unrepresentable in
portable Common Lisp. Since YAML allows documents to include these values, we
have to figure out what to do with them. cl-yaml supports multiple float
strategies.
The default strategy is ‘:keyword‘, which uses keywords to represent these
values. The strategy can be customized by setting the value of
‘yaml.float:*float-strategy*‘ to one of the following keywords:
1. ‘:error‘: The simplest approach, simply signal the condition
‘yaml.error:unsupported-float-value‘ whenever a NaN or infinity value is
encountered.
2. ‘:keyword‘: Use keywords to represent the different values, i.e.: ‘:NaN‘ for
NaN, ‘:+Inf‘ for positive infinity and ‘:-Inf‘ for negative infinity.
3. ‘:best-effort‘: Use implementation-specific values whenever possible, fall
back on ‘:keyword‘ in unsupported implementations. On SBCL and Allegro Common
Lisp, NaN and infinity can be represented.
[core-schema]: http://www.yaml.org/spec/1.2/spec.html#id2804923
[libyaml]: http://pyyaml.org/wiki/LibYAML
[cl-libyaml]: https://github.com/eudoxia0/cl-libyaml
# License
Copyright (c) 2013-2015 Fernando Borretti
Licensed under the MIT License.
0.1
cl-libyaml
(system).
alexandria
(system).
cl-ppcre
(system).
parse-number
(system).
src
(module).
Modules are listed depth-first from the system components tree.
cl-yaml/src
cl-yaml
(system).
error.lisp
(file).
float.lisp
(file).
scalar.lisp
(file).
parser.lisp
(file).
emitter.lisp
(file).
yaml.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-yaml/cl-yaml.asd
cl-yaml/src/error.lisp
cl-yaml/src/float.lisp
cl-yaml/src/scalar.lisp
cl-yaml/src/parser.lisp
cl-yaml/src/emitter.lisp
cl-yaml/src/yaml.lisp
cl-yaml/src/error.lisp
src
(module).
column
(reader method).
line
(reader method).
message
(reader method).
parsing-error
(condition).
unsupported-float-value
(condition).
yaml-error
(condition).
cl-yaml/src/float.lisp
error.lisp
(file).
src
(module).
*float-strategy*
(special variable).
negative-infinity
(function).
not-a-number
(function).
positive-infinity
(function).
*sbcl-nan-value*
(special variable).
cl-yaml/src/scalar.lisp
float.lisp
(file).
src
(module).
parse-scalar
(function).
+false+
(special variable).
+false-names+
(special variable).
+float-scanner+
(special variable).
+hex-integer-scanner+
(special variable).
+integer-scanner+
(special variable).
+nan-names+
(special variable).
+negative-infinity-scanner+
(special variable).
+null+
(special variable).
+null-names+
(special variable).
+octal-integer-scanner+
(special variable).
+positive-infinity-scanner+
(special variable).
+quoted-scalar-styles+
(special variable).
+true-names+
(special variable).
cl-yaml/src/parser.lisp
scalar.lisp
(file).
src
(module).
parse-string
(function).
register-mapping-converter
(function).
register-scalar-converter
(function).
register-sequence-converter
(function).
+mapping-converters+
(special variable).
+scalar-converters+
(special variable).
+sequence-converters+
(special variable).
convert-mapping
(function).
convert-scalar
(function).
convert-sequence
(function).
mapping-converter
(function).
parse-tokens
(function).
parse-yaml
(function).
scalar-converter
(function).
sequence-converter
(function).
signal-reader-error
(function).
cl-yaml/src/emitter.lisp
parser.lisp
(file).
src
(module).
document-end-event
(function).
document-start-event
(function).
emit
(function).
emit-document
(macro).
emit-mapping
(macro).
emit-object
(generic function).
emit-pretty-as-document
(function).
emit-scalar
(function).
emit-sequence
(macro).
emit-stream
(macro).
emit-to-string
(function).
encode
(generic function).
mapping-end-event
(function).
mapping-start-event
(function).
print-scalar
(generic function).
scalar-event
(function).
sequence-end-event
(function).
sequence-start-event
(function).
stream-end-event
(function).
stream-start-event
(function).
with-emitter-to-stream
(macro).
with-emitter-to-string
(macro).
foreign-emitter
(function).
foreign-event
(function).
cl-yaml/src/yaml.lisp
emitter.lisp
(file).
src
(module).
emit
(function).
emit-pretty-as-document
(function).
emit-to-string
(function).
parse
(generic function).
Packages are listed by definition order.
cl-yaml
The main YAML interface.
yaml
common-lisp
.
emit
(function).
emit-pretty-as-document
(function).
emit-to-string
(function).
parse
(generic function).
yaml.emitter
The YAML emitter.
common-lisp
.
document-end-event
(function).
document-start-event
(function).
emit
(function).
emit-document
(macro).
emit-mapping
(macro).
emit-object
(generic function).
emit-pretty-as-document
(function).
emit-scalar
(function).
emit-sequence
(macro).
emit-stream
(macro).
emit-to-string
(function).
encode
(generic function).
mapping-end-event
(function).
mapping-start-event
(function).
print-scalar
(generic function).
scalar-event
(function).
sequence-end-event
(function).
sequence-start-event
(function).
stream-end-event
(function).
stream-start-event
(function).
with-emitter-to-stream
(macro).
with-emitter-to-string
(macro).
foreign-emitter
(function).
foreign-event
(function).
yaml.scalar
Parser for scalar values.
common-lisp
.
parse-scalar
(function).
+false+
(special variable).
+false-names+
(special variable).
+float-scanner+
(special variable).
+hex-integer-scanner+
(special variable).
+integer-scanner+
(special variable).
+nan-names+
(special variable).
+negative-infinity-scanner+
(special variable).
+null+
(special variable).
+null-names+
(special variable).
+octal-integer-scanner+
(special variable).
+positive-infinity-scanner+
(special variable).
+quoted-scalar-styles+
(special variable).
+true-names+
(special variable).
yaml.parser
The YAML parser.
common-lisp
.
parse-string
(function).
register-mapping-converter
(function).
register-scalar-converter
(function).
register-sequence-converter
(function).
+mapping-converters+
(special variable).
+scalar-converters+
(special variable).
+sequence-converters+
(special variable).
convert-mapping
(function).
convert-scalar
(function).
convert-sequence
(function).
mapping-converter
(function).
parse-tokens
(function).
parse-yaml
(function).
scalar-converter
(function).
sequence-converter
(function).
signal-reader-error
(function).
yaml.error
YAML errors.
common-lisp
.
column
(generic reader).
line
(generic reader).
message
(generic reader).
parsing-error
(condition).
unsupported-float-value
(condition).
yaml-error
(condition).
yaml.float
Handle IEEE floating point values.
common-lisp
.
*float-strategy*
(special variable).
negative-infinity
(function).
not-a-number
(function).
positive-infinity
(function).
*sbcl-nan-value*
(special variable).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Emit a value to a stream.
Emit a value using "pretty printing" settings
within the context of its own document.
Example:
(with-emitter-to-string (em)
(emit-pretty-as-document
em
(alexandria:plist-hash-table ’("a" t "b" 2.0 "moreducks" (c d e f)))
stream))
; =>
"—
a: true
b: 2.0
moreducks:
- C
- D
- E
- F
...
"
Emit a value to string.
Parse a YAML scalar string into a Lisp scalar value.
parsing-error
)) ¶Emit YAML representation of obj
Write the YAML corresponding to value to a stream.
hash-table
) stream) ¶Encode a hash table.
vector
) stream) ¶Encode a vector.
list
) stream) ¶Encode a list.
string
) stream) ¶Encode a string.
float
) stream) ¶Encode a float.
integer
) stream) ¶Encode an integer.
(eql nil)
) stream) ¶Encode false.
(eql t)
) stream) ¶Encode true.
parsing-error
)) ¶line
.
parsing-error
)) ¶Parse a YAML string or a pathname to a YAML file into Lisp data.
Convert a scalar object into its printed representation
double-float
)) ¶single-float
)) ¶integer
)) ¶string
)) ¶symbol
)) ¶(eql nil)
)) ¶(eql t)
)) ¶An error when parsing a YAML file.
This condition is signalled when the parser receives an IEEE
floating point special value it cannot parse. This is only signalled when the
floating point strategy is :error.
The base class of all YAML conditions.
condition
.
The falsehood constant. Nil by default.
The NULL constant. Nil by default.
Parse a YAML string, returning a list of tokens.
Jump to: | C D E F G L M N P R S W |
---|
Jump to: | C D E F G L M N P R S W |
---|
Jump to: | *
+
C L M S |
---|
Jump to: | *
+
C L M S |
---|
Jump to: | C E F M P S U Y |
---|
Jump to: | C E F M P S U Y |
---|