Code Monkey home page Code Monkey logo

toml's Introduction

This is a TOML parser. It supports TOML v0.2.0, including arrays-of-tables. As of 2014-06-29 it passes 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 isn't currently a Racket parser for TOML, I thought I'd create one.

Usage

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

Goals

  • Pass all toml-test tests.

  • 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.

Implementation

Uses Parsack, a Parsec-like monadic parser combinator library implementation in Racket.

toml's People

Watchers

James Cloos avatar  avatar

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.