A header-only library for parsing TOML configuration files.
Targets: d9f4282287967bf2f42ac4426dc1cf69ec608b10
It is reasonably conformant, with the exception of unicode characters in strings.
Alternatives:
- ctoml is another C++11 implementation of a TOML
parser. The approach taken in both for parsing is similar, but the output
format is dramatically different---ctoml uses a compact
union
approach wherecpptoml
uses an inheritance hierarchy with type erasure. This means thatcpptoml
will use familiar standard types likestd::string
andstd::vector
, but potentially at the expense of runtime performance. - libtoml is a C implementation of a TOML parser, which can be linked to from your C++ programs easily.
The following two tests are the only failing tests from the toml-test suite.
Test: string-escapes (valid)
Error running test: Could not decode JSON output from parser: invalid character '\f' in string literal
-------------------------------------------------------------------------------
Test: unicode-escape (valid)
Error running test: exit status 1
54 passed, 2 failed
Requires a well conforming C++11 compiler. My recommendation is clang++ with libc++ and libc++abi, as this combination can't really be beat in terms of completed features + ABI support on Linux and OSX.
Compiling the examples can be done with cmake:
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug
See the root directory files parse.cpp
and parse_stdin.cpp
for an
example usage.