Code Monkey home page Code Monkey logo

toml's Introduction

This is a TOML parser. It supports TOML 0.2.0, including arrays-of-tables. As of 2014-06-29 it passed all 64 tests in toml-test.

The format came to my attention after I read that Mozilla Rust's package manager is using this format. Since there wasn't currently a Racket parser for TOML, I thought I'd create one.

My motivation was only to get more experience using Parsack -- a Parsec-like monadic parser combinator library implementation in Racket -- after having used it in a markdown parser.

  • I did not make this available on the Racket package manager.

  • I do not have plans to update this to support TOML versions newer than 0.2.0.

  • I updated this 2019-08-19 to make it work with a breaking change in Parsack that happened many years ago. Beyond that, I do not plan to fix bugs or keep it up to date. In fact I might "archive" this repo on GitHub.

If you would like to fork this (or throw it away and start from scratch) you are welcome to do so!

Usage

(require toml)
(parse-toml s) ;; where `s` is a `string?`

Goals

  • Pass all toml-test tests for TOML 0.2.0.

  • Provide useful error messages with positions (line:col:ofs). Do so for both syntax errors and semantic errors (such as table conflicts).

  • Return a Racket hasheq that satisfies the json library's jsexpr? predicate, so that you can run it through jsexpr->string to produce a JSON string.

    Caveat: Any TOML datetime values are date structs, which won't satisfy jsexpr?. Originally I parsed these to a current-seconds-style integer value. But toml-tests needs things to be tagged with types, so that's why I had to switch. I should probably provide a conversion function to turn any such instances back into a datetime string so that it can be passed to jsexpr->string.

toml's People

Contributors

greghendershott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

toml's Issues

Add link in README on installing old version of parsack

Hi Greg,

I think a line in the readme about parsack is needed. Something like:

The Toml parser needs a specific version of the library parsack.
First install parsack as below, then install toml afterwards.

raco pkg install "git://github.com/stchang/parsack#beddbd2ba7de85745c1023a0177d16efd6fe16a1"

/Jens Axel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.