std/yaml
YAML 1.2 and 1.1 as a format, written in TorbScript: Yaml reads and writes any Encode/Decode type, and
YamlNode is the tree of a document as it was written - anchors, aliases, tags, styles and comments included - for a
tool that changes one value of a file and writes the rest back as it was.
const yaml = Yaml()
const config = yaml.decode<Config>(text)?
print yaml.encode(config)
The target type resolves a scalar. no is the text "no" in a String field and an error in a Bool field,
so the surprises YAML is known for need no schema to be avoided. A document read without a type is resolved by a
YamlSchema - failsafe, JSON, core or YAML 1.1's types. A document that says %YAML 1.1 is read by 1.1's rules; the
merge key << is applied in every document. The writer writes YAML 1.2 and quotes every string a 1.1 reader would
read as something else, so what it writes reads the same under both versions.
Aliases are counted: expanding them stops at Yaml.aliasLimit nodes, so a document of nested aliases is an error
and not an exhausted memory. A local tag such as !point means a type only through YamlTag, because a program has
no reflection to find one by.
Modules
std/yaml/decoder[YamlDecoder]: aDecoderover an expanded YAML tree, in which the target type resolves each scalar.std/yaml/encoder[YamlEncoder]: anEncoderthat builds the YAML tree of a value, which the writer then writes.std/yaml/errorYamlError: what went wrong reading or writing YAML - text that is not YAML, a document whose content cannot be resolved (an unknown alias, an unknown tag, too many nodes behind its aliases), a document that does not fit the type it is decoded into, or bytes that are not UTF-8.std/yaml/nodeThe tree of a YAML document: every node with its tag, its anchor, its style, its comments and the position it starts at.std/yaml/resolveFrom the tree as it was written to what it means: aliases replaced by the nodes their anchors stand on, counted against a limit; merge keys applied; and a document without a type read into anEncodedValueby a schema.std/yaml/schemaWhat a scalar is: the schemas of the specification, which say what a plain scalar without a tag resolves to, and the readers of the texts every schema shares - null, truth values, whole numbers, floating point numbers, base64.std/yaml/yaml[Yaml], the format: a value with the options of YAML, which reads and writes typed values throughEncodeandDecode, reads documents into the tree of [YamlNode]s and writes that tree back, and frames a stream of documents forstd/stream.
Everything
- type
CollectionStyleHow a sequence or a mapping was written: indented lines, or brackets and braces. - type
ScalarStyleHow a scalar was written. - type
YamlYAML, with its options. - extend
Yaml with Format<YamlError>Everything a stream needs: a framer that finds where one document ends, and the ordinaryDecodefor the document itself. - type
YamlCommentsThe comments that belong to a node. - type
YamlContentWhat a node holds. - type
YamlDecoderADecoderover a YAML node whose aliases and merge keys are resolved already. - type
YamlDocumentOne document of a YAML stream: its root node, its directives, whether it was opened with---and closed with..., and the comments that stand before and after the root. - type
YamlEncoderAnEncoderthat builds a [YamlNode]. - type
YamlEntryOnekey: valueof a mapping. - type
YamlErrorWhat went wrong turning YAML text into a tree or a value. - extend
YamlError with From<Utf8Error>Whatchecked()needs to lift a broken byte sequence into the failure of a YAML stream. - type
YamlNodeOne node of a YAML document, as it was written. - type
YamlSchemaHow a plain scalar without a tag is read where no type says what it is. - type
YamlTagA local tag and the type it stands for. - type
YamlTagDirectiveA%TAGdirective: the handle!e!stands for the prefixtag:example.com,2000:. - type
YamlVersionThe version of YAML a document without a%YAMLdirective is read as.