Type: | Package |
Title: | 'Rcpp' Bindings to Parser for "Tom's Obvious Markup Language" |
Version: | 0.2.3 |
Date: | 2025-03-08 |
Description: | The configuration format defined by 'TOML' (which expands to "Tom's Obvious Markup Language") specifies an excellent format (described at https://toml.io/en/) suitable for both human editing as well as the common uses of a machine-readable format. This package uses 'Rcpp' to connect to the 'toml++' parser written by Mark Gillard to R. |
SystemRequirements: | A C++17 compiler |
BugReports: | https://github.com/eddelbuettel/rcpptoml/issues |
URL: | http://dirk.eddelbuettel.com/code/rcpp.toml.html |
Imports: | Rcpp (≥ 1.0.8) |
Depends: | R (≥ 3.3.0) |
LinkingTo: | Rcpp |
Suggests: | tinytest |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | yes |
Packaged: | 2025-03-08 13:54:57 UTC; edd |
Author: | Dirk Eddelbuettel |
Maintainer: | Dirk Eddelbuettel <edd@debian.org> |
Repository: | CRAN |
Date/Publication: | 2025-03-08 14:30:06 UTC |
R Access to Parser for TOML (Tom's Obvious Markup Language)
Description
TOML (“Tom's Obvious Markup Language”) is a configuration file grammar for humans. It is easier to read and edit than the alternatives yet arguably more useful as it is stronly types: values come back as integer, double, (multiline-) character (strings), boolean or Datetime. Moreover, complex nesting and arrays are supported as well.
Details
At present, a single parsing function parseTOML
(with
convenience aliases tomlparse
and parseToml
) is implemented.
It returns a list object corresponding to the configuration from
the supplied file.
Author(s)
Dirk Eddelbuettel put togther the R package. Charles Geigle wrote the cpptoml parser. Tom Preston-Werner is the Tom behind TOML.
Maintainer: Dirk Eddelbuettel <edd@debian.org>
References
TOML: https://toml.io/en/
Examples
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()
Parse a TOML file
Description
The function parseTOML
, also aliased to tomlparse
and parseToml
,
parse TOML content inout. This is usually a file given by its name, or a character variable
with a TOML expression.
Usage
parseTOML(input, verbose = FALSE, fromFile = TRUE, includize = FALSE,
escape = TRUE)
tomlparse(...)
parseToml(...)
## S3 method for class 'toml'
print(x, ...)
## S3 method for class 'toml'
summary(object, ...)
Arguments
input |
[character] TOML input, either as chracter value or path to TOML file |
verbose |
[logical] Optional verbosity flag, no current effect |
fromFile |
[logical] Optional with default value ‘TRUE’ indicating parsing from file |
includize |
[logical] Optional legacy option, no current effect |
escape |
[logical] Optional boolean whether strings should be escaped, defaults to ‘TRUE’ |
... |
Used for aliased function and S3 methods |
x |
Used for S3 method |
object |
Used for S3 method |
Details
This implementation uses the ‘tomlplusplus’ library by Mark Gillar (see https://github.com/marzer/tomlplusplus) which is TOML 1.0 compliant. In earlier work the package used the ‘cpptoml’ library by Chase Geigle (see https://github.com/skystrife/cpptoml for which development ceased once TOML 0.5.0 parity was reached.
Value
A list object with the parsed content as an S3 object of class ‘toml’