Skip to content

Commit

Permalink
Fix handling of literal token include empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Nov 19, 2019
1 parent debf487 commit 4147f40
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 4147f40

Please sign in to comment.