mirror of https://github.com/status-im/NimYAML.git
Fixed submodules. Fixed some depr warnings. Fixes #77
This commit is contained in:
parent
f8b264f992
commit
f714881ae9
|
@ -1,4 +1,4 @@
|
||||||
[submodule "test/yaml-test-suite"]
|
[submodule "test/yaml-test-suite"]
|
||||||
path = test/yaml-test-suite
|
path = test/yaml-test-suite
|
||||||
url = https://github.com/yaml/yaml-test-suite.git
|
url = https://github.com/yaml/yaml-test-suite.git
|
||||||
branch = data
|
branch = data-2020-02-11
|
||||||
|
|
|
@ -94,7 +94,7 @@ proc eqImpl(x, y: YamlNode, alreadyVisited: var HashSet[pointer]): bool =
|
||||||
compare(xValue, matchingValue)
|
compare(xValue, matchingValue)
|
||||||
|
|
||||||
proc `==`*(x, y: YamlNode): bool =
|
proc `==`*(x, y: YamlNode): bool =
|
||||||
var alreadyVisited = initSet[pointer]()
|
var alreadyVisited = initHashSet[pointer]()
|
||||||
result = eqImpl(x, y, alreadyVisited)
|
result = eqImpl(x, y, alreadyVisited)
|
||||||
|
|
||||||
proc `$`*(n: YamlNode): string =
|
proc `$`*(n: YamlNode): string =
|
||||||
|
@ -134,7 +134,7 @@ proc initYamlDoc*(root: YamlNode): YamlDocument = result.root = root
|
||||||
proc composeNode(s: var YamlStream, tagLib: TagLibrary,
|
proc composeNode(s: var YamlStream, tagLib: TagLibrary,
|
||||||
c: ConstructionContext):
|
c: ConstructionContext):
|
||||||
YamlNode {.raises: [YamlStreamError, YamlConstructionError].} =
|
YamlNode {.raises: [YamlStreamError, YamlConstructionError].} =
|
||||||
template addAnchor(c: ConstructionContext, target: AnchorId): typed =
|
template addAnchor(c: ConstructionContext, target: AnchorId) =
|
||||||
if target != yAnchorNone:
|
if target != yAnchorNone:
|
||||||
when defined(JS):
|
when defined(JS):
|
||||||
{.emit: [c, """.refs.set(""", target, ", ", result, ");"].}
|
{.emit: [c, """.refs.set(""", target, ", ", result, ");"].}
|
||||||
|
@ -269,7 +269,7 @@ proc serializeNode(n: YamlNode, c: SerializationContext, a: AnchorStyle,
|
||||||
serializeNode(value, c, a, tagLib)
|
serializeNode(value, c, a, tagLib)
|
||||||
c.put(endMapEvent())
|
c.put(endMapEvent())
|
||||||
|
|
||||||
template processAnchoredEvent(target: untyped, c: SerializationContext): typed =
|
template processAnchoredEvent(target: untyped, c: SerializationContext) =
|
||||||
var anchorId: AnchorId
|
var anchorId: AnchorId
|
||||||
when defined(JS):
|
when defined(JS):
|
||||||
{.emit: [anchorId, " = ", c, ".refs.get(", target, ");"].}
|
{.emit: [anchorId, " = ", c, ".refs.get(", target, ");"].}
|
||||||
|
|
|
@ -71,7 +71,7 @@ type
|
||||||
ythAfterTimeSpace, ythAfterTimeZ, ythAfterTimePlusMinus, ythTzHour1,
|
ythAfterTimeSpace, ythAfterTimeZ, ythAfterTimePlusMinus, ythTzHour1,
|
||||||
ythTzHour2, ythTzHourColon, ythTzMinute1, ythTzMinute2
|
ythTzHour2, ythTzHourColon, ythTzMinute1, ythTzMinute2
|
||||||
|
|
||||||
macro typeHintStateMachine(c: untyped, content: varargs[untyped]): typed =
|
macro typeHintStateMachine(c: untyped, content: varargs[untyped]) =
|
||||||
yAssert content.kind == nnkArgList
|
yAssert content.kind == nnkArgList
|
||||||
result = newNimNode(nnkCaseStmt, content).add(copyNimNode(c))
|
result = newNimNode(nnkCaseStmt, content).add(copyNimNode(c))
|
||||||
for branch in content.children:
|
for branch in content.children:
|
||||||
|
@ -86,7 +86,7 @@ macro typeHintStateMachine(c: untyped, content: varargs[untyped]): typed =
|
||||||
inc(i)
|
inc(i)
|
||||||
for rule in branch[i].children:
|
for rule in branch[i].children:
|
||||||
yAssert rule.kind == nnkInfix
|
yAssert rule.kind == nnkInfix
|
||||||
yAssert $rule[0].ident == "=>"
|
yAssert rule[0].strVal == "=>"
|
||||||
var stateBranch = newNimNode(nnkOfBranch, rule)
|
var stateBranch = newNimNode(nnkOfBranch, rule)
|
||||||
case rule[1].kind
|
case rule[1].kind
|
||||||
of nnkBracket:
|
of nnkBracket:
|
||||||
|
|
Loading…
Reference in New Issue