KDL reader/writer for Common Lisp.
(in-package :kdl-user)
(read-document stream) ; dispatches to `from-stream'
(read-document string) ; dispatches to `from-string'
(read-document filespec) ; dispatches to `from-file'
These getters all have setf
forms too.
(in-package :kdl-user)
;; Get the value from a value cons cell
(value value)
;; Get the type from a value cons cell
(value-type value)
;; Get the name of a property
(property-name property)
;; Get the value from a property
(property-value property)
;; Get the value-type from a property
(property-type property)
;; Get the name of a node
(node-name node)
;; Get the properties from a node
(node-properties node)
;; Get the children from a node
(node-children node)
;; get the second child
(node-child node 1)
;; Get the type of a node
(node-type node)
(in-package :kdl-user)
(to-stream kdl-document)
(to-string kdl-document)
(to-file kdl-document)
This implementation of KDL is spec-compliant, but the test-cases differ from the official test-cases is a few ways:
Like kdl-rs, multiple properties with the same name are allowed and all duplicated will be preserved.
Very big floats max out at *most-positive-double-float*
.
For example:
- Input
chubby-number 1e1000
- Output
chubby-number 1.7976931348623157e308
- Exponents use lowercase e
- official tests
1.1E-100
- :kdl/t
1.1e-100
- Positive exponents have no plus
- official tests
1.1E+100
- :kdl/t
1.1e100
- Non-integer numbers always have a decimal point:
- official tests
1E+100
- :kdl/t
1.0e100
The tests for the exponent formats are based on the output from SBCL. The
library works on at least GNU CLISP and ECL, but the floating point number
output is in a different format. For instance, ECL prints the floats in this
cute fashion: 1.e10
.
I haven’t been able to test on any other implementations yet because I can’t get them running on my computer :o(