Module yaml.dom
Search:
Group by:
This is the DOM API, which enables you to load YAML into a tree-like structure. It can also dump the structure back to YAML. Formally, it represents the Representation Graph as defined in the YAML specification.
The main interface of this API are loadDOM and dumpDOM. The other exposed procs are low-level and useful if you want to load or generate parts of a YamlStream.
Imports
Types
YamlNodeKind = enum yScalar, yMapping, ySequence
- Source
YamlNode = ref YamlNodeObj not nil
- Represents a node in a YamlDocument. Source
YamlNodeObj = object tag*: string case kind*: YamlNodeKind of yScalar: content*: string of ySequence: children*: seq[YamlNode] of yMapping: pairs*: seq[tuple[key, value: YamlNode]]
- Source
YamlDocument = object root*: YamlNode
- Represents a YAML document. Source
Procs
proc newYamlNode(content: string; tag: string = "?"): YamlNode {.
raises: [], tags: [].}- Source
proc newYamlNode(children: openArray[YamlNode]; tag: string = "?"): YamlNode {.
raises: [], tags: [].}- Source
proc newYamlNode(pairs: openArray[tuple[key, value: YamlNode]]; tag: string = "?"): YamlNode {.
raises: [], tags: [].}- Source
proc initYamlDoc(root: YamlNode): YamlDocument {.
raises: [], tags: [].}- Source
proc compose(s: var YamlStream; tagLib: TagLibrary): YamlDocument {.
raises: [YamlStreamError, YamlConstructionError], tags: [WriteIOEffect, RootEffect].}- Source
proc loadDOM[](s: Stream | string): YamlDocument {.
raises: [IOError, YamlParserError, YamlConstructionError].}- Source
proc serialize(doc: YamlDocument; tagLib: TagLibrary; a: AnchorStyle = asTidy): YamlStream {.
raises: [], tags: [RootEffect].}- Source
proc dumpDOM(doc: YamlDocument; target: Stream; anchorStyle: AnchorStyle = asTidy; options: PresentationOptions = defaultPresentationOptions) {.
raises: [ YamlPresenterJsonError, YamlPresenterOutputError, YamlStreamError], tags: [RootEffect, WriteIOEffect].}- Dump a YamlDocument as YAML character stream. Source