From 0204fca7387c5ad0afd6fc86a74af537e90ff447 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sat, 7 Mar 2020 20:17:54 +0900 Subject: [PATCH] Fix handling of sequence indicator --- parser/parser_test.go | 18 ++++++++++++++++++ scanner/scanner.go | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/parser/parser_test.go b/parser/parser_test.go index f4747c38..e08e2083 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -497,6 +497,24 @@ a - b - c: value `, ` a - b - c: value +`, + }, + { + ` +a: +- + b: c + d: e +- + f: g + h: i +`, + ` +a: +- b: c + d: e +- f: g + h: i `, }, } diff --git a/scanner/scanner.go b/scanner/scanner.go index 0b287bbc..4bff2418 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -431,7 +431,7 @@ func (s *Scanner) scan(ctx *Context) (pos int) { continue } nc := ctx.nextChar() - if nc == ' ' { + if nc == ' ' || s.isNewLineChar(nc) { s.addBufferedTokenIfExists(ctx) ctx.addOriginBuf(c) tk := token.SequenceEntry(string(ctx.obuf), s.pos())