Skip to content

Commit

Permalink
Fix parsing of wide chars in comments (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed May 4, 2020
1 parent b1b19b4 commit 5308cda
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 16 additions & 0 deletions node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,22 @@ var nodeTests = []struct {
},
}, {

"# š\ntrue\n",
yaml.Node{
Kind: yaml.DocumentNode,
Line: 2,
Column: 1,
Content: []*yaml.Node{{
Kind: yaml.ScalarNode,
Value: "true",
Tag: "!!bool",
Line: 2,
Column: 1,
HeadComment: "# š",
}},
},
}, {

"[decode]\n# One\n\n# Two\n\n# Three\ntrue # Four\n# Five\n\n# Six\n\n# Seven\n",
yaml.Node{
Kind: yaml.DocumentNode,
Expand Down
5 changes: 2 additions & 3 deletions scannerc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2999,10 +2999,9 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo
return false
}
skip_line(parser)
} else if parser.mark.index >= seen {
text = read(parser, text)
} else {
if parser.mark.index >= seen {
text = append(text, parser.buffer[parser.buffer_pos])
}
skip(parser)
}
}
Expand Down

0 comments on commit 5308cda

Please sign in to comment.