1 ################################################################################
4 # Speak your mind with the hash symbol. They go from the symbol to the end of
8 ################################################################################
11 # Tables (also known as hash tables or dictionaries) are collections of
12 # key/value pairs. They appear in square brackets on a line by themselves.
16 key = "value" # Yeah, you can do this.
18 # Nested tables are denoted by table names with dots in them. Name your tables
19 # whatever crap you please, just don't use #, ., [ or ].
25 # You don't need to specify all the super-tables if you don't want to. TOML
26 # knows how to do it for you.
31 [x.y.z.w] # for this to work
34 ################################################################################
37 # Inline tables provide a more compact syntax for expressing tables. They are
38 # especially useful for grouped data that can otherwise quickly become verbose.
39 # Inline tables are enclosed in curly braces `{` and `}`. No newlines are
40 # allowed between the curly braces unless they are valid within a value.
44 name = { first = "Tom", last = "Preston-Werner" }
45 point = { x = 1, y = 2 }
48 ################################################################################
51 # There are four ways to express strings: basic, multi-line basic, literal, and
52 # multi-line literal. All strings must contain only valid UTF-8 characters.
56 basic = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
60 # The following strings are byte-for-byte equivalent:
67 [string.multiline.continued]
69 # The following strings are byte-for-byte equivalent:
70 key1 = "The quick brown fox jumps over the lazy dog."
87 # What you see is what you get.
88 winpath = 'C:\Users\nodejs\templates'
89 winpath2 = '\\ServerX\admin$\system32\'
90 quoted = 'Tom "Dubs" Preston-Werner'
94 [string.literal.multiline]
96 regex2 = '''I [dw]on't need \d{2} apples'''
99 trimmed in raw strings.
105 ################################################################################
108 # Integers are whole numbers. Positive numbers may be prefixed with a plus sign.
109 # Negative numbers are prefixed with a minus sign.
118 [integer.underscores]
120 # For large numbers, you may use underscores to enhance readability. Each
121 # underscore must be surrounded by at least one digit.
124 key3 = 1_2_3_4_5 # valid but inadvisable
127 ################################################################################
130 # A float consists of an integer part (which may be prefixed with a plus or
131 # minus sign) followed by a fractional part and/or an exponent part.
151 key1 = 9_224_617.445_991_228_313
155 ################################################################################
158 # Booleans are just the tokens you're used to. Always lowercase.
166 ################################################################################
169 # Datetimes are RFC 3339 dates.
173 key1 = 1979-05-27T07:32:00Z
174 key2 = 1979-05-27T00:32:00-07:00
175 key3 = 1979-05-27T00:32:00.999999-07:00
178 ################################################################################
181 # Arrays are square brackets with other primitives inside. Whitespace is
182 # ignored. Elements are separated by commas. Data types may not be mixed.
187 key2 = [ "red", "yellow", "green" ]
188 key3 = [ [ 1, 2 ], [3, 4, 5] ]
189 #key4 = [ [ 1, 2 ], ["a", "b", "c"] ] # this is ok
191 # Arrays can also be multiline. So in addition to ignoring whitespace, arrays
192 # also ignore newlines between the brackets. Terminating commas are ok before
193 # the closing bracket.
204 ################################################################################
207 # These can be expressed by using a table name in double brackets. Each table
208 # with the same double bracketed name will be an element in the array. The
209 # tables are inserted in the order encountered.
225 # You can create nested arrays of tables as well.
235 name = "red delicious"
238 name = "granny smith"