From b99fa8df7a3f524e12b724036f8a79b627cca5e7 Mon Sep 17 00:00:00 2001 From: Felix Krause Date: Fri, 13 Jan 2017 16:19:04 +0100 Subject: [PATCH] Fixes #35 --- yaml/parser.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yaml/parser.nim b/yaml/parser.nim index b5ca71e..8450d85 100644 --- a/yaml/parser.nim +++ b/yaml/parser.nim @@ -592,17 +592,24 @@ parserState blockObjectStart: c.advance() state = scalarEnd of ltScalarPart: + let needsValueIndicator = c.level.kind == fplMapKey result = c.handleBlockItemStart(e) c.plainScalarStart = c.lex.curStartPos while true: c.advance() case c.lex.cur of ltIndentation: - if c.lex.indentation <= c.ancestry[^1].indentation: break + if c.lex.indentation <= c.ancestry[^1].indentation: + if needsValueIndicator and + c.lex.indentation == c.ancestry[^1].indentation: + raise c.generateError("Illegal multiline implicit key") + break c.lex.newlines.inc() of ltScalarPart: discard of ltEmptyLine: c.lex.newlines.inc() else: break + if needsValueIndicator and c.lex.cur != ltMapValInd: + raise c.generateError("Missing mapping value indicator (`:`)") c.lex.newlines = 0 state = plainScalarEnd stored = blockAfterObject