{"size": 1097, "ext": "scrbl", "max_stars_repo_path": "doc/utils/text/yaml.scrbl", "max_stars_repo_name": "christoff-buerger/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": "2015-11-07T07:13:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T03:35:14.000Z", "max_issues_repo_path": "doc/utils/text/yaml.scrbl", "max_issues_repo_name": "christoff-buerger/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": "2016-04-28T21:59:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:42:21.000Z", "max_forks_repo_path": "doc/utils/text/yaml.scrbl", "max_forks_repo_name": "christoff-buerger/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": "2016-12-28T12:41:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-26T20:52:02.000Z"}
{"max_stars_count": 39, "max_issues_count": 3, "max_forks_count": 4, "avg_line_length": 20.6981132075, "max_line_length": 74, "alphanum_fraction": 0.6663628077}
@; -*- mode:scribble; coding: utf-8 -*-

@subsection[:tag "text.yaml"]{(text yaml) -- YAML parser}

@define[Library]{@name{(text yaml)}}
@desc{This library provides YAML parser and writer.}

@define[Function]{@name{yaml-read} @args{in}}
@desc{Reads YAML documents from the given textual input port @var{in} and
returns a list of S-expression represented YAML documents.

The returning YAML documents are the compatible with vector JSON
format described in @secref["text.json"]{(text json)}.

@codeblock[=> '(#(("foo" . "bar") ("boo" 1 2 3 4)))]{
(yaml-read (open-string-input-port "
%YAML 1.2
---
foo: bar
boo:
- 1
- 2
- 3
- 4"))
}
}

@define[Function]{@name{yaml-write} @args{yaml}}
@define[Function]{@name{yaml-write} @args{yaml out}}
@desc{Writes the given list of S-expression represented YAML documents
@var{yaml} to the @var{out}.

If the first form is used, then it writes to @code{(current-output-port)}.

@codeblock{
(yaml-write '(#(("foo" . "bar") ("boo" 1 2 3 4))))
;; Prints the following
#|
%YAML 1.2
---
foo: bar
boo:
- 1
- 2
- 3
- 4
...
|#
}
}

@; TBD custom builder and serializer
