From 44992dd12054ae00331c176c01247d59df5ec4f2 Mon Sep 17 00:00:00 2001 From: hylo Date: Fri, 30 Dec 2022 17:53:13 +0100 Subject: [PATCH] docs: extend readme --- README.org | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/README.org b/README.org index 283f0cd..ca1fdd6 100644 --- a/README.org +++ b/README.org @@ -4,24 +4,34 @@ * guile-toml ** Installation -For now: add this folder to =GUILE_LOAD_PATH= +For now: add this folder to ~GUILE_LOAD_PATH~ ** Usage -Similar approach to =guile-json=. +When parsing and building TOML documents, guile-toml follows [[https://github.com/aconchillo/guile-json][guile-json]] as close as possible. TOML types correspon to Guile types according to the following table: -| TOML | Guile | -|--------------------+----------------------------------| -| string | string | -| number | number (TODO: octal etc, float?) | -| key-value pair | alist | -| array | vector | -| datetime etc | TODO | -| true | #t (TODO) | -| false | #f | -| nan | TODO | -| inf | TODO | -| small / big floats | TODO | -| unicode checking | TODO | +| TOML | Guile | +|----------------+------------------| +| string | string | +| key-value pair | alist | +| array | vector | +| integer/float | real | +| true | #t | +| false | #f | +| datetime | SRFI-19 date [1] | +| nan | +nan.0 | +| {+-}inf | {+-}inf.0 | -To start using: =(use-modules (toml))= -** Reading TOML documents -- =(toml->scm str)= +To start using guile-toml: ~(use-modules (toml))~ + +[1]: TOML's ~time-local~ is parsed same as a ~datetime-local~ on the date of ~1970-01-01~. + +*** Reading TOML documents +- ~(toml->scm str)~ + Reads a TOML document from the given string. +*** Building TOML documents +- ~(scm->toml native #:optional port)~ + Not implemented yet. +** Examples +#+begin_src scheme +> (toml->scm "[a]\n b.c = \"hi world\"") +(("a" ("b" ("c" . "hi world")))) +#+end_src