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
** 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