A TOML language implementation in Haxe
Haxe Shell
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cli_test
resources/test_files
src update version number to v0.1.5 Apr 15, 2013
.gitignore
LICENSE
README.md
cli_test.hxml
development.hxml
local_install.sh

README.md

Haxetoml

A Haxe implementation of TOML v0.1.0 language.

Install

haxelib install haxetoml

Usage

Given foo.toml:

[foo]
a = 1

[foo.bar]
b = ["2", "3"]

You can parse it with:

import sys.io.File;

var toml = File.getContent('foo.toml');
var parser = new haxetoml.TomlParser();

var parsed = parser.parse(toml);

parsed.foo; // => 1
parsed.foo.bar[1]; // => "3"

There are also some shortcut methods:

var fileContent = File.getContent('foo.toml');
var parsed = haxetoml.TomlParser.parseString(fileContent);

// or this shortcut, available on neko, cpp and php:
var parsed = haxetoml.TomlParser.parseFile('foo.toml');

Manually Test

Compile the test program first:

$ haxe cli_test.hxml

Run it:

# You can replace 'simple' with 'harder', 'empty' or whatever file name in resources/test_files
# C++
cli_test/bin/cpp/ParserTest simple
# Neko
neko cli_test/bin/ParserTest.n simple

To-Do

  • Set default value
  • Compile-time parsing with marco
  • Stringify