From 143437d3090e86da15ea4e5f36e25729ea1bf16d Mon Sep 17 00:00:00 2001 From: Andreas Keller Date: Tue, 9 Jul 2024 09:50:31 +0200 Subject: [PATCH] Fix not checking for \\r\\n when parsing line comments --- include/toml11/parser.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/toml11/parser.hpp b/include/toml11/parser.hpp index 5952f994..8b608109 100644 --- a/include/toml11/parser.hpp +++ b/include/toml11/parser.hpp @@ -1855,7 +1855,14 @@ skip_multiline_spacer(location& loc, context& 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;