Skip to content

Commit

Permalink
Merge pull request #47 from goccy/feature/fix-literal-include-empty-line
Browse files Browse the repository at this point in the history
Fix handling of literal token include empty line
  • Loading branch information
goccy authored Nov 19, 2019
2 parents debf487 + 4147f40 commit b24bdb8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,24 @@ a:
hoge
fuga
piyo
`,
},
{
`
a: |
bbbbbbb
ccccccc
d: eeeeeeeeeeeeeeeee
`,
`
a: |
bbbbbbb
ccccccc
d: eeeeeeeeeeeeeeeee
`,
},
}
Expand Down
3 changes: 3 additions & 0 deletions scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b24bdb8

Please sign in to comment.