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:
ensureCorrectIndentation()
state = fpBlockObjectStart
of EndOfFile:
closeEverything()
break
of '\t', '\x0A', '\c', '#':
p.lexer.lineEnding()
handleLineEnd(true)
else:
indentation = 0
closeMoreIndentedLevels()

View File

@ -263,4 +263,11 @@ suite "Parsing":
test "Parsing: Whitespace before end of flow content":
ensure("- [a, b, c ]", startDocEvent(), startSeqEvent(),
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())