diff --git a/api.html b/api.html index fc95c0d..1c42246 100644 --- a/api.html +++ b/api.html @@ -11,9 +11,9 @@ -Fork me on GitHub +Fork me on GitHub
- NimYAML + NimYAML Home Testing Ground Docs: @@ -37,7 +37,11 @@

Dumping YAML

Dumping is preferredly done with dump, which serializes a native Nim variable to a character stream. Like load, you can use the steps involved separately.

You transform a variable into a YamlStream with represent. Depending on the AnchorStyle you specify, this will transform ref variables with multiple instances into anchored elements and aliases (for asTidy and asAlways) or write the same element into all places it occurs (for asNone). Be aware that if you use asNone, the value you serialize might not round-trip.

-

Transforming a YamlStream into YAML character data is done with present. You can choose from multiple presentation styles. psJson is not able to process some features of YamlStream s, the other styles support all features and are guaranteed to round-trip to the same YamlStream if you parse the generated YAML character stream again.

+

Transforming a YamlStream into YAML character data is done with present. You can choose from multiple presentation styles. psJson is not able to process some features of YamlStream s, the other styles support all features and are guaranteed to round-trip to the same YamlStream if you parse the generated YAML character stream again.

+ +

The Document Object Model

Much like XML, YAML also defines a document object model. If you cannot or do not want to load a YAML character stream to native Nim types, you can instead load it into a YamlDocument. This YamlDocument can also be serialized into a YAML character stream. All tags will be preserved exactly as they are when transforming from and to a YamlDocument. The only important thing to remember is that when a value has no tag, it will get the non-specific tag "!" for quoted scalars and "?" for all other nodes.

+

While tags are preserved, anchors will be resolved during loading and re-added during serialization. It is allowed for a YamlNode to occur multiple times within a YamlDocument, in which case it will be serialized once and referred to afterwards via aliases.

+

The document object model is provided for completeness, but you are encouraged to use native Nim types as start- or endpoint instead. That may be significantly faster, as every YamlNode is allocated on the heap and subject to garbage collection.

@@ -45,7 +49,7 @@ diff --git a/index.html b/index.html index 97e6ce5..8fa4000 100644 --- a/index.html +++ b/index.html @@ -11,9 +11,9 @@ -Fork me on GitHub +Fork me on GitHub
- NimYAML + NimYAML Home Testing Ground Docs: @@ -89,7 +89,7 @@ nimble install nimyaml diff --git a/processing.svg b/processing.svg index 8b62802..734b5d1 100644 --- a/processing.svg +++ b/processing.svg @@ -1,6 +1,6 @@ @@ -47,6 +47,16 @@ + + + + + + + + + + @@ -59,11 +69,11 @@ - + Application YAML - + Native @@ -73,7 +83,9 @@ Representation - not implemented + + YamlDocument + @@ -93,7 +105,7 @@ - + represent @@ -101,7 +113,9 @@ - serialize + + serialize + @@ -118,7 +132,9 @@ - compose + + compose + @@ -129,7 +145,7 @@ - + @@ -151,7 +167,19 @@ dump - + + + + dumpDOM + + + + + + loadDOM + + + load diff --git a/serialization.html b/serialization.html index c906865..8dea750 100644 --- a/serialization.html +++ b/serialization.html @@ -11,9 +11,9 @@ -Fork me on GitHub +Fork me on GitHub
- NimYAML + NimYAML Home Testing Ground Docs: @@ -129,7 +129,7 @@ diff --git a/testing.html b/testing.html index 9a9924d..553668f 100644 --- a/testing.html +++ b/testing.html @@ -12,7 +12,7 @@
- NimYAML + NimYAML Home Testing Ground Docs: diff --git a/yaml.html b/yaml.html index 8eb9e33..1c12d2f 100644 --- a/yaml.html +++ b/yaml.html @@ -11,9 +11,9 @@ -Fork me on GitHub +Fork me on GitHub
- NimYAML + NimYAML Home Testing Ground Docs: @@ -102,10 +102,26 @@ refs: Table[AnchorId, pointer]">ConstructionContext
  • SerializationContext
  • + refs: Table[pointer, AnchorId] + style: AnchorStyle + nextAnchorId: AnchorId">SerializationContext
  • RawYamlStream
  • +
  • YamlNodeKind
  • +
  • YamlNode
  • +
  • YamlNodeObj
  • +
  • YamlDocument
  • dump
  • +
  • newYamlNode
  • +
  • newYamlNode
  • +
  • newYamlNode
  • +
  • initYamlDoc
  • +
  • compose
  • +
  • loadDOM
  • +
  • serialize
  • +
  • dumpDOM
  • @@ -474,7 +507,7 @@ yTypeUnknown*   Source
    YamlStreamEventKind = enum
    @@ -483,7 +516,7 @@ class="link-seesrc" target="_blank">Source
     
    Kinds of YAML events that may occur in an YamlStream. Event kinds are discussed in YamlStreamEvent.   Source
    TagId = distinct int
    @@ -493,7 +526,7 @@ A TagId identifies a

    URI strings are mapped to TagId s for efficiency reasons (you do not need to compare strings every time) and to be able to discover unknown tag URIs early in the parsing process.

      Source
    AnchorId = distinct int
    @@ -501,7 +534,7 @@ class="link-seesrc" target="_blank">Source An AnchorId identifies an anchor in the current document. It becomes invalid as soon as the current document scope is invalidated (for example, because the parser yielded a yamlEndDocument event). AnchorId s exists because of efficiency, much like TagId s. The actual anchor name is a presentation detail and cannot be queried by the user.   Source
    YamlStreamEvent = object
    @@ -531,7 +564,7 @@ class="link-seesrc" target="_blank">Source
     

    A non-existing tag in the YAML character stream will be resolved to the non-specific tags ? or ! according to the YAML specification. These are by convention mapped to the TagId s yTagQuestionMark and yTagExclamationMark respectively. Mapping is done by a TagLibrary.

      Source
    YamlStream = object
    @@ -545,7 +578,7 @@ A YamlStream is an it
     

    The creator of a YamlStream is responsible for it being well-formed. A user of the stream may assume that it is well-formed and is not required to check for it. The procs in this module will always yield a well-formed YamlStream and expect it to be well-formed if it's an input.

      Source
    TagLibrary = ref object
    @@ -559,7 +592,7 @@ class="link-seesrc" target="_blank">Source
     

    You can base your tag library on common tag libraries by initializing them with initFailsafeTagLibrary, initCoreTagLibrary or initExtendedTagLibrary.

      Source
    WarningCallback = proc (line, column: int; lineContent: string; message: string)
    @@ -569,7 +602,7 @@ Callback for parser warnings. Currently, this callback may be called on two occa   Source
    YamlParser = ref object
    @@ -582,7 +615,7 @@ class="link-seesrc" target="_blank">Source
     
    A parser object. Retains its TagLibrary across calls to parse. Can be used to access anchor names while parsing a YAML character stream, but only until the document goes out of scope (i.e. until yamlEndDocument is yielded).   Source
    PresentationStyle = enum
    @@ -596,7 +629,7 @@ Different styles for YAML character stream output.
    •   Source
      TagStyle = enum
      @@ -611,7 +644,7 @@ Whether object should be serialized with explicit tags.
      •   Source
        AnchorStyle = enum
        @@ -632,7 +665,7 @@ How ref object should be serialized.
          Source
        ConstructionContext = ref object
        @@ -641,17 +674,18 @@ class="link-seesrc" target="_blank">Source
         
        Context information for the process of constructing Nim values from YAML.   Source
        SerializationContext = ref object
        -  refsList: seq[RefNodeData]
        +  refs: Table[pointer, AnchorId]
           style: AnchorStyle
        +  nextAnchorId: AnchorId
         
        Context information for the process of serializing YAML from Nim values.   Source
        RawYamlStream = iterator (): YamlStreamEvent {.raises: [].}
        @@ -659,7 +693,44 @@ class="link-seesrc" target="_blank">Source Stream of YamlStreamEvent``s returned by ``representObject procs.   Source + +
        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
        YamlLoadingError = object of Exception
        @@ -674,7 +745,7 @@ class="link-seesrc" target="_blank">Source
         
        Base class for all exceptions that may be raised during the process of loading a YAML character stream.   Source
        YamlParserError = object of YamlLoadingError
        @@ -693,7 +764,7 @@ class="link-seesrc" target="_blank">Source
         

        Some elements in this list are vague. For a detailed description of a valid YAML character stream, see the YAML specification.

          Source
        YamlPresenterJsonError = object of Exception
        @@ -704,7 +775,7 @@ Exception that may be raised by the YAML presenter when it is instructed to outp
         
        Source
      YamlPresenterOutputError = object of Exception
      @@ -712,7 +783,7 @@ class="link-seesrc" target="_blank">Source
       
      Exception that may be raised by the YAML presenter. This occurs if writing character data to the output stream raises any exception. The error that has occurred is available from parent.   Source
      YamlStreamError = object of Exception
      @@ -720,7 +791,7 @@ class="link-seesrc" target="_blank">Source
       
      Exception that may be raised by a YamlStream when the underlying backend raises an exception. The error that has occurred is available from parent.   Source
      YamlConstructionError = object of YamlLoadingError
      @@ -728,7 +799,7 @@ class="link-seesrc" target="_blank">Source
       
      Exception that may be raised when constructing data objects from a YamlStream. The fields line, column and lineContent are only available if the costructing proc also does parsing, because otherwise this information is not available to the costruction proc.   Source
      @@ -743,7 +814,7 @@ contains all local tags that are used for type serialization. Does not contain a

      Should not be modified manually. Will be extended by serializable.

        Source @@ -755,77 +826,77 @@ class="link-seesrc" target="_blank">Source
        Source
      yTagNimInt8 = registerUri(serializationTagLibrary, "!nim:system:int8")
        Source
      yTagNimInt16 = registerUri(serializationTagLibrary, "!nim:system:int16")
        Source
      yTagNimInt32 = registerUri(serializationTagLibrary, "!nim:system:int32")
        Source
      yTagNimInt64 = registerUri(serializationTagLibrary, "!nim:system:int64")
        Source
      yTagNimUInt8 = registerUri(serializationTagLibrary, "!nim:system:uint8")
        Source
      yTagNimUInt16 = registerUri(serializationTagLibrary, "!nim:system:uint16")
        Source
      yTagNimUInt32 = registerUri(serializationTagLibrary, "!nim:system:uint32")
        Source
      yTagNimUInt64 = registerUri(serializationTagLibrary, "!nim:system:uint64")
        Source
      yTagNimFloat32 = registerUri(serializationTagLibrary, "!nim:system:float32")
        Source
      yTagNimFloat64 = registerUri(serializationTagLibrary, "!nim:system:float64")
        Source
      @@ -837,14 +908,14 @@ class="link-seesrc" target="_blank">Source
      ! non-specific tag   Source
      yTagQuestionMark: TagId = 1
      ? non-specific tag   Source
      yTagString: TagId = 2
      @@ -852,7 +923,7 @@ class="link-seesrc" target="_blank">Source !!str tag   Source
      yTagSequence: TagId = 3
      @@ -860,7 +931,7 @@ class="link-seesrc" target="_blank">Source !!seq tag   Source
      yTagMap: TagId = 4
      @@ -868,7 +939,7 @@ class="link-seesrc" target="_blank">Source !!map tag   Source
      yTagNull: TagId = 5
      @@ -876,7 +947,7 @@ class="link-seesrc" target="_blank">Source !!null tag   Source
      yTagBoolean: TagId = 6
      @@ -884,7 +955,7 @@ class="link-seesrc" target="_blank">Source !!bool tag   Source
      yTagInteger: TagId = 7
      @@ -892,7 +963,7 @@ class="link-seesrc" target="_blank">Source !!int tag   Source
      yTagFloat: TagId = 8
      @@ -900,7 +971,7 @@ class="link-seesrc" target="_blank">Source !!float tag   Source
      yTagOrderedMap: TagId = 9
      @@ -908,7 +979,7 @@ class="link-seesrc" target="_blank">Source !!omap tag   Source
      yTagPairs: TagId = 10
      @@ -916,7 +987,7 @@ class="link-seesrc" target="_blank">Source !!pairs tag   Source
      yTagSet: TagId = 11
      @@ -924,7 +995,7 @@ class="link-seesrc" target="_blank">Source !!set tag   Source
      yTagBinary: TagId = 12
      @@ -932,7 +1003,7 @@ class="link-seesrc" target="_blank">Source !!binary tag   Source
      yTagMerge: TagId = 13
      @@ -940,7 +1011,7 @@ class="link-seesrc" target="_blank">Source !!merge tag   Source
      yTagTimestamp: TagId = 14
      @@ -948,7 +1019,7 @@ class="link-seesrc" target="_blank">Source !!timestamp tag   Source
      yTagValue: TagId = 15
      @@ -956,7 +1027,7 @@ class="link-seesrc" target="_blank">Source !!value tag   Source
      yTagYaml: TagId = 16
      @@ -964,7 +1035,7 @@ class="link-seesrc" target="_blank">Source !!yaml tag   Source
      yFirstCustomTagId: TagId = 1000
      @@ -972,7 +1043,7 @@ class="link-seesrc" target="_blank">Source The first TagId which should be assigned to an URI that does not exist in the YamlTagLibrary which is used for parsing.   Source
      yAnchorNone: AnchorId = -1
      @@ -980,14 +1051,14 @@ class="link-seesrc" target="_blank">Source yielded when no anchor was defined for a YAML node   Source
      yamlTagRepositoryPrefix = "tag:yaml.org,2002:"
        Source
      @@ -999,63 +1070,63 @@ class="link-seesrc" target="_blank">Source
        Source
      proc hash(id: TagId): Hash {.borrow.}
        Source
      proc `==`(left, right: AnchorId): bool {.borrow.}
        Source
      proc `$`(id: AnchorId): string {.borrow.}
        Source
      proc hash(id: AnchorId): Hash {.borrow.}
        Source
      proc `$`(id: TagId): string {.raises: [], tags: [].}
        Source
      proc initTagLibrary(): TagLibrary {.raises: [], tags: [].}
      initializes the tags table and sets nextCustomTagId to yFirstCustomTagId.   Source
      proc registerUri(tagLib: TagLibrary; uri: string): TagId {.raises: [], tags: [].}
      registers a custom tag URI with a TagLibrary. The URI will get the TagId nextCustomTagId, which will be incremented.   Source
      proc uri(tagLib: TagLibrary; id: TagId): string {.raises: [KeyError], tags: [].}
      retrieve the URI a TagId maps to.   Source
      proc initFailsafeTagLibrary(): TagLibrary {.raises: [], tags: [].}
      @@ -1068,7 +1139,7 @@ Contains only:
      • Source
        proc initCoreTagLibrary(): TagLibrary {.raises: [], tags: [].}
        @@ -1080,7 +1151,7 @@ Contains everything in initFailsa
        Source
      proc initExtendedTagLibrary(): TagLibrary {.raises: [], tags: [].}
      @@ -1096,35 +1167,35 @@ Contains everything from initCore
      Source
    proc `==`(left: YamlStreamEvent; right: YamlStreamEvent): bool {.raises: [], tags: [].}
    compares all existing fields of the given items   Source
    proc `$`(event: YamlStreamEvent): string {.raises: [], tags: [].}
    outputs a human-readable string describing the given event   Source
    proc startDocEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
      Source
    proc endDocEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
      Source
    proc startMapEvent(tag: TagId = yTagQuestionMark; anchor: AnchorId = yAnchorNone): YamlStreamEvent {.
    @@ -1132,14 +1203,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc endMapEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
      Source
    proc startSeqEvent(tag: TagId = yTagQuestionMark; anchor: AnchorId = yAnchorNone): YamlStreamEvent {.
    @@ -1147,14 +1218,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc endSeqEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
      Source
    proc scalarEvent(content: string = ""; tag: TagId = yTagQuestionMark;
    @@ -1163,14 +1234,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc aliasEvent(anchor: AnchorId): YamlStreamEvent {.inline, raises: [], tags: [].}
      Source
    proc constructJson(s: var YamlStream): seq[JsonNode] {.
    @@ -1180,15 +1251,14 @@ class="link-seesrc" target="_blank">Source
     

    Warning: The special float values [+-]Inf and NaN will be parsed into Nim's JSON structure without error. However, they cannot be rendered to a JSON character stream, because these values are not part of the JSON specification. Nim's JSON implementation currently does not check for these values and will output invalid JSON when rendering one of these values into a JSON character stream.

      Source -
    proc loadToJson(s: Stream): seq[JsonNode] {.raises: [IOError, YamlParserError,
    -    YamlConstructionError, OutOfMemError], tags: [RootEffect].}
    +
    proc loadToJson(s: Stream): seq[JsonNode] {.raises: [], tags: [RootEffect].}
    Uses YamlParser and constructJson to construct an in-memory JSON tree from a YAML character stream.   Source
    proc present(s: var YamlStream; target: Stream; tagLib: TagLibrary;
    @@ -1198,24 +1268,24 @@ class="link-seesrc" target="_blank">Source
     
    Convert s to a YAML character stream and write it to target.   Source
    proc transform(input: Stream; output: Stream; style: PresentationStyle;
                   indentationStep: int = 2) {.raises: [IOError, YamlParserError,
    -    YamlPresenterJsonError, YamlPresenterOutputError, OutOfMemError],
    +    YamlPresenterJsonError, YamlPresenterOutputError],
                                           tags: [RootEffect, WriteIOEffect].}
    Parser input as YAML character stream and then dump it to output while resolving non-specific tags to the ones in the YAML core tag library.   Source
    proc guessType(scalar: string): TypeHint {.raises: [], tags: [].}
    Parse scalar string according to the RegEx table documented at TypeHint.   Source
    proc newYamlParser(tagLib: TagLibrary = initExtendedTagLibrary();
    @@ -1223,28 +1293,28 @@ class="link-seesrc" target="_blank">Source
     
    Creates a YAML parser. if callback is not nil, it will be called whenever the parser yields a warning.   Source
    proc getLineNumber(p: YamlParser): int {.raises: [], tags: [].}
    Get the line number (1-based) of the recently yielded parser token. Useful for error reporting at later loading stages.   Source
    proc getColNumber(p: YamlParser): int {.raises: [], tags: [].}
    Get the column number (1-based) of the recently yielded parser token. Useful for error reporting at later parsing stages.   Source
    proc getLineContent(p: YamlParser; marker: bool = true): string {.raises: [], tags: [].}
    Get the content of the input line containing the recently yielded parser token. Useful for error reporting at later parsing stages. The line will be terminated by "\n". If marker is true, a second line will be returned containing a ^ at the position of the recent parser token.   Source
    proc parse(p: YamlParser; s: Stream): YamlStream {.raises: [],
    @@ -1252,7 +1322,7 @@ class="link-seesrc" target="_blank">Source
     
    Parse the given stream as YAML character stream.   Source
    proc initYamlStream(backend: iterator (): YamlStreamEvent): YamlStream {.raises: [],
    @@ -1260,7 +1330,7 @@ class="link-seesrc" target="_blank">Source
     
    Creates a new YamlStream that uses the given iterator as backend.   Source
    proc next(s: var YamlStream): YamlStreamEvent {.raises: [YamlStreamError],
    @@ -1268,7 +1338,7 @@ class="link-seesrc" target="_blank">Source
     
    Get the next item of the stream. Requires finished(s) == true. If the backend yields an exception, that exception will be encapsulated into a YamlStreamError, which will be raised.   Source
    proc peek(s: var YamlStream): YamlStreamEvent {.raises: [YamlStreamError],
    @@ -1276,21 +1346,21 @@ class="link-seesrc" target="_blank">Source
     
    Get the next item of the stream without advancing the stream. Requires finished(s) == true. Handles exceptions of the backend like next().   Source
    proc peek=(s: var YamlStream; value: YamlStreamEvent) {.raises: [], tags: [].}
    Set the next item of the stream. Will replace a previously peeked item, if one exists.   Source
    proc finished(s: var YamlStream): bool {.raises: [YamlStreamError], tags: [RootEffect].}
    true if no more items are available in the stream. Handles exceptions of the backend like next().   Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1298,7 +1368,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1306,7 +1376,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1314,7 +1384,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1322,7 +1392,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1330,7 +1400,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1338,7 +1408,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1346,7 +1416,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1354,7 +1424,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1362,7 +1432,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1370,7 +1440,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: (system.[]|tables.[]|tables.[]|json.[]|tables.[]|tables.[]|system.[]|json.[]|tables.[]|system.[]|tables.[]|system.[]|system.[]|tables.[]|macros.[]|tables.[]|tables.[]|...)(
    @@ -1378,21 +1448,21 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc lazyLoadTag(uri: string): TagId {.inline, raises: [], tags: [].}
    Internal function. Do not call explicitly.   Source
    proc safeTagUri(id: TagId): string {.raises: [], tags: [].}
    Internal function. Do not call explicitly.   Source
    proc constructChild[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
    @@ -1400,7 +1470,7 @@ class="link-seesrc" target="_blank">Source
     
    Used for implementing constructObject on a non-scalar type. Call it for constructing child values of the object that is constructed. It will ensure correct tag and anchor on the input stream for the child object and then call constructObject on the child object.   Source
    proc constructChild[O](s: var YamlStream; c: ConstructionContext; result: var ref O) {.
    @@ -1408,14 +1478,14 @@ class="link-seesrc" target="_blank">Source
     
    Used for implementing constructObject on a non-scalar type. Call it for constructing child values of the object that is constructed. It will handle anchors, aliases and nil values, and then call constructChild on the base type.   Source
    proc yamlTag[](T: typedesc[string]): TagId {.inline, noSideEffect, raises: [].}
      Source
    proc constructObject(s: var YamlStream; c: ConstructionContext; result: var string) {.
    @@ -1423,7 +1493,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject(value: string; ts: TagStyle = tsNone; c: SerializationContext): RawYamlStream {.
    @@ -1431,7 +1501,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
    @@ -1439,7 +1509,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[T](value: T; ts: TagStyle = tsNone; c: SerializationContext): RawYamlStream {.
    @@ -1447,7 +1517,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
    @@ -1455,7 +1525,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[T](value: T; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1463,7 +1533,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
    @@ -1471,7 +1541,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[T](value: T; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1479,14 +1549,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[](T: typedesc[bool]): TagId {.inline, raises: [].}
      Source
    proc constructObject(s: var YamlStream; c: ConstructionContext; result: var bool) {.
    @@ -1494,7 +1564,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject(value: bool; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1502,7 +1572,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject(s: var YamlStream; c: ConstructionContext; result: var char) {.
    @@ -1510,7 +1580,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject(value: char; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1518,14 +1588,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[I, ](T: typedesc[seq[I]]): TagId {.inline, raises: [].}
      Source
    proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var seq[T]) {.
    @@ -1533,7 +1603,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[T](value: seq[T]; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1541,14 +1611,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[K, V, ](T: typedesc[Table[K, V]]): TagId {.inline, raises: [].}
      Source
    proc constructObject[K, V](s: var YamlStream; c: ConstructionContext;
    @@ -1557,7 +1627,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[K, V](value: Table[K, V]; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1565,7 +1635,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject[O](s: var YamlStream; c: ConstructionContext; result: var O) {.
    @@ -1573,7 +1643,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[O](value: O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1581,7 +1651,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc constructObject[O](s: var YamlStream; c: ConstructionContext; result: var O) {.
    @@ -1589,7 +1659,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc representObject[O](value: O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1597,14 +1667,14 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc yamlTag[O, ](T: typedesc[ref O]): TagId {.inline, raises: [].}
      Source
    proc constructChild[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
    @@ -1612,7 +1682,7 @@ class="link-seesrc" target="_blank">Source
     
    Used for implementing constructObject on a non-scalar type. Call it for constructing child values of the object that is constructed. It will ensure correct tag and anchor on the input stream for the child object and then call constructObject on the child object.   Source
    proc constructChild[O](s: var YamlStream; c: ConstructionContext; result: var ref O) {.
    @@ -1620,7 +1690,7 @@ class="link-seesrc" target="_blank">Source
     
    Used for implementing constructObject on a non-scalar type. Call it for constructing child values of the object that is constructed. It will handle anchors, aliases and nil values, and then call constructChild on the base type.   Source
    proc representObject[O](value: ref O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
    @@ -1628,7 +1698,7 @@ class="link-seesrc" target="_blank">Source
     
      Source
    proc construct[T](s: var YamlStream; target: var T) {.
    @@ -1636,7 +1706,7 @@ class="link-seesrc" target="_blank">Source
     
    Construct a Nim value from a YAML stream.   Source
    proc load[K](input: Stream; target: var K) {.raises: [YamlConstructionError, IOError,
    @@ -1644,7 +1714,7 @@ class="link-seesrc" target="_blank">Source
     
    Load a Nim value from a YAML character stream.   Source
    proc represent[T](value: T; ts: TagStyle = tsRootOnly; a: AnchorStyle = asTidy): YamlStream {.
    @@ -1652,7 +1722,7 @@ class="link-seesrc" target="_blank">Source
     
    Represent a Nim value as YamlStream.   Source
    proc dump[K](value: K; target: Stream; style: PresentationStyle = psDefault;
    @@ -1662,7 +1732,71 @@ class="link-seesrc" target="_blank">Source
     
    Dump a Nim value as YAML character stream.   Source +
    +
    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: [RootEffect].}
    +
    + +  Source +
    +
    proc loadDOM(s: Stream): YamlDocument {.raises: [IOError, YamlParserError,
    +    YamlConstructionError], tags: [RootEffect, ReadIOEffect].}
    +
    + +  Source +
    +
    proc serialize(doc: YamlDocument; tagLib: TagLibrary; a: AnchorStyle = asTidy): YamlStream {.
    +    raises: [], tags: [RootEffect].}
    +
    + +  Source +
    +
    proc dumpDOM(doc: YamlDocument; target: Stream; style: PresentationStyle = psDefault;
    +            anchorStyle: AnchorStyle = asTidy; indentationStep: int = 2) {.
    +    raises: [YamlPresenterJsonError, YamlPresenterOutputError],
    +    tags: [RootEffect, WriteIOEffect].}
    +
    +Dump a YamlDocument as YAML character stream. +  Source
    @@ -1675,7 +1809,7 @@ class="link-seesrc" target="_blank">Source
    Iterate over all items of the stream. You may not use peek() on the stream while iterating.   Source
    @@ -1687,21 +1821,21 @@ class="link-seesrc" target="_blank">Source
      Source
    template setTagUriForType[](t: typedesc; uri: string): stmt
    Associate the given uri with a certain type. This uri is used as YAML tag when loading and dumping values of this type.   Source
    template setTagUriForType[](t: typedesc; uri: string; idName: expr): stmt
    Like setTagUriForType, but lets you choose a symbol for the TagId of the uri. This is only necessary if you want to implement serialization / construction yourself.   Source
    template constructScalarItem(bs: var YamlStream; item: YamlStreamEvent; name: string;
    @@ -1709,63 +1843,63 @@ class="link-seesrc" target="_blank">Source
     
      Source
    template constructObject(s: var YamlStream; c: ConstructionContext; result: var int)
      Source
    template representObject(value: int; tagStyle: TagStyle; c: SerializationContext): RawYamlStream
      Source
    template constructObject(s: var YamlStream; c: ConstructionContext; result: var uint)
      Source
    template representObject(value: uint; ts: TagStyle; c: SerializationContext): RawYamlStream
      Source
    template constructObject(s: var YamlStream; c: ConstructionContext; result: var float)
      Source
    template representObject(value: float; tagStyle: TagStyle; c: SerializationContext): RawYamlStream
      Source
    template yamlTag[](T: typedesc[object | enum]): expr
      Source
    template yamlTag[](T: typedesc[tuple]): expr
      Source
    @@ -1778,7 +1912,7 @@ class="link-seesrc" target="_blank">Source