From e45eb7b51409d2dcf0089817059e3a74144dc67a Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Sat, 19 Mar 2016 15:54:19 +0100 Subject: [PATCH] Fixed some bugs * Ensure that no event is yielded twice at explicit document end * Properly handle indentation when comment occurs in a line before the start of the node * Allow multiline implicit map keys in flow map --- private/fastparse.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/private/fastparse.nim b/private/fastparse.nim index 940dc5c..eb120a4 100644 --- a/private/fastparse.nim +++ b/private/fastparse.nim @@ -106,7 +106,9 @@ template handleLineEnd(insideDocument: bool) {.dirty.} = newlines.inc() template handleObjectEnd(nextState: FastParseState) {.dirty.} = - if ancestry.len == 0: state = fpExpectDocEnd + if ancestry.len == 0: + level.kind = fplUnknown + state = fpExpectDocEnd else: level = ancestry.pop() if level.kind == fplSinglePairValue: @@ -738,10 +740,7 @@ template handleFlowPlainScalar() {.dirty.} = content.add(repeat(' ', newlines - 1)) newlines = 0 p.lexer.plainScalar(content, cFlow) - elif explicitFlowKey: - break - else: - parserError("Multiline scalar is not allowed as implicit key") + break of '#', EndOfFile: break of '\l': p.lexer.bufpos = p.lexer.handleLF(p.lexer.bufpos) @@ -1333,6 +1332,7 @@ proc parse*(p: YamlParser, s: Stream): YamlStream = p.lexer.lineEnding() handleLineEnd(true) state = fpBlockLineStart + level.indentation = -1 of '\'': handleBlockItemStart() content = ""