Repository: goccy/go-yaml (go)

Issue:
cannot parse correctly when block string contains empty line
複数行文字列が空行を含む場合、空行で切られ、後続の部分がうまく処理されないです
https://play.golang.org/p/9Kdff4wBcP3

Pull request description:
Fix handling of literal token include empty line
resolve #46 

Patch:
diff --git a/scanner/scanner.go b/scanner/scanner.go
index 47e9c88..fdcffe8 100644
--- a/scanner/scanner.go
+++ b/scanner/scanner.go
@@ -102,6 +102,9 @@ func (s *Scanner) isNeededKeepPreviousIndentNum(ctx *Context, c rune) bool {
 }
 
 func (s *Scanner) updateIndent(ctx *Context, c rune) {
+	if s.isFirstCharAtLine && c == '\n' && ctx.isDocument() {
+		return
+	}
 	if s.isFirstCharAtLine && c == ' ' {
 		s.indentNum++
 		return


Test patch:
diff --git a/parser/parser_test.go b/parser/parser_test.go
index c3cbc3b..5577f96 100644
--- a/parser/parser_test.go
+++ b/parser/parser_test.go
@@ -414,6 +414,24 @@ a:
     hoge
     fuga
     piyo
+`,
+		},
+		{
+			`
+a: |
+   bbbbbbb
+
+
+   ccccccc
+d: eeeeeeeeeeeeeeeee
+`,
+			`
+a: |
+   bbbbbbb
+
+
+   ccccccc
+d: eeeeeeeeeeeeeeeee
 `,
 		},
 	}