mirror of https://github.com/status-im/NimYAML.git
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
This commit is contained in:
parent
0fc30241b9
commit
e45eb7b514
|
@ -106,7 +106,9 @@ template handleLineEnd(insideDocument: bool) {.dirty.} =
|
||||||
newlines.inc()
|
newlines.inc()
|
||||||
|
|
||||||
template handleObjectEnd(nextState: FastParseState) {.dirty.} =
|
template handleObjectEnd(nextState: FastParseState) {.dirty.} =
|
||||||
if ancestry.len == 0: state = fpExpectDocEnd
|
if ancestry.len == 0:
|
||||||
|
level.kind = fplUnknown
|
||||||
|
state = fpExpectDocEnd
|
||||||
else:
|
else:
|
||||||
level = ancestry.pop()
|
level = ancestry.pop()
|
||||||
if level.kind == fplSinglePairValue:
|
if level.kind == fplSinglePairValue:
|
||||||
|
@ -738,10 +740,7 @@ template handleFlowPlainScalar() {.dirty.} =
|
||||||
content.add(repeat(' ', newlines - 1))
|
content.add(repeat(' ', newlines - 1))
|
||||||
newlines = 0
|
newlines = 0
|
||||||
p.lexer.plainScalar(content, cFlow)
|
p.lexer.plainScalar(content, cFlow)
|
||||||
elif explicitFlowKey:
|
break
|
||||||
break
|
|
||||||
else:
|
|
||||||
parserError("Multiline scalar is not allowed as implicit key")
|
|
||||||
of '#', EndOfFile: break
|
of '#', EndOfFile: break
|
||||||
of '\l':
|
of '\l':
|
||||||
p.lexer.bufpos = p.lexer.handleLF(p.lexer.bufpos)
|
p.lexer.bufpos = p.lexer.handleLF(p.lexer.bufpos)
|
||||||
|
@ -1333,6 +1332,7 @@ proc parse*(p: YamlParser, s: Stream): YamlStream =
|
||||||
p.lexer.lineEnding()
|
p.lexer.lineEnding()
|
||||||
handleLineEnd(true)
|
handleLineEnd(true)
|
||||||
state = fpBlockLineStart
|
state = fpBlockLineStart
|
||||||
|
level.indentation = -1
|
||||||
of '\'':
|
of '\'':
|
||||||
handleBlockItemStart()
|
handleBlockItemStart()
|
||||||
content = ""
|
content = ""
|
||||||
|
|
Loading…
Reference in New Issue