mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-12-16 03:08:52 +08:00
fix: avoid duplicating comment: array/table elems
This commit is contained in:
@@ -304,6 +304,12 @@ struct region final : public region_base
|
||||
// # this also.
|
||||
// a = value # not this.
|
||||
// ```
|
||||
|
||||
// # this is a comment for `a`, not array elements.
|
||||
// a = [1, 2, 3, 4, 5]
|
||||
if(this->first() == std::find_if(this->line_begin(), this->first(),
|
||||
[](const char c) noexcept -> bool {return c == '[' || c == '{';}))
|
||||
{
|
||||
auto iter = this->line_begin(); // points the first character
|
||||
while(iter != this->begin())
|
||||
{
|
||||
@@ -338,6 +344,7 @@ struct region final : public region_base
|
||||
iter = line_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(com.size() > 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user