From 5a500d7bb826c2c4a3521e6d660b08f7215a4f77 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Fri, 25 Mar 2016 23:12:52 +0100 Subject: [PATCH] Updated from master --- index.html | 73 +++++++- yaml.html | 502 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 361 insertions(+), 214 deletions(-) diff --git a/index.html b/index.html index a366918..2a12225 100644 --- a/index.html +++ b/index.html @@ -164,11 +164,11 @@ right: *b var s = newFileStream("out.yaml", fmWrite) dump(mob, s, options = defineOptions(tagStyle = tsAll)) -s.close()
%YAML 1.2
+s.close()
YAML 1.2
 --- !Mob
-!!str level: !nim:system:int32 42
-!!str experience: !nim:system:int32 1800
-!!str drops: !Drops [!!str Sword of Mob Slaying]
+!nim:field level: !nim:system:int32 42 +!nim:field experience: !nim:system:int32 1800 +!nim:field drops: !Drops [!!str Sword of Mob Slaying]

Dumping Nim objects as JSON

code.nim out.yaml
import yaml
 type Person = object
@@ -214,13 +214,76 @@ right: *b
"age": 12 } ] +

Processing a Sequence of Heterogeneous Items

+ +
code.nimin.yaml
import yaml
+type Person = object
+  name: string
+
+setTagUriForType(Person, "!nim:demo:Person",
+                 yTagPerson)
+
+var
+  s = newFileStream("in.yaml", fmRead)
+  context = newConstructionContext()
+  parser = newYamlParser(serializationTagLibrary)
+  events = parser.parse(s)
+
+assert events.next().kind == yamlStartDoc
+assert events.next().kind == yamlStartSeq
+var nextEvent = events.peek()
+while nextEvent.kind != yamlEndSeq:
+  var curTag = nextEvent.tag()
+  if curTag == yTagQuestionMark:
+    # we only support implicitly tagged scalar events
+    assert nextEvent.kind == yamlScalar
+    case guessType(nextEvent.scalarContent)
+    of yTypeInteger: curTag = yTagInteger
+    of yTypeBoolTrue, yTypeBoolFalse:
+      curTag = yTagBoolean
+    of yTypeUnknown: curTag = yTagString
+    else: assert false, "Type not supported!"
+  elif curTag == yTagExclamationMark:
+    curTag = yTagString
+  case curTag
+  of yTagString:
+    var s: string
+    events.constructChild(context, s)
+    echo "got string: ", s
+  of yTagInteger:
+    var i: int32
+    events.constructChild(context, i)
+    echo "got integer: ", i
+  of yTagBoolean:
+    var b: bool
+    events.constructChild(context, b)
+    echo "got boolean: ", b
+  else:
+    # non-standard tag ids are not available
+    # at compile time
+    if curTag == yTagPerson:
+      var p: Person
+      events.constructChild(context, p)
+      echo "got Person with name: ", p.name
+    else: assert false, "unsupported tag: " & $curTag
+  nextEvent = events.peek()
+assert events.next().kind == yamlEndSeq
+assert events.next().kind == yamlEndDoc
+assert events.finished()
+s.close()
%YAML 1.2
+--- !!seq
+- this is a string
+- 42
+- false
+- !!str 23
+- !nim:demo:Person {name: Trillian}
diff --git a/yaml.html b/yaml.html index 67f1c0b..b16c928 100644 --- a/yaml.html +++ b/yaml.html @@ -229,6 +229,8 @@ title="yTagValue: TagId = 15">yTagValue
  • yTagYaml
  • +
  • yTagNimField
  • yFirstCustomTagId
  • `==`
  • `$`
  • +
  • tag
  • startDocEvent
  • peek=
  • finished
  • +
  • newConstructionContext
  • +
  • newSerializationContext
  • yamlTag
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • yamlTag
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • yamlTag
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • yamlTag
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • +
  • yamlTag
  • +
  • constructObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • yamlTag
  • constructChild
  • constructChild
  • -
  • representObject
  • +
  • representChild
  • +
  • representChild
  • construct
  • constructScalarItem
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • constructObject
  • -
  • representObject
  • +
  • representObject
  • yamlTag
  • yTypeUnknown*   Source
    YamlStreamEventKind = enum
    @@ -515,7 +534,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
    @@ -525,7 +544,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
    @@ -533,7 +552,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
    @@ -563,7 +582,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
    @@ -577,7 +596,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 they take it as input parameter.

      Source
    TagLibrary = ref object
    @@ -591,7 +610,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)
    @@ -601,7 +620,7 @@ Callback for parser warnings. Currently, this callback may be called on two occa   Source
    YamlParser = ref object
    @@ -614,7 +633,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
    @@ -628,7 +647,7 @@ Different styles for YAML character stream output.
    •   Source
      TagStyle = enum
      @@ -640,7 +659,7 @@ Whether object should be serialized with explicit tags.
      •   Source
        AnchorStyle = enum
        @@ -652,7 +671,7 @@ How ref object should be serialized.
        • Source
          NewLineStyle = enum
          @@ -664,7 +683,7 @@ What kind of newline sequence is used when presenting.
          •   Source
            OutputYamlVersion = enum
            @@ -674,7 +693,7 @@ class="link-seesrc" target="_blank">Source
             

            It is also possible to specify that the presenter shall not emit any YAML version. The generated content is then guaranteed to be valid YAML 1.1 and 1.2 (but not 1.0 or any newer YAML version).

              Source
            PresentationOptions = object
            @@ -686,7 +705,7 @@ class="link-seesrc" target="_blank">Source
             
            Options for generating a YAML character stream   Source
            ConstructionContext = ref object
            @@ -695,7 +714,7 @@ class="link-seesrc" target="_blank">Source
             
            Context information for the process of constructing Nim values from YAML.   Source
            SerializationContext = ref object
            @@ -706,7 +725,7 @@ class="link-seesrc" target="_blank">Source
             
            Context information for the process of serializing YAML from Nim values.   Source
            RawYamlStream = iterator (): YamlStreamEvent {.raises: [].}
            @@ -714,7 +733,7 @@ class="link-seesrc" target="_blank">Source Stream of YamlStreamEvent``s returned by ``representObject procs.   Source
            YamlNodeKind = enum
            @@ -722,14 +741,14 @@ class="link-seesrc" target="_blank">Source
             
              Source
            YamlNode = ref YamlNodeObj not nil
            Represents a node in a YamlDocument.   Source
            YamlNodeObj = object
            @@ -742,7 +761,7 @@ class="link-seesrc" target="_blank">Source
             
              Source
            YamlDocument = object
            @@ -751,7 +770,7 @@ class="link-seesrc" target="_blank">Source
             
            Represents a YAML document.   Source
            YamlLoadingError = object of Exception
            @@ -766,7 +785,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
            @@ -785,7 +804,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
            @@ -796,7 +815,7 @@ Exception that may be raised by the YAML presenter when it is instructed to outp
             
            Source
          YamlPresenterOutputError = object of Exception
          @@ -804,7 +823,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
          @@ -812,7 +831,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
          @@ -820,7 +839,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
          @@ -835,7 +854,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 @@ -847,77 +866,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
          @@ -929,14 +948,14 @@ class="link-seesrc" target="_blank">Source
          ! non-specific tag   Source
          yTagQuestionMark: TagId = 1
          ? non-specific tag   Source
          yTagString: TagId = 2
          @@ -944,7 +963,7 @@ class="link-seesrc" target="_blank">Source !!str tag   Source
          yTagSequence: TagId = 3
          @@ -952,7 +971,7 @@ class="link-seesrc" target="_blank">Source !!seq tag   Source
          yTagMapping: TagId = 4
          @@ -960,7 +979,7 @@ class="link-seesrc" target="_blank">Source !!map tag   Source
          yTagNull: TagId = 5
          @@ -968,7 +987,7 @@ class="link-seesrc" target="_blank">Source !!null tag   Source
          yTagBoolean: TagId = 6
          @@ -976,7 +995,7 @@ class="link-seesrc" target="_blank">Source !!bool tag   Source
          yTagInteger: TagId = 7
          @@ -984,7 +1003,7 @@ class="link-seesrc" target="_blank">Source !!int tag   Source
          yTagFloat: TagId = 8
          @@ -992,7 +1011,7 @@ class="link-seesrc" target="_blank">Source !!float tag   Source
          yTagOrderedMap: TagId = 9
          @@ -1000,7 +1019,7 @@ class="link-seesrc" target="_blank">Source !!omap tag   Source
          yTagPairs: TagId = 10
          @@ -1008,7 +1027,7 @@ class="link-seesrc" target="_blank">Source !!pairs tag   Source
          yTagSet: TagId = 11
          @@ -1016,7 +1035,7 @@ class="link-seesrc" target="_blank">Source !!set tag   Source
          yTagBinary: TagId = 12
          @@ -1024,7 +1043,7 @@ class="link-seesrc" target="_blank">Source !!binary tag   Source
          yTagMerge: TagId = 13
          @@ -1032,7 +1051,7 @@ class="link-seesrc" target="_blank">Source !!merge tag   Source
          yTagTimestamp: TagId = 14
          @@ -1040,7 +1059,7 @@ class="link-seesrc" target="_blank">Source !!timestamp tag   Source
          yTagValue: TagId = 15
          @@ -1048,7 +1067,7 @@ class="link-seesrc" target="_blank">Source !!value tag   Source
          yTagYaml: TagId = 16
          @@ -1056,7 +1075,15 @@ class="link-seesrc" target="_blank">Source !!yaml tag   Source + +
          yTagNimField: TagId = 100
          +
          + +This tag is used in serialization for the name of a field of an object. It may contain any string scalar that is a valid Nim symbol. +  Source
          yFirstCustomTagId: TagId = 1000
          @@ -1064,7 +1091,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
          @@ -1072,14 +1099,14 @@ class="link-seesrc" target="_blank">Source yielded when no anchor was defined for a YAML node   Source
          yamlTagRepositoryPrefix = "tag:yaml.org,2002:"
            Source
          defaultPresentationOptions = PresentationOptions(style: psDefault,
          @@ -1087,7 +1114,7 @@ class="link-seesrc" target="_blank">Source
           
            Source
          @@ -1099,140 +1126,140 @@ 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 yamlTag[](T: typedesc[char]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[int8]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[int16]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[int32]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[int64]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[uint8]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[uint16]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[uint32]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[uint64]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[float32]): TagId {.inline, raises: [].}
            Source
          proc yamlTag[](T: typedesc[float64]): TagId {.inline, raises: [].}
            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: [].}
          @@ -1245,7 +1272,7 @@ Contains only:
          • Source
            proc initCoreTagLibrary(): TagLibrary {.raises: [], tags: [].}
            @@ -1257,7 +1284,7 @@ Contains everything in initFailsa
            Source
          proc initExtendedTagLibrary(): TagLibrary {.raises: [], tags: [].}
          @@ -1273,35 +1300,42 @@ 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 tag(event: YamlStreamEvent): TagId {.raises: [FieldError], tags: [].}
        +
        + +  Source
        proc startDocEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
          Source
        proc endDocEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
          Source
        proc startMapEvent(tag: TagId = yTagQuestionMark; anchor: AnchorId = yAnchorNone): YamlStreamEvent {.
        @@ -1309,14 +1343,14 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc endMapEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
          Source
        proc startSeqEvent(tag: TagId = yTagQuestionMark; anchor: AnchorId = yAnchorNone): YamlStreamEvent {.
        @@ -1324,14 +1358,14 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc endSeqEvent(): YamlStreamEvent {.inline, raises: [], tags: [].}
          Source
        proc scalarEvent(content: string = ""; tag: TagId = yTagQuestionMark;
        @@ -1340,14 +1374,14 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc aliasEvent(anchor: AnchorId): YamlStreamEvent {.inline, raises: [], tags: [].}
          Source
        proc constructJson(s: var YamlStream): seq[JsonNode] {.
        @@ -1357,14 +1391,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: [], tags: [RootEffect].}
        Uses YamlParser and constructJson to construct an in-memory JSON tree from a YAML character stream.   Source
        proc defineOptions(style: PresentationStyle = psDefault; indentationStep: int = 2;
        @@ -1374,7 +1408,7 @@ class="link-seesrc" target="_blank">Source
         
        Define a set of options for presentation. Convenience proc that requires you to only set those values that should not equal the default.   Source
        proc present(s: var YamlStream; target: Stream; tagLib: TagLibrary;
        @@ -1384,7 +1418,7 @@ 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;
        @@ -1394,14 +1428,14 @@ class="link-seesrc" target="_blank">Source
         
        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();
        @@ -1409,28 +1443,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: [],
        @@ -1438,7 +1472,7 @@ class="link-seesrc" target="_blank">Source
         
        Parse the given stream as YAML character stream.   Source
        proc initYamlStream(backend: iterator (): YamlStreamEvent): YamlStream {.raises: [],
        @@ -1446,7 +1480,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],
        @@ -1454,7 +1488,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],
        @@ -1462,28 +1496,43 @@ 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 newConstructionContext(): ConstructionContext {.raises: [], tags: [].}
        +
        + +  Source +
        +
        proc newSerializationContext(s: AnchorStyle): SerializationContext {.raises: [],
        +    tags: [].}
        +
        + +  Source
        proc yamlTag[](T: typedesc[string]): TagId {.inline, noSideEffect, raises: [].}
          Source
        proc constructObject(s: var YamlStream; c: ConstructionContext; result: var string) {.
        @@ -1491,15 +1540,15 @@ class="link-seesrc" target="_blank">Source
         
        costructs a string from a YAML scalar   Source
        -
        proc representObject(value: string; ts: TagStyle = tsNone; c: SerializationContext): RawYamlStream {.
        +
        proc representObject(value: string; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [], tags: [].}
        represents a string as YAML scalar   Source
        proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
        @@ -1507,15 +1556,15 @@ class="link-seesrc" target="_blank">Source
         
        constructs an integer value from a YAML scalar   Source
        -
        proc representObject[T](value: T; ts: TagStyle = tsNone; c: SerializationContext): RawYamlStream {.
        +
        proc representObject[T](value: T; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [].}
        represents an integer value as YAML scalar   Source
        proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
        @@ -1523,15 +1572,15 @@ class="link-seesrc" target="_blank">Source
         
        construct an unsigned integer value from a YAML scalar   Source
        -
        proc representObject[T](value: T; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject[T](value: T; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [].}
        represents an unsigned integer value as YAML scalar   Source
        proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
        @@ -1539,22 +1588,22 @@ class="link-seesrc" target="_blank">Source
         
        construct a float value from a YAML scalar   Source
        -
        proc representObject[T](value: T; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject[T](value: T; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [].}
        represents a float value as YAML scalar   Source
        proc yamlTag[](T: typedesc[bool]): TagId {.inline, raises: [].}
          Source
        proc constructObject(s: var YamlStream; c: ConstructionContext; result: var bool) {.
        @@ -1562,15 +1611,15 @@ class="link-seesrc" target="_blank">Source
         
        constructs a bool value from a YAML scalar   Source
        -
        proc representObject(value: bool; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject(value: bool; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [], tags: [].}
        represents a bool value as a YAML scalar   Source
        proc constructObject(s: var YamlStream; c: ConstructionContext; result: var char) {.
        @@ -1578,22 +1627,22 @@ class="link-seesrc" target="_blank">Source
         
        constructs a char value from a YAML scalar   Source
        -
        proc representObject(value: char; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject(value: char; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [], tags: [].}
        represents a char value as YAML scalar   Source
        proc yamlTag[I, ](T: typedesc[seq[I]]): TagId {.inline, raises: [].}
          Source
        proc constructObject[T](s: var YamlStream; c: ConstructionContext; result: var seq[T]) {.
        @@ -1601,22 +1650,22 @@ class="link-seesrc" target="_blank">Source
         
        constructs a Nim seq from a YAML sequence   Source
        -
        proc representObject[T](value: seq[T]; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        -    raises: [].}
        +
        proc representObject[T](value: seq[T]; ts: TagStyle; c: SerializationContext;
        +                       tag: TagId): RawYamlStream {.raises: [].}
        represents a Nim seq as YAML sequence   Source
        proc yamlTag[K, V, ](T: typedesc[Table[K, V]]): TagId {.inline, raises: [].}
          Source
        proc constructObject[K, V](s: var YamlStream; c: ConstructionContext;
        @@ -1625,15 +1674,40 @@ class="link-seesrc" target="_blank">Source
         
        constructs a Nim Table from a YAML mapping   Source
        -
        proc representObject[K, V](value: Table[K, V]; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        -    raises: [].}
        +
        proc representObject[K, V](value: Table[K, V]; ts: TagStyle; c: SerializationContext;
        +                         tag: TagId): RawYamlStream {.raises: [].}
        represents a Nim Table as YAML mapping   Source +
        +
        proc yamlTag[K, V, ](T: typedesc[OrderedTable[K, V]]): TagId {.inline, raises: [].}
        +
        + +  Source +
        +
        proc constructObject[K, V](s: var YamlStream; c: ConstructionContext;
        +                         result: var OrderedTable[K, V]) {.
        +    raises: [YamlConstructionError, YamlStreamError].}
        +
        +constructs a Nim OrderedTable from a YAML mapping +  Source +
        +
        proc representObject[K, V](value: OrderedTable[K, V]; ts: TagStyle;
        +                         c: SerializationContext; tag: TagId): RawYamlStream {.
        +    raises: [].}
        +
        + +  Source
        proc constructObject[O](s: var YamlStream; c: ConstructionContext; result: var O) {.
        @@ -1641,15 +1715,15 @@ class="link-seesrc" target="_blank">Source
         
        constructs a Nim object or tuple from a YAML mapping   Source
        -
        proc representObject[O](value: O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject[O](value: O; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [].}
        represents a Nim object or tuple as YAML mapping   Source
        proc constructObject[O](s: var YamlStream; c: ConstructionContext; result: var O) {.
        @@ -1657,22 +1731,22 @@ class="link-seesrc" target="_blank">Source
         
        constructs a Nim enum from a YAML scalar   Source
        -
        proc representObject[O](value: O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representObject[O](value: O; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream {.
             raises: [].}
        represents a Nim enum as YAML scalar   Source
        proc yamlTag[O, ](T: typedesc[ref O]): TagId {.inline, raises: [].}
          Source
        proc constructChild[T](s: var YamlStream; c: ConstructionContext; result: var T) {.
        @@ -1680,7 +1754,7 @@ class="link-seesrc" target="_blank">Source
         
        Constructs an arbitrary Nim value from a part of a YAML stream. The stream will advance until after the finishing token that was used for constructing the value. The ConstructionContext is needed for potential child objects which may be refs.   Source
        proc constructChild[O](s: var YamlStream; c: ConstructionContext; result: var ref O) {.
        @@ -1688,15 +1762,23 @@ class="link-seesrc" target="_blank">Source
         
        Constructs an arbitrary Nim value from a part of a YAML stream. The stream will advance until after the finishing token that was used for constructing the value. The object may be constructed from an alias node which will be resolved using the ConstructionContext.   Source
        -
        proc representObject[O](value: ref O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +
        proc representChild[O](value: O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
        +    inline.}
        +
        +Represents an arbitrary Nim object as YAML object. +  Source +
        +
        proc representChild[O](value: ref O; ts: TagStyle; c: SerializationContext): RawYamlStream {.
             raises: [].}
        -Represents an arbitrary Nim value as YAML object. The object may be represented as alias node if the object is already present in the SerializationContext. +Represents an arbitrary Nim reference value as YAML object. The object may be represented as alias node if it is already present in the SerializationContext.   Source
        proc construct[T](s: var YamlStream; target: var T) {.
        @@ -1704,7 +1786,7 @@ class="link-seesrc" target="_blank">Source
         
        Constructs a Nim value from a YAML stream.   Source
        proc load[K](input: Stream; target: var K) {.raises: [YamlConstructionError, IOError,
        @@ -1712,7 +1794,7 @@ class="link-seesrc" target="_blank">Source
         
        Loads a Nim value from a YAML character stream.   Source
        proc represent[T](value: T; ts: TagStyle = tsRootOnly; a: AnchorStyle = asTidy): YamlStream {.
        @@ -1720,7 +1802,7 @@ class="link-seesrc" target="_blank">Source
         
        Represents a Nim value as YamlStream   Source
        proc dump[K](value: K; target: Stream; tagStyle: TagStyle = tsRootOnly;
        @@ -1730,14 +1812,14 @@ 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 {.
        @@ -1745,7 +1827,7 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc newYamlNode(pairs: openArray[tuple[key, value: YamlNode]]; tag: string = "?"): YamlNode {.
        @@ -1753,14 +1835,14 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc initYamlDoc(root: YamlNode): YamlDocument {.raises: [], tags: [].}
          Source
        proc compose(s: var YamlStream; tagLib: TagLibrary): YamlDocument {.
        @@ -1768,7 +1850,7 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc loadDOM(s: Stream): YamlDocument {.raises: [IOError, YamlParserError,
        @@ -1776,7 +1858,7 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc serialize(doc: YamlDocument; tagLib: TagLibrary; a: AnchorStyle = asTidy): YamlStream {.
        @@ -1784,7 +1866,7 @@ class="link-seesrc" target="_blank">Source
         
          Source
        proc dumpDOM(doc: YamlDocument; target: Stream; anchorStyle: AnchorStyle = asTidy;
        @@ -1794,7 +1876,7 @@ class="link-seesrc" target="_blank">Source
         
        Dump a YamlDocument as YAML character stream.   Source
        @@ -1807,7 +1889,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
        @@ -1819,84 +1901,86 @@ class="link-seesrc" target="_blank">Source
        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 presentTag[](t: typedesc; ts: TagStyle): TagId
        Get the TagId that represents the given type in the given style   Source
        template constructScalarItem[](s: var YamlStream; i: expr; t: typedesc; content: untyped)
        Helper template for implementing constructObject for types that are constructed from a scalar. i is the identifier that holds the scalar as YamlStreamEvent in the content. Exceptions raised in the content will be automatically catched and wrapped in YamlConstructionError, which will then be raised.   Source
        template constructObject(s: var YamlStream; c: ConstructionContext; result: var int)
        calling this will raise a compiler error because int is not supported   Source
        -
        template representObject(value: int; tagStyle: TagStyle; c: SerializationContext): RawYamlStream
        +
        template representObject(value: int; tagStyle: TagStyle; c: SerializationContext;
        +                        tag: TagId): RawYamlStream
        calling this will raise a compiler error because int is not supported   Source
        template constructObject(s: var YamlStream; c: ConstructionContext; result: var uint)
        calling this will raise a compiler error because uint is not supported   Source
        -
        template representObject(value: uint; ts: TagStyle; c: SerializationContext): RawYamlStream
        +
        template representObject(value: uint; ts: TagStyle; c: SerializationContext; tag: TagId): RawYamlStream
        calling this will raise a compiler error because uint is not supported   Source
        template constructObject(s: var YamlStream; c: ConstructionContext; result: var float)
        calling this will raise a compiler error because float is not supported   Source
        -
        template representObject(value: float; tagStyle: TagStyle; c: SerializationContext): RawYamlStream
        +
        template representObject(value: float; tagStyle: TagStyle; c: SerializationContext;
        +                        tag: TagId): RawYamlStream
        calling this will result in a compiler error because float is not supported   Source
        template yamlTag[](T: typedesc[object | enum]): expr
          Source
        template yamlTag[](T: typedesc[tuple]): expr
          Source
        @@ -1909,7 +1993,7 @@ class="link-seesrc" target="_blank">Source