src/nyml

Procs

proc `$`(n: YAML): string {....raises: [IOError, OSError, Exception, ValueError,
                                     KeyError, YAMLException,
                                     OpenParserJsonError],
                            tags: [ReadIOEffect, RootEffect], forbids: [].}
Return a stringified JSON
proc parse(n: YAML): Parser {....raises: [IOError, OSError, Exception, ValueError,
                                       KeyError],
                              tags: [ReadIOEffect, RootEffect], forbids: [].}
Parse a new YAML-like document
proc toJson(n: YAML): Document {....raises: [IOError, OSError, Exception,
    ValueError, KeyError, YAMLException, OpenParserJsonError],
                                 tags: [ReadIOEffect, RootEffect], forbids: [].}
Parse YAML contents to JsonNode
proc toJsonStr(n: YAML; prettyPrint = false; indent = 2): string {....raises: [
    IOError, OSError, Exception, ValueError, KeyError, YAMLException,
    OpenParserJsonError], tags: [ReadIOEffect, RootEffect], forbids: [].}
Parse YAML contents to stringified JSON
proc toJsonStr(n: YAML; ruler: seq[string]; prettyPrint = false; indent = 2): string {....raises: [
    IOError, OSError, Exception, ValueError, KeyError, YAMLException,
    OpenParserJsonError], tags: [ReadIOEffect, RootEffect], forbids: [].}
YAML parser to JSON string representation, with rules checker
proc toYAML(json: JsonNode): string {....raises: [Exception], tags: [RootEffect],
                                      forbids: [].}
proc toYAML(json: string): string {....raises: [Exception, OpenParserJsonError,
    ValueError], tags: [RootEffect], forbids: [].}
proc yaml(contents: string; prettyPrint = false; data: JsonNode = nil): YAML {.
    ...raises: [], tags: [RootEffect], forbids: [].}
Parse a new YAML-like document

Templates

template fromYaml[T: typedesc](str: string; obj: T): untyped
Add support for loose, direct to object parser using