Skip to content

Commit

Permalink
Fix not checking for \\r\\n when parsing line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Keller committed Jul 9, 2024
1 parent 5ac47b8 commit 143437d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/toml11/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,14 @@ skip_multiline_spacer(location& loc, context<TC>& ctx, const bool newline_found
{
spacer.newline_found = true;
auto comment = comm.as_string();
if( ! comment.empty() && comment.back() == '\n') {comment.pop_back();}
if( ! comment.empty() && comment.back() == '\n')
{
comment.pop_back();
if (!comment.empty() && comment.back() == '\r')
{
comment.pop_back();
}
}

spacer.comments.push_back(std::move(comment));
spacer.indent_type = indent_char::none;
Expand Down

0 comments on commit 143437d

Please sign in to comment.