/toml-idr

A TOML parser for Idris 2

Primary LanguageIdris

toml-idr

A TOML parser for Idris 2.

State of implementation

Supported values:

  • integers (without _ separators TODO)
  • floats (without _ separators TODO)
  • strings (only \" escape is supported for now TODO)
  • multi-line strings
  • literal strings
  • multi-line literal strings
  • booleans
  • arrays
  • inline tables
  • Offset Date-Time
  • Local Date-Time
  • Local Date
  • Local Time

Arrays of tables ([[thing]]) are currently not supported. Work in progress

Since literal strings and not supported yet, they are also not supported in keys. Work in progress

Installation

At least version 0.3.0 of the Idris 2 compiler is required.

idris2 --install toml.ipkg

Usage

After installing the package, add toml to the depends section in the .ipkg file.

To parse a TOML file, the parseTOML function in the Language.TOML module can be used.

Values are represented with the Value type.

A file is represented as one Table. A Table is a SortedMap, so lookup, insert and friends will work as usual. To lookup nested keys (such as ["animal", "type", "name"]) the lookupNested function can be used.

Development

To run the tests, run make tests. The tests need the tester package to be installed

The command make clear will clean the build directory.

License

All code is licensed under the MPL-2.0.

All files that are not properly copyrightable are in the public domain, using the CC0 license.

This project aims to be REUSE compliant.