RcppTOML (version 0.1.0)

parseTOML: Parse a TOML configuration file

Description

The parseTOML function parses ‘TOML’ (for ‘Tom's Obvious Markup Language’) files. The TOML format both highly readable and expressive, allows comments, indentation and other aspects suitable for human readers, contains typed objects yet allows everything similar configuration languages permit.

Usage

parseTOML(filename, verbose = FALSE)
"print" (x, ...) "summary" (object, ...)

Arguments

filename
A character object denoting a path and file (where tilde-expansion is performed as well).
verbose
A logical switch to turn on (very) verbose operation which can be useful in debugging a parsing issue in a file.
x
A toml object.
object
A toml object.
...
Furter arguments.

Value

A toml object is returned, which is really just a list object with a class attribute to allow for print and summary methods.

Details

The package uses the ‘cpptoml’ C++11 parser by Charles Geigle. This requires a recent-enough C++11 compiler which excludes one deployed by Rtools on Windows at the time the package was initially put together.

References

TOML: https://github.com/toml-lang/toml cpptoml: https://github.com/skystrife/cpptoml

Examples

Run this code
  library(RcppTOML)

  file <- system.file("toml", "example.toml", package="RcppTOML")

  toml <- parseTOML(file)  # given file, return parsed object

  summary(toml)            # really sparse summary method
  print(toml)              # print is a wrapper around str()

Run the code above in your browser using DataCamp Workspace