TOML

Usage

use TOML;

Submodules

Chapel's Library for Tom's Obvious, Minimal Language (TOML). This module provides support for parsing and writing toml files.

Note

The planned features and known limitations of this module can be found in Improve Toml issue.

proc parseToml(input: file): unmanaged Toml

Receives a TOML file as a parameter and outputs a Toml object.

use TOML;

const tomlFile = open("example.toml", iomode.r);
const toml = parseToml(tomlFile);

To read tables of a TOML file, use the same syntax as accessing associative arrays. For example, to access to the following TOML file's project name,

[root]
name = "example"
version = "1.0.0"
author = "Sam Partee"

Use the following code in chapel.

use TOML;

const tomlFile = open("example.toml", iomode.r);
const toml = parseToml(tomlFile);
const projectName = ["root"]["name"] // returns a TOML object
writeln(projectName.toString());     // to turn TOML object into string representation
proc parseToml(input: channel): unmanaged Toml

Receives a channel to a TOML file as a parameter and outputs a Toml object.

proc parseToml(input: string): unmanaged Toml

Receives a string of TOML format as a parameter and outputs a Toml object

class TomlError: Error
var msg: string
proc init(msg: string)
override proc message()