/clj-toml

TOML for Clojure

Primary LanguageClojure

clj-toml

clj-toml is TOML for Clojure. TOML is Tom's Obvious, Minimal Language.

TOML is like INI, only better (Tom Preston-Werner)

clj-toml uses Instaparse for parsing. Instaparse does all the heavy lifting, we're just sitting pretty.

clj-toml comes with a decent collection of tests. It successfully parses the TOML hard example. Easy peasy.

Supported TOML version: v0.4.0

Usage

Work is underway towards a TOML 0.4.0-compliant release. Use the 0.3.1 release (TOML 0.1.0-compliant) in the meantime:

Leiningen:

[clj-toml "0.3.1"]

Test:

lein test

Use:

(use 'clj-toml.core)

(parse-string "
 title = \"TOML\"
 [Foo]
 bar=[1,2,3]")
;; {"title" "TOML" "foo" {"bar" [1 2 3]}}

TODO

The parser is pretty solid (thanks to Instaparse) and complete.

In a way it implements a superset of TOML, since it successfully parses

  • non-homogeneous arrays
  • TOML with duplicate keys

As the TOML specification stabilizes, we'll raise errors according to specification.

License

Copyright © 2013-2015 Luca Antiga.

Distributed under the Eclipse Public License, the same as Clojure.