Skip to content

Commit

Permalink
Merge pull request #253 from andreaskeller96/fix/correctly-resolve-ca…
Browse files Browse the repository at this point in the history
…rriage-return

Fix not checking for \r\n when parsing line comments
  • Loading branch information
ToruNiina authored Jul 10, 2024
2 parents 5ac47b8 + 143437d commit d8d3257
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 d8d3257

Please sign in to comment.