mirror of https://github.com/status-im/NimYAML.git
Empty documents always contain an empty scalar
This commit is contained in:
parent
294fc875bd
commit
44ca31b1e2
|
@ -103,7 +103,7 @@ proc testsFor(path: string, root: bool = true, titlePrefix: string = ""):
|
|||
NimNode {.compileTime.} =
|
||||
result = newStmtList()
|
||||
let
|
||||
baseDir = staticExec("pwd")
|
||||
baseDir = parentDir(staticExec("pwd"))
|
||||
nimPathRaw = staticExec("which nim")
|
||||
nimPath = if nimPathRaw[0] == '/': nimPathRaw else: baseDir / nimPathRaw
|
||||
title = titlePrefix & slurp(baseDir / path / "title").splitLines()[0]
|
||||
|
@ -128,4 +128,4 @@ proc testsFor(path: string, root: bool = true, titlePrefix: string = ""):
|
|||
|
||||
macro genTests(): untyped = testsFor("doc/snippets/quickstart")
|
||||
|
||||
genTests()
|
||||
genTests()
|
||||
|
|
|
@ -429,21 +429,14 @@ proc endLevel(c: ParserContext, e: var YamlStreamEvent):
|
|||
LevelEndResult =
|
||||
result = lerOne
|
||||
case c.level.kind
|
||||
of fplSequence:
|
||||
e = endSeqEvent()
|
||||
of fplMapKey:
|
||||
e = endMapEvent()
|
||||
of fplSequence: e = endSeqEvent()
|
||||
of fplMapKey: e = endMapEvent()
|
||||
of fplMapValue, fplSinglePairValue:
|
||||
e = emptyScalar(c)
|
||||
c.level.kind = fplMapKey
|
||||
result = lerAdditionalMapEnd
|
||||
of fplUnknown:
|
||||
if c.ancestry.len > 1:
|
||||
e = emptyScalar(c) # don't yield scalar for empty doc
|
||||
else:
|
||||
result = lerNothing
|
||||
of fplDocument:
|
||||
e = endDocEvent()
|
||||
of fplUnknown: e = emptyScalar(c)
|
||||
of fplDocument: e = endDocEvent()
|
||||
of fplSinglePairKey:
|
||||
internalError("Unexpected level kind: " & $c.level.kind)
|
||||
|
||||
|
|
Loading…
Reference in New Issue