mirror of https://github.com/status-im/NimYAML.git
Fixes #3
This commit is contained in:
parent
bc9229d0c5
commit
43e10f496a
|
@ -1174,6 +1174,12 @@ proc parse*(p: YamlParser, s: Stream): YamlStream =
|
||||||
else:
|
else:
|
||||||
ensureCorrectIndentation()
|
ensureCorrectIndentation()
|
||||||
state = fpBlockObjectStart
|
state = fpBlockObjectStart
|
||||||
|
of EndOfFile:
|
||||||
|
closeEverything()
|
||||||
|
break
|
||||||
|
of '\t', '\x0A', '\c', '#':
|
||||||
|
p.lexer.lineEnding()
|
||||||
|
handleLineEnd(true)
|
||||||
else:
|
else:
|
||||||
indentation = 0
|
indentation = 0
|
||||||
closeMoreIndentedLevels()
|
closeMoreIndentedLevels()
|
||||||
|
|
|
@ -264,3 +264,10 @@ suite "Parsing":
|
||||||
ensure("- [a, b, c ]", startDocEvent(), startSeqEvent(),
|
ensure("- [a, b, c ]", startDocEvent(), startSeqEvent(),
|
||||||
startSeqEvent(), scalarEvent("a"), scalarEvent("b"),
|
startSeqEvent(), scalarEvent("a"), scalarEvent("b"),
|
||||||
scalarEvent("c"), endSeqEvent(), endSeqEvent(), endDocEvent())
|
scalarEvent("c"), endSeqEvent(), endSeqEvent(), endDocEvent())
|
||||||
|
test "Parsing: Empty lines after document":
|
||||||
|
ensure(":\n\n", startDocEvent(), startMapEvent(), scalarEvent(""),
|
||||||
|
scalarEvent(""), endMapEvent(), endDocEvent())
|
||||||
|
test "Parsing: Empty lines between map elements":
|
||||||
|
ensure("1: 2\n\n\n3: 4", startDocEvent(), startMapEvent(),
|
||||||
|
scalarEvent("1"), scalarEvent("2"), scalarEvent("3"),
|
||||||
|
scalarEvent("4"), endMapEvent(), endDocEvent())
|
Loading…
Reference in New Issue