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
---@meta
local json =
---Encodes the value into a valid JSON string
---@param value table
---@return string
---Decodes the JSON string into a valid lua value
---@param value string
---@return table
local json5 =
---Encodes the value into a valid JSON5 string
---@param value table
---@return string
---Decodes the JSON5 string into a valid lua value
---@param value string
---@return table
local yaml =
---Encodes the value into a valid YAML string
---@param value table
---@return string
---Decodes the YAML string into a valid lua value
---@param value string
---@return table
local toml =
---Encodes the value into a valid TOML string
---@param value table
---@return string
---Decodes the TOML string into a valid lua value
---@param value string
---@return table
local ini =
---Encodes the value into a valid INI string
---@param value table
---@return string
---Decodes the INI string into a valid lua value
---@param value string
---@return table
local xml =
---Encodes the value into a valid XML string
---@param root string
---@param value table
---@return string
---Decodes the XML string into a valid lua value
---
---Note that overlapping lists and DOCTYPE are not supported.
---Trim them or use a specialized parsers for those documents. Especially HTML.
---
---Element contents are designated as `$text` and fields have a prefix of `@`
---@param value string
---@return table
---@class CSVOptions
---Set the capacity (in bytes) of the buffer used in the CSV reader.
---This defaults to a reasonable setting.
---@field buffer_capacity number?
---The field delimiter to use when parsing CSV. Defaults to ','
---@field delimiter string?
---The quote character to use when parsing CSV. The default is '"'.
---@field quote string?
---The escape character to use when parsing CSV. In some variants of CSV,
---quotes are escaped using a special escape character like \ (instead of
---escaping quotes by doubling them). By default, recognizing these
---idiosyncratic escapes is disabled.
---@field escape string?
---The comment character to use when parsing CSV. If the start of
---a record begins with the byte given here, then that line is
---ignored by the CSV parser. This is disabled by default.
---@field comment string?
---Whether the number of fields in records is allowed to change or not.
---When disabled (which is the default), parsing CSV data will return
---an error if a record is found with a number of fields different
---from the number of fields in a previous record. When enabled,
---this error checking is turned off.
---@field flexible boolean?
---Enable or disable quoting. This is enabled by default, but it may
---be disabled. When disabled, quotes are not treated specially.
---@field quoting boolean?
---Enable double quote escapes. This is enabled by default, but it may
---be disabled. When disabled, doubled quotes are not interpreted as escapes.
---@field double_quote boolean?
---hether to treat the first row as a special header row. By default,
---the first row is treated as a special header row, which means the
---header is never returned by any of the record reading methods or
---iterators. When this is disabled, the first row is not treated specially.
---@field has_headers boolean?
local csv =
---Decodes the CSV string into a valid lua value
---@param value string
---@param options CSVOptions?
---@return {body: any[], headers: string[]}
return