docs: extend readme

This commit is contained in:
hylo 2022-12-30 17:53:13 +01:00
parent f32f6e9155
commit 44992dd120
1 changed files with 28 additions and 18 deletions

View File

@ -4,24 +4,34 @@
* guile-toml * guile-toml
** Installation ** Installation
For now: add this folder to =GUILE_LOAD_PATH= For now: add this folder to ~GUILE_LOAD_PATH~
** Usage ** 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 | | TOML | Guile |
|--------------------+----------------------------------| |----------------+------------------|
| string | string | | string | string |
| number | number (TODO: octal etc, float?) | | key-value pair | alist |
| key-value pair | alist | | array | vector |
| array | vector | | integer/float | real |
| datetime etc | TODO | | true | #t |
| true | #t (TODO) | | false | #f |
| false | #f | | datetime | SRFI-19 date [1] |
| nan | TODO | | nan | +nan.0 |
| inf | TODO | | {+-}inf | {+-}inf.0 |
| small / big floats | TODO |
| unicode checking | TODO |
To start using: =(use-modules (toml))= To start using guile-toml: ~(use-modules (toml))~
** Reading TOML documents
- =(toml->scm str)= [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