RcppTOML-package.Rd
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.
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.
TOML: https://toml.io/en/
library(RcppTOML)
file <- system.file("toml", "example.toml", package="RcppTOML")
toml <- parseTOML(file) # given file, return parsed object
summary(toml) # really sparse summary method
#> toml object with top-level slots:
#> clients, database, owner, servers, title
#> read from '/tmp/Rtmp20YU5v/temp_libpath36e237fc15e35/RcppTOML/toml/example.toml'
print(toml) # print is a wrapper around str()
#> List of 5
#> $ clients :List of 2
#> ..$ data :List of 2
#> .. ..$ : chr [1:2] "gamma" "delta"
#> .. ..$ : int [1:2] 1 2
#> ..$ hosts: chr [1:2] "alpha" "omega"
#> $ database:List of 4
#> ..$ connection_max: int 5000
#> ..$ enabled : logi TRUE
#> ..$ ports : int [1:3] 8001 8001 8002
#> ..$ server : chr "192.168.1.1"
#> $ owner :List of 2
#> ..$ dob : POSIXct[1:1], format: "1979-05-27 15:32:00"
#> ..$ name: chr "Tom Preston-Werner"
#> $ servers :List of 2
#> ..$ alpha:List of 2
#> .. ..$ dc: chr "eqdc10"
#> .. ..$ ip: chr "10.0.0.1"
#> ..$ beta :List of 2
#> .. ..$ dc: chr "eqdc10"
#> .. ..$ ip: chr "10.0.0.2"
#> $ title : chr "TOML Example"