537eb30080
also: - fixed parsing table headers allowing invalid characters - fixed implicit fallthrough warnings - fixed some issues parsing dates and times - added `table::erase` - added `array::operator[]` - added `value::operator*` - added stream operators for date, time and date_time - added `impl::print_to_stream` - added more parsing diagnostics - added many tests
96 lines
1.7 KiB
TOML
96 lines
1.7 KiB
TOML
# This is a TOML document. Boom.
|
|
|
|
title = "TOML Example"
|
|
|
|
# plain signed integers
|
|
int1 = -9223372036854775808
|
|
int2 = 9223372036854775807
|
|
|
|
# floats
|
|
flt1 = 0.00000000001
|
|
flt2 = 1e-11
|
|
flt3 = 11.0
|
|
flt4 = +1.0
|
|
|
|
# hexadecimal with prefix `0x`
|
|
hex1 = 0xDEADBEEF
|
|
hex2 = 0xdeadbeef
|
|
hex3 = 0xdead_beef
|
|
|
|
# octal with prefix `0o`
|
|
oct1 = 0o01234567
|
|
oct2 = 0o755 # useful for Unix file permissions
|
|
|
|
# binary with prefix `0b`
|
|
bin1 = 0b11010110 # 214
|
|
|
|
# local dates and times
|
|
tim1 = 07:32:00
|
|
tim2 = 00:32:00.100000000
|
|
dat1 = 1979-05-27
|
|
|
|
# offset date-times
|
|
odt1 = 1979-05-27T07:32:00Z
|
|
odt2 = 1979-05-27T00:32:00-07:00
|
|
odt3 = 1979-05-27T00:32:00.999999-07:00
|
|
|
|
# unicode
|
|
kosme = "κόσμε"
|
|
|
|
arr = [ 'this', 'is', 'a', 'long', 'array', 'with', 16, 'elements.', 'it', 'should', 'be', 'printed', 'as', 'a', 'multiline', 'array.']
|
|
|
|
tab = { this = 'is', an = 'inline', table = 'yay'}
|
|
|
|
dotted.keys.are = "supported"
|
|
dotted.and = "implemented as tables"
|
|
|
|
[owner]
|
|
name = "Mark Gillard"
|
|
dob = 1987-03-16 10:20:00+09:30
|
|
|
|
[[owner.pets]]
|
|
name = "Brian"
|
|
species = "cat"
|
|
|
|
[[owner.pets]]
|
|
name = "Skippy"
|
|
species = "kangaroo"
|
|
|
|
[database]
|
|
server = "192.168.1.1"
|
|
ports = [ 8001, 8001, 8002 ]
|
|
connection_max = 5000
|
|
enabled = true
|
|
|
|
[servers]
|
|
|
|
# You can indent as you please. Tabs or spaces. TOML don't care.
|
|
[servers.alpha]
|
|
ip = "10.0.0.1"
|
|
dc = "eqdc10"
|
|
|
|
[servers.beta]
|
|
ip = "10.0.0.2"
|
|
dc = "eqdc10"
|
|
country = "中国" # This should be parsed as UTF-8
|
|
|
|
[clients]
|
|
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
|
|
|
|
# Line breaks are OK when inside arrays
|
|
hosts = [
|
|
"alpha",
|
|
"omega"
|
|
]
|
|
|
|
# Products
|
|
|
|
[[products]]
|
|
name = "Hammer"
|
|
sku = 738594937
|
|
|
|
[[products]]
|
|
name = "Nail"
|
|
sku = 284758393
|
|
color = "gray"
|