Skip to content

axelarge/tomelette

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

TOML parser for Scala 2.10

Compatibility

Seems to work fine with 00f11b019406531c8c7989846b1c1a54e9b8d8bb

Usage

val parser = new com.axelarge.tomelette.TomlParser

println(parser.parse("[some.toml] hi = 32"))
// Right(TDict(Map(some -> TDict(Map(toml -> TDict(Map(hi -> TLong(32))))))))

parser.parse(new FileReader("testdata/test.toml")).right.foreach { toml =>
  println(toml.get("owner.organization")) // Some(TString("GitHub"))
  println(toml.getAs[String]("servers.alpha.ip")) // Some("10.0.0.1")
  println(toml.getAs[Map[_,_]]("servers.beta")) // Some(Map(ip -> "10.0.0.2", dc -> "eqdc10"))
  println(toml.get("servers.beta")) // Some(TDict(Map(ip -> TString("10.0.0.2"), dc -> TString("eqdc10"))))
  println(toml.get("foo.blarg")) // None
}

##TODO

  • Fix the mess that is string unescaping
  • Actually make a jar
  • Incremental parsing
  • Type-safe accessors
  • etc

About

TOML for Scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages