Coverage report: /home/ellis/comp/core/lib/dat/yaml.lisp
Kind | Covered | All | % |
expression | 0 | 36 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; yaml.lisp --- YAML serialization
3
;; YAML Ain't Markup Language
7
;; My least favorite markup format, but common enough to warrant reserving
10
;; The use-cases we have in mind are:
12
;; - Kubernetes :: https://kubernetes.io/docs/concepts/overview/working-with-objects/
14
;; - git*-ci :: https://docs.gitlab.com/ci/yaml/
16
;; ref: https://github.com/dtolnay/serde-yaml
18
;; ref: https://yaml.org/spec/1.2.2/
21
(in-package :dat/yaml)
23
(defun yaml-decode (string &key (start 0) end)
24
"Convert a YAML string into a Lisp object."
25
(with-input-from-string (stream string :start start :end end)
26
(values (yaml-read stream)
27
(file-position stream))))
29
(defmethod deserialize ((obj string) (format (eql :yaml)) &key (start 0) end)
30
(declare (ignore format))
31
(yaml-decode obj :start start :end end))
33
(defmethod deserialize ((obj pathname) (format (eql :yaml)) &key (start 0) end)
34
(declare (ignore format))
35
(with-open-file (f obj)
36
(yaml-decode obj :start start :end end)))
38
(defun yaml-read (stream &optional (eof-error-p t) eof-value)
39
"Read a YAML object from a stream."
40
(let ((c (peek-char t stream eof-error-p :eof)))