A header-only library for parsing TOML configuration files.
Targets: TOML v0.4.0
It is reasonably conforming, with the exception of unicode escape characters in strings. This includes support for the new DateTime format, inline tables, multi-line basic and raw strings, and digit separators.
Alternatives:
- ctoml and tinytoml are both C++11 implementations of a TOML parser, but only support v0.2.0.
- libtoml is a C implementation of a TOML parser, which can be linked to from your C++ programs easily. It supports only v0.2.0 also.
The following two tests are the only failing tests from the toml-test suite.
Test: string-escapes (valid)
Parsing failed: Invalid escape sequence at line 9
-------------------------------------------------------------------------------
Test: unicode-escape (valid)
Parsing failed: Invalid escape sequence at line 1
76 passed, 2 failed
Requires a well conforming C++11 compiler. On OSX this means clang++ with libc++ and libc++abi (the default clang installed with XCode's command line tools is sufficient).
On Linux, you should be able to use g++ >= 4.8.x, or clang++ with libc++ and libc++abi (if your package manager supplies this; most don't).
Compiling the examples can be done with cmake:
mkdir build
cd build
cmake ../
make
Compile it on Linux, OS X and Windows (MinGW 4.9 and Visual Studio 12) with biicode:
bii init -L
bii build
See the root directory files parse.cpp
and parse_stdin.cpp
for an
example usage.
bii init -L
Fill your biicode.conf
file just like this:
[requirements]
skystrife/cpptoml: 0
[includes]
cpptoml.h :skystrife/cpptoml/include
bii build
and you're ready to go! (An example block is available here:
amalulla/parse-toml)