properly handle comment after block scalars. fixes #106

This commit is contained in:
Felix Krause 2022-06-04 23:14:28 +02:00
parent 5aa39aa0f1
commit 8993f928d4
1 changed files with 4 additions and 5 deletions

View File

@ -572,10 +572,9 @@ proc readBlockScalar(lex: var Lexer) =
let markerFollows = lex.currentIndentation() == 0 and let markerFollows = lex.currentIndentation() == 0 and
(lex.dirEndFollows() or lex.docEndFollows()) (lex.dirEndFollows() or lex.docEndFollows())
if lex.currentIndentation() > lex.indentation and not markerFollows:
if lex.c == '#': if lex.c == '#':
lex.state = expectLineEnd lex.state = expectLineEnd
else: elif lex.currentIndentation() > lex.indentation and not markerFollows:
raise lex.generateError("This line #" & $lex.curStartPos.line & " at " & escape("" & lex.c) & " is less indented than necessary") raise lex.generateError("This line #" & $lex.curStartPos.line & " at " & escape("" & lex.c) & " is less indented than necessary")
elif lex.currentIndentation() == 0: elif lex.currentIndentation() == 0:
lex.state = lineStart lex.state = lineStart