File: toml

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (206 lines) | stat: -rw-r--r-- 4,849 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# This is a TOML document. Boom.

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
organization = "GitHub"
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
# First class dates? Why not?
dob = [
  1979-05-27T07:32:00Z,
  1979-05-27 07:32:00
  1979-05-27,
  07:32:00,
]

[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"

[dog."tater.man"]
type.name = "pug"

[a.b.c]            # this is best practice
[ d.e.f ]          # same as [d.e.f]
[ g .  h  . i ]    # same as [g.h.i]
[ j . "ʞ" . 'l' ]  # same as [j."ʞ".'l']

[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"
]

funky = "I'm a string. \"You can quote me\". Tab \t newline \n you get it."
right = "C:\\Users\\nodejs\\templates"
wrong = "C:\Users\nodejs\templates" # note: doesn't produce a valid path

# What you see is what you get - no escapes
winpath  = 'C:\Users\nodejs\templates'
winpath2 = '\\ServerX\admin$\system32\'
quoted   = 'Tom "Dubs" Preston-Werner'
regex    = '<\i\c*\s*>'
wrong    = 'no multiline - but rest of lex is okay

# multiline
regex2 = '''I [dw]on't need \d{2} apples'''
lines  = '''
The first newline is
trimmed in raw strings.
   All other whitespace
   is preserved.
'''

str4 = """Here are two quotation marks: "". Simple enough."""
# str5 = """Here are three quotation marks: """."""  # INVALID
str5 = """Here are three quotation marks: ""\"."""
str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""

# "This," she said, "is just a pointless statement."
str7 = """"This," she said, "is just a pointless statement."""
# The following strings are byte-for-byte equivalent:
str1 = "The quick brown fox jumps over the lazy dog."

str2 = """
The quick brown \


  fox jumps over \
    the lazy dog."""

str3 = """\
       The quick brown \
       fox jumps over \
       the lazy dog.\
       """

# Test file for TOML
# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate
# This part you'll really hate

[the]
test_string = "You'll hate me after this - #"          # " Annoying, isn't it?

    [the.hard]
    test_array = [ "] ", " # "]      # ] There you go, parse this!
    test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ]
    # You didn't think it'd as easy as chucking out the last #, did you?
    another_test_string = " Same thing, but with a string #"
    harder_test_string = " And when \"'s are in the string, along with # \""   # "and comments are there too"
    # Things will get harder
    
        [the.hard."bit#"]
        "what?" = "You don't think some user won't do that?"
        multi_line_array = [
            "]",
            "Oi!\n",
            # ] Oh yes I did
            ]

# Inline table
name = { first = "Tom", last = "Preston-Werner" }
point = { x = 1, y = 2 }
'student names' = { "first name" = "Tom", "last name" = "Preston-Werner" }

# Quoted keys
"127.0.0.1" = "value"
"character encoding" = "value"
"ʎǝʞ" = "value"
'key2' = "value"
'quoted "value"' = "value"
"東京都" = 123

# Array
integers = [ 1, 2, 3 ]
colors = [ "red", "yellow", "green" ]
nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
string_array = [ "all", 'strings', """are the same""", '''type''' ]
link-libraries = ["mylib::mylib"]
points = [ { x = 1, y = 2 }, { x = 3, y = 4 } ]

# Dotted keys
physical.color = "orange"
physical.shape = "round"
site."google.com" = true

# floating point numbers
float_space1 = 3.141_592_653
float_space2 = 123_456.789_012e+1_000
just_inf = inf
pos_inf  = +inf
neg_inf  = -inf
just_nan = nan
pos_nan  = +nan
neg_nan  = -nan

# integer formats
dec         = 123456
dec_spacing = 123_456
hex         = 0xdeadBEEF
hex_spacing = 0xdead_BEEF
oct         = 0o755
oct_spacing = 0o755_777
bin         = 0b1100
bin_spacing = 0b0101_1100

[[products]]
name = "array of table"
sku = 738594937
emptyTableAreAllowed = true

[[products]]

[[products]]
name = "Nail"
sku = 284758393
color = "gray"

[special-floats]
inflection = "don't highlight"
influxdb = 1

nan = nan

inf-1 = inf
inf-2 = [inf, +nan, -nan, +inf, -inf]
inf-3 = {inf=inf, nan=nan}

str-inf-1 = 'inf'
str-inf-2 = "inf"
str-inf-3 = """ inf nan
  inf nan
"""
str-inf-4 = """ inf nan
  inf nan
"""

[tool.poetry.dependencies]
python = ">=3.10,<3.11"
idna = "3.4"
inflection = "0.5.1"
influxdb = "5.3.1"
requests = "2.28.1"
pywinpty = {version = ">=1.1.0", markers = "os_name == \"nt\""}

dependencies = [
  "aiohttp>=3.11.16,<4.0.0",
  "backoff>=2.2.1,<3.0.0",
]