Merge pull request #253 from andreaskeller96/fix/correctly-resolve-carriage-return

Fix not checking for \r\n when parsing line comments
This commit is contained in:
Toru Niina
2024-07-11 00:06:43 +09:00
committed by GitHub

View File

@@ -1855,7 +1855,14 @@ skip_multiline_spacer(location& loc, context<TC>& ctx, const bool newline_found
{ {
spacer.newline_found = true; spacer.newline_found = true;
auto comment = comm.as_string(); 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.comments.push_back(std::move(comment));
spacer.indent_type = indent_char::none; spacer.indent_type = indent_char::none;