File syntax.
The syntax is similar to most of .ini
implementations as:
- a section is delimited by
[name]
can be redefined multiple times,
- an option must always be defined in a section,
- empty options must be surrounded by quotes,
- lists can not include trailing commas,
- include statements must always live at the beginning of files (in no sections),
- comments start with # until the end of line,
- options with spaces must use quotes.
Basic file
# This is a comment.
[section]
option1 = value1
option2 = "value 2 with spaces" # comment is also allowed here
Redefinition
Sections can be redefined multiple times and are kept the order they are seen.
[section]
value = "1"
[section]
value = "2"
The ini::document object will contains two ini::section.
Lists
Lists are defined using ()
and commas, like values, they may have quotes.
[section]
names = ( "x1", "x2" )
# This is also allowed.
biglist = (
"abc",
"def"
)
Include statement
You can split a file into several pieces, if the include statement contains a relative path, the path will be relative to the current file being parsed.
You must use the include statement before any section.
If the file contains spaces, use quotes.
# main.conf
@include "foo.conf"
# foo.conf
[section]
option1 = value1