RcppTOML (version 0.1.3)

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(input, verbose = FALSE, fromFile=TRUE)

# S3 method for toml print (x, ...) # S3 method for toml summary (object, ...)

Arguments

input

A character object either denoting a path and file (where tilde-expansion is performed as well) from parsing from file, or a containing a suitable ‘TOML’ expression that is parsed from this expression.

verbose

A logical switch to turn on (very) verbose operation which can be useful in debugging a parsing issue in a file.

fromFile

A logical switch indicating whether input is interpreted as a filename (with path) which is to be parsed, or a whether the ‘TOML’ expression in the string is parsed; default is file mode.

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
# NOT RUN {
  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 DataLab