190 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|  0 400   0   # This is a full-line comment
 | |
|  0 400   0   key = "value"  # This is a comment at the end of a line
 | |
|  0 400   0   another = "# This is not a comment"
 | |
|  0 400   0   
 | |
|  0 400   0   key = "value"
 | |
|  0 400   0   bare_key = "value"
 | |
|  0 400   0   bare-key = "value"
 | |
|  0 400   0   1234 = "value"
 | |
|  0 400   0   
 | |
|  0 400   0   "127.0.0.1" = "value"
 | |
|  0 400   0   "character encoding" = "value"
 | |
|  0 400   0   "ʎǝʞ" = "value"
 | |
|  0 400   0   'key2' = "value"
 | |
|  0 400   0   'quoted "value"' = "value"
 | |
|  0 400   0   
 | |
|  0 400   0   fruit.name = "banana"     # this is best practice
 | |
|  0 400   0   fruit. color = "yellow"    # same as fruit.color
 | |
|  0 400   0   fruit . flavor = "banana"   # same as fruit.flavor
 | |
|  0 400   0   
 | |
|  0 400   0   name = "Orange"
 | |
|  0 400   0   physical.color = "orange"
 | |
|  0 400   0   physical.shape = "round"
 | |
|  0 400   0   site."google.com" = true
 | |
|  0 400   0   
 | |
|  0 400   0   str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
 | |
|  0 400   0   
 | |
|  0 400   0   str1 = """
 | |
|  0 400   0   Roses are red
 | |
|  0 400   0   Violets are blue"""
 | |
|  0 400   0   
 | |
|  0 400   0   # The following strings are byte-for-byte equivalent:
 | |
|  0 400   0   str1 = "The quick brown fox jumps over the lazy dog."
 | |
|  0 400   0   str2 = """
 | |
|  0 400   0   The quick brown \
 | |
|  0 400   0   
 | |
|  0 400   0   
 | |
|  0 400   0     fox jumps over \
 | |
|  0 400   0       the lazy dog."""
 | |
|  0 400   0   str3 = """\
 | |
|  0 400   0          The quick brown \
 | |
|  0 400   0          fox jumps over \
 | |
|  0 400   0          the lazy dog.\
 | |
|  0 400   0          """
 | |
|  0 400   0   
 | |
|  0 400   0   str4 = """Here are two quotation marks: "". Simple enough."""
 | |
|  0 400   0   # str5 = """Here are three quotation marks: """."""  # INVALID
 | |
|  0 400   0   str5 = """Here are three quotation marks: ""\"."""
 | |
|  0 400   0   str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""
 | |
|  0 400   0   # "This," she said, "is just a pointless statement."
 | |
|  0 400   0   str7 = """"This," she said, "is just a pointless statement.""""
 | |
|  0 400   0   
 | |
|  0 400   0   # What you see is what you get.
 | |
|  0 400   0   winpath  = 'C:\Users\nodejs\templates'
 | |
|  0 400   0   winpath2 = '\\ServerX\admin$\system32\'
 | |
|  0 400   0   quoted   = 'Tom "Dubs" Preston-Werner'
 | |
|  0 400   0   regex    = '<\i\c*\s*>'
 | |
|  0 400   0   
 | |
|  0 400   0   regex2 = '''I [dw]on't need \d{2} apples'''
 | |
|  0 400   0   lines  = '''
 | |
|  0 400   0   The first newline is
 | |
|  0 400   0   trimmed in raw strings.
 | |
|  0 400   0      All other whitespace
 | |
|  0 400   0      is preserved.
 | |
|  0 400   0   '''
 | |
|  0 400   0   
 | |
|  0 400   0   quot15 = '''Here are fifteen quotation marks: """""""""""""""'''
 | |
|  0 400   0   # 'That,' she said, 'is still pointless.'
 | |
|  0 400   0   str = ''''That,' she said, 'is still pointless.''''
 | |
|  0 400   0   
 | |
|  0 400   0   int1 = +99
 | |
|  0 400   0   int2 = 42
 | |
|  0 400   0   int3 = 0
 | |
|  0 400   0   int4 = -17
 | |
|  0 400   0   
 | |
|  0 400   0   int5 = 1_000
 | |
|  0 400   0   int6 = 5_349_221
 | |
|  0 400   0   int7 = 53_49_221  # Indian number system grouping
 | |
|  0 400   0   int8 = 1_2_3_4_5  # VALID but discouraged
 | |
|  0 400   0   
 | |
|  0 400   0   # hexadecimal with prefix `0x`
 | |
|  0 400   0   hex1 = 0xDEADBEEF
 | |
|  0 400   0   hex2 = 0xdeadbeef
 | |
|  0 400   0   hex3 = 0xdead_beef
 | |
|  0 400   0   
 | |
|  0 400   0   # octal with prefix `0o`
 | |
|  0 400   0   oct1 = 0o01234567
 | |
|  0 400   0   oct2 = 0o755 # useful for Unix file permissions
 | |
|  0 400   0   
 | |
|  0 400   0   # binary with prefix `0b`
 | |
|  0 400   0   bin1 = 0b11010110
 | |
|  0 400   0   
 | |
|  0 400   0   # fractional
 | |
|  0 400   0   flt1 = +1.0
 | |
|  0 400   0   flt2 = 3.1415
 | |
|  0 400   0   flt3 = -0.01
 | |
|  0 400   0   
 | |
|  0 400   0   # exponent
 | |
|  0 400   0   flt4 = 5e+22
 | |
|  0 400   0   flt5 = 1e06
 | |
|  0 400   0   flt6 = -2E-2
 | |
|  0 400   0   
 | |
|  0 400   0   # both
 | |
|  0 400   0   flt7 = 6.626e-34
 | |
|  0 400   0   
 | |
|  0 400   0   flt8 = 224_617.445_991_228
 | |
|  0 400   0   
 | |
|  0 400   0   # infinity
 | |
|  0 400   0   sf1 = inf  # positive infinity
 | |
|  0 400   0   sf2 = +inf # positive infinity
 | |
|  0 400   0   sf3 = -inf # negative infinity
 | |
|  0 400   0   
 | |
|  0 400   0   # not a number
 | |
|  0 400   0   sf4 = nan  # actual sNaN/qNaN encoding is implementation-specific
 | |
|  0 400   0   sf5 = +nan # same as `nan`
 | |
|  0 400   0   sf6 = -nan # valid, actual encoding is implementation-specific
 | |
|  0 400   0   
 | |
|  0 400   0   bool1 = true
 | |
|  0 400   0   bool2 = false
 | |
|  0 400   0   
 | |
|  0 400   0   odt1 = 1979-05-27T07:32:00Z
 | |
|  0 400   0   odt2 = 1979-05-27T00:32:00-07:00
 | |
|  0 400   0   odt3 = 1979-05-27T00:32:00.999999-07:00
 | |
|  0 400   0   odt4 = 1979-05-27 07:32:00Z
 | |
|  0 400   0   
 | |
|  0 400   0   ldt1 = 1979-05-27T07:32:00
 | |
|  0 400   0   ldt2 = 1979-05-27T00:32:00.999999
 | |
|  0 400   0   
 | |
|  0 400   0   ld1 = 1979-05-27
 | |
|  0 400   0   
 | |
|  0 400   0   lt1 = 07:32:00
 | |
|  0 400   0   lt2 = 00:32:00.999999
 | |
|  0 400   0   
 | |
|  0 400   0   integers = [ 1, 2, 3 ]
 | |
|  0 400   0   colors = [ "red", "yellow", "green" ]
 | |
|  0 400   0   nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ]
 | |
|  0 400   0   nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ]
 | |
|  0 400   0   string_array = [ "all", 'strings', """are the same""", '''type''' ]
 | |
|  0 400   0   
 | |
|  0 400   0   # Mixed-type arrays are allowed
 | |
|  0 400   0   numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]
 | |
|  0 400   0   contributors = [
 | |
|  0 400   0     "Foo Bar <foo@example.com>",
 | |
|  0 400   0     { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
 | |
|  0 400   0   ]
 | |
|  0 400   0   
 | |
|  0 400   0   integers2 = [
 | |
|  0 400   0     1, 2, 3
 | |
|  0 400   0   ]
 | |
|  0 400   0   
 | |
|  0 400   0   integers3 = [
 | |
|  0 400   0     1,
 | |
|  0 400   0     2, # this is ok
 | |
|  0 400   0   ]
 | |
|  0 400   0   
 | |
|  2 400   0 + [table-1]
 | |
|  0 401   0 | key1 = "some string"
 | |
|  0 401   0 | key2 = 123
 | |
|  0 401   0 | 
 | |
|  2 400   0 + [table-2]
 | |
|  0 401   0 | key1 = "another string"
 | |
|  0 401   0 | key2 = 456
 | |
|  0 401   0 | 
 | |
|  2 401   0 + [dog."tater.man"]
 | |
|  0 402   0 | type.name = "pug"
 | |
|  0 402   0 | 
 | |
|  0 402   0 | [a.b.c]            # this is best practice
 | |
|  0 402   0 | [ d.e.f ]          # same as [d.e.f]
 | |
|  0 402   0 | [ g .  h  . i ]    # same as [g.h.i]
 | |
|  2 402   0 + [ j . "ʞ" . 'l' ]  # same as [j."ʞ".'l']
 | |
|  0 403   0 | 
 | |
|  2 400   0 + [product]
 | |
|  0 401   0 | type = { name = "Nail" }
 | |
|  0 401   0 | 
 | |
|  2 400   0 + [[products]]
 | |
|  0 401   0 | name = "Hammer"
 | |
|  0 401   0 | sku = 738594937
 | |
|  0 401   0 | 
 | |
|  2 400   0 + [[products]]  # empty table within the array
 | |
|  0 401   0 | 
 | |
|  2 400   0 + [[products]]
 | |
|  0 401   0 | name = "Nail"
 | |
|  0 401   0 | sku = 284758393
 | |
|  0 401   0 | 
 | |
|  0 401   0 | points = [ { x = 1, y = 2, z = 3 },
 | |
|  0 401   0 |            { x = 7, y = 8, z = 9 },
 | |
|  0 401   0 |            { x = 2, y = 4, z = 8 } ]
 | |
|  0 401   0 | 
 | |
|  0 401   0 | invalid           # invalid, missing value
 | |
|  0 401   0 | key = identifier  # also invalid, identifier must be one of true, false, inf, nan
 | |
|  0 401   0 |  |