mirror of
https://github.com/denoland/std.git
synced 2024-11-22 04:59:05 +00:00
148 lines
2.5 KiB
TOML
148 lines
2.5 KiB
TOML
# This is a TOML document.
|
|
|
|
title = "TOML Example"
|
|
|
|
[deeply.nested.object.in.the.toml]
|
|
name = "Tom Preston-Werner"
|
|
dob = 2009-05-27T07:32:00
|
|
|
|
[database]
|
|
server = "192.168.1.1"
|
|
ports = [ 8001, 8001, 8002 ]
|
|
connection_max = 5000
|
|
enabled = true
|
|
|
|
[servers]
|
|
|
|
# Indentation (tabs and/or spaces) is allowed but not required
|
|
[servers.alpha]
|
|
ip = "10.0.0.1"
|
|
dc = "eqdc10"
|
|
|
|
[servers.beta]
|
|
ip = "10.0.0.2"
|
|
dc = "eqdc10"
|
|
|
|
[clients]
|
|
data = [ ["gamma", "delta"], [1, 2] ]
|
|
|
|
# Line breaks are OK when inside arrays
|
|
hosts = [
|
|
"alpha",
|
|
"omega"
|
|
]
|
|
|
|
[strings]
|
|
str0 = "deno"
|
|
str1 = """
|
|
Roses are red
|
|
Violets are blue"""
|
|
# On a Unix system, the above multi-line string will most likely be the same as:
|
|
str2 = "Roses are red\nViolets are blue"
|
|
|
|
# On a Windows system, it will most likely be equivalent to:
|
|
str3 = "Roses are red\r\nViolets are blue"
|
|
str4 = "The quick brown fox jumps over the lazy dog."
|
|
str5 = "this is a \"quote\""
|
|
|
|
str5 = """
|
|
The quick brown \
|
|
|
|
|
|
fox jumps over \
|
|
the lazy dog."""
|
|
|
|
str6 = """\
|
|
The quick brown \
|
|
fox jumps over \
|
|
the lazy dog.\
|
|
"""
|
|
lines = '''
|
|
The first newline is
|
|
trimmed in raw strings.
|
|
All other whitespace
|
|
is preserved.
|
|
'''
|
|
|
|
[Integer]
|
|
int1 = +99
|
|
int2 = 42
|
|
int3 = 0
|
|
int4 = -17
|
|
int5 = 1_000
|
|
int6 = 5_349_221
|
|
int7 = 1_2_3_4_5 # VALID but discouraged
|
|
|
|
# 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
|
|
|
|
[Date-Time]
|
|
odt1 = 1979-05-27T07:32:00Z
|
|
odt2 = 1979-05-27T00:32:00-07:00
|
|
odt3 = 1979-05-27T00:32:00.999999-07:00
|
|
odt4 = 1979-05-27 07:32:00Z
|
|
ld1 = 1979-05-27
|
|
lt1 = 07:32:00 #buggy
|
|
lt2 = 00:32:00.999999 #buggy
|
|
|
|
[boolean]
|
|
bool1 = true
|
|
bool2 = false
|
|
|
|
[float]
|
|
# fractional
|
|
flt1 = +1.0
|
|
flt2 = 3.1415
|
|
flt3 = -0.01
|
|
|
|
# exponent
|
|
flt4 = 5e+22
|
|
flt5 = 1e6
|
|
flt6 = -2E-2
|
|
|
|
# both
|
|
flt7 = 6.626e-34
|
|
flt8 = 224_617.445_991_228
|
|
# infinity
|
|
sf1 = inf # positive infinity
|
|
sf2 = +inf # positive infinity
|
|
sf3 = -inf # negative infinity
|
|
|
|
# not a number
|
|
sf4 = nan # actual sNaN/qNaN encoding is implementation specific
|
|
sf5 = +nan # same as `nan`
|
|
sf6 = -nan # valid, actual encoding is implementation specific
|
|
|
|
[Table]
|
|
name = { first = "Tom", last = "Preston-Werner" }
|
|
point = { x = 1, y = 2 }
|
|
animal = { type.name = "pug" }
|
|
|
|
[[fruit]]
|
|
name = "apple"
|
|
|
|
[fruit.physical]
|
|
color = "red"
|
|
shape = "round"
|
|
|
|
[[fruit.variety]]
|
|
name = "red delicious"
|
|
|
|
[[fruit.variety]]
|
|
name = "granny smith"
|
|
|
|
[[fruit]]
|
|
name = "banana"
|
|
|
|
[[fruit.variety]]
|
|
name = "plantain"
|