Previously a key like:
"a\u0000\u0001b" = 1
Would get written with literal control characters, rather than escapes:
"a<00><01>b" = 1
The "valid/key/quoted-unicode" test from toml-test would fail with this,
although it seems they're not run automatically(?)
Can also reproduce with something like:
% cat test.cpp
#include <toml.hpp>
#include <iostream>
int main()
{
const auto data = toml::parse("test.toml");
std::cout << data << "\n";
return 0;
}
% cat test.toml
"a\u0000\u0001b" = "a\u0000\u0001b"
% c++ -I. test.cpp
% ./a.out
"ab" = "a\u0000\u0001b"
% ./a.out | hexdump -C
00000000 22 61 00 01 62 22 20 3d 20 22 61 5c 75 30 30 30 |"a..b" = "a\u000|
00000010 30 5c 75 30 30 30 31 62 22 0a 0a |0\u0001b"..|
while checking if the array is array-of-tables or not (heterogeneous
arrays are allowed, so there might be an array that has a table and
an integer at the same time)
This fixes the warning "compiler may not enforce left-to-right
evaluation order for call to" that is caused by Visual Studio if this is
compiled with a target of C++17.
- if a basic string contains any double quote, make it multiline.
- because 1 or 2 consecutive "s do not require escape sequence in it.
- if a basic string will be sufficiently long, make it multiline.
- if 3 consecutive "s appeared, insert backslash to break it down.
In literal strings, only the first newline will be trimmed.
```toml
str = '''
The first newline will be trimmed.'''
```
The previous code always adds this first-newline, but after this commit
it checks the length of the string and adds newline if the string is
sufficiently long.
If unreleased feature is activated, zero-prefixes in an exponent part of
a floating point is allowed. If the flag TOML11_UNRELEASED_TOML_FEATURES
is turned on, we don't need to check whether there is a zero prefix in
the exponent part that is formatted by a standard library.
When non-table value is passed to the `operator<<`, it assumes that the
original C++ code looks like the following.
```cpp
std::cout << "key = " << v << std::endl;
```
In this case, the comment associated to `v` should be put just after
`v`, not before.
```toml
key = # comment <= bad
"value"
key = "value" # comment <= good
```
So, if `v` is not a table it would put comments just after the value.