TOML-XS
view release on metacpan or search on metacpan
tomlc17/simple/repro.c view on Meta::CPAN
#include <string.h>
const char *PATH = "/tmp/t.toml";
static void setup() {
const char *text =
"[default]\n"
"\n"
"[wayland_displays.\"$WAYLAND_DISPLAY\"]\n"
"seats = [ \"$XDG_SEAT\" ] \n"
"[[clipboards.Default.mime_type_groups]]\n"
"group = [ \"TEXT\", \"STRING\", \"UTF8_STRING\", \"text/plain\" ]\n"
"xxxx xx xx\n";
(void)text;
FILE *fp = fopen(PATH, "w");
fprintf(fp, "%s", text);
fclose(fp);
}
static void run() {
tomlc17/simple/repro.c view on Meta::CPAN
toml_result_t root = toml_parse_file_ex(PATH);
if (!root.ok) {
fprintf(stderr, "toml_parse_file_ex: %s\n", root.errmsg);
toml_free(root);
exit(-1);
}
toml_datum_t wayland_displays =
toml_seek(root.toptab, "main.wayland_displays");
toml_datum_t clipboards = toml_seek(root.toptab, "main.clipboards");
(void)
toml_free(root);
}
int main() {
setup();
run();
return 0;
}
tomlc17/test/parser/good/100.out view on Meta::CPAN
{
"main": {
"wayland_displays": [{"type": "string", "value": "$WAYLAND_DISPLAY"}],
"clipboards": [{"type": "string", "value": "Default"}]
},
"default": {
"connection_timeout": {"type": "integer", "value": "500"},
"data_timeout": {"type": "integer", "value": "500"},
"max_entries": {"type": "integer", "value": "100"},
"max_entries_memory": {"type": "integer", "value": "10"}
},
"wayland_displays": {
"$WAYLAND_DISPLAY": {
"connection_timeout": {"type": "integer", "value": "500"},
"data_timeout": {"type": "integer", "value": "500"},
"seats": [{"type": "string", "value": "$XDG_SEAT"}],
"$XDG_SEAT": {
"clipboard": {"type": "string", "value": "Default"},
"regular": {"type": "bool", "value": "true"},
"primary": {"type": "bool", "value": "false"}
}
}
},
"clipboards": {
"Default": {
"max_entries": {"type": "integer", "value": "10"},
"max_entries_memory": {"type": "integer", "value": "5"},
"allowed_mime_types": [{"type": "string", "value": "text/*"}, {"type": "string", "value": "image/*"}],
"mime_type_groups": [{
"mime_type": {"type": "string", "value": "text/plain;charset=utf-8"},
"group": [{"type": "string", "value": "TEXT"}, {"type": "string", "value": "STRING"}, {"type": "string", "value": "UTF8_STRING"}, {"type": "string", "value": "text/plain"}]
}]
}
}
tomlc17/test/parser/in/100.toml view on Meta::CPAN
# Configuration file
[main]
wayland_displays = [ "$WAYLAND_DISPLAY" ]
clipboards = [ "Default" ]
[default]
connection_timeout = 500
data_timeout = 500
max_entries = 100
max_entries_memory = 10
[wayland_displays."$WAYLAND_DISPLAY"]
connection_timeout = 500
data_timeout = 500
seats = [ "$XDG_SEAT" ]
[wayland_displays."$WAYLAND_DISPLAY"."$XDG_SEAT"]
clipboard = "Default"
regular = true
primary = false
[clipboards.Default]
max_entries = 10
max_entries_memory = 5
allowed_mime_types = [ "text/*", "image/*" ]
[[clipboards.Default.mime_type_groups]]
mime_type = "text/plain;charset=utf-8"
group = [ "TEXT", "STRING", "UTF8_STRING", "text/plain" ]
( run in 1.415 second using v1.01-cache-2.11-cpan-84e82930d8c )