This commit is contained in:
Felix Krause 2016-02-18 22:32:25 +01:00
parent bc9229d0c5
commit 43e10f496a
2 changed files with 14 additions and 1 deletions

View File

@ -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()

View File

@ -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())