This implementation targets https://github.com/mojombo/toml commit 4f23be43e4.
Out of order tables are not yet supported:
[a.b]
value = 1
[a]
value = 2
MIT
tomlc
uses Lemon and re2c to generate its parser and lexer respectively.
- Lemon : http://www.hwaci.com/sw/lemon/
- re2c : http://re2c.org/
-
Install
re2c
. -
./waf configure build install
By default, this installs astoml
. -
Test with
build/toml-test
// TOML_parse and TOML_load create the root table for you.
TOMLTable *table = NULL;
// Load TOML from a file.
TOML_load( "test.toml", &table, NULL );
// Find the value we want.
TOMLRef value = TOML_find( table, "player", "size", NULL );
int size = TOML_int( value );
// Free the TOML hierarchy when you're done.
TOML_free( table );
Part of tomlc
is a tool called toml-lookup
that can be used to access parts of a toml file. For example toml-lookup test.toml "en.text[0].characterImage"
prints text-only
to stdout.