@optique/core 0.5.0-dev.79 → 0.5.0-dev.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1100 @@
1
+ import { Message } from "./message.js";
2
+ import { Parser, ParserResult } from "./parser.js";
3
+
4
+ //#region src/constructs.d.ts
5
+
6
+ /**
7
+ * Options for customizing error messages in the {@link or} combinator.
8
+ * @since 0.5.0
9
+ */
10
+ interface OrOptions {
11
+ /**
12
+ * Error message customization options.
13
+ */
14
+ errors?: OrErrorOptions;
15
+ }
16
+ /**
17
+ * Options for customizing error messages in the {@link or} parser.
18
+ * @since 0.5.0
19
+ */
20
+ interface OrErrorOptions {
21
+ /**
22
+ * Custom error message when no parser matches.
23
+ */
24
+ noMatch?: Message;
25
+ /**
26
+ * Custom error message for unexpected input.
27
+ * Can be a static message or a function that receives the unexpected token.
28
+ */
29
+ unexpectedInput?: Message | ((token: string) => Message);
30
+ }
31
+ /**
32
+ * Creates a parser that combines two mutually exclusive parsers into one.
33
+ * The resulting parser will try each of the provided parsers in order,
34
+ * and return the result of the first successful parser.
35
+ * @template TA The type of the value returned by the first parser.
36
+ * @template TB The type of the value returned by the second parser.
37
+ * @template TStateA The type of the state used by the first parser.
38
+ * @template TStateB The type of the state used by the second parser.
39
+ * @param a The first {@link Parser} to try.
40
+ * @param b The second {@link Parser} to try.
41
+ * @returns A {@link Parser} that tries to parse using the provided parsers
42
+ * in order, returning the result of the first successful parser.
43
+ */
44
+ declare function or<TA, TB, TStateA, TStateB>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>): Parser<TA | TB, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>]>;
45
+ /**
46
+ * Creates a parser that combines three mutually exclusive parsers into one.
47
+ * The resulting parser will try each of the provided parsers in order,
48
+ * and return the result of the first successful parser.
49
+ * @template TA The type of the value returned by the first parser.
50
+ * @template TB The type of the value returned by the second parser.
51
+ * @template TC The type of the value returned by the third parser.
52
+ * @template TStateA The type of the state used by the first parser.
53
+ * @template TStateB The type of the state used by the second parser.
54
+ * @template TStateC The type of the state used by the third parser.
55
+ * @param a The first {@link Parser} to try.
56
+ * @param b The second {@link Parser} to try.
57
+ * @param c The third {@link Parser} to try.
58
+ * @return A {@link Parser} that tries to parse using the provided parsers
59
+ * in order, returning the result of the first successful parser.
60
+ */
61
+ declare function or<TA, TB, TC, TStateA, TStateB, TStateC>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>): Parser<TA | TB | TC, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>]>;
62
+ /**
63
+ * Creates a parser that combines four mutually exclusive parsers into one.
64
+ * The resulting parser will try each of the provided parsers in order,
65
+ * and return the result of the first successful parser.
66
+ * @template TA The type of the value returned by the first parser.
67
+ * @template TB The type of the value returned by the second parser.
68
+ * @template TC The type of the value returned by the third parser.
69
+ * @template TD The type of the value returned by the fourth parser.
70
+ * @template TStateA The type of the state used by the first parser.
71
+ * @template TStateB The type of the state used by the second parser.
72
+ * @template TStateC The type of the state used by the third parser.
73
+ * @template TStateD The type of the state used by the fourth parser.
74
+ * @param a The first {@link Parser} to try.
75
+ * @param b The second {@link Parser} to try.
76
+ * @param c The third {@link Parser} to try.
77
+ * @param d The fourth {@link Parser} to try.
78
+ * @return A {@link Parser} that tries to parse using the provided parsers
79
+ * in order, returning the result of the first successful parser.
80
+ */
81
+ declare function or<TA, TB, TC, TD, TStateA, TStateB, TStateC, TStateD>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>): Parser<TA | TB | TC | TD, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>]>;
82
+ /**
83
+ * Creates a parser that combines five mutually exclusive parsers into one.
84
+ * The resulting parser will try each of the provided parsers in order,
85
+ * and return the result of the first successful parser.
86
+ * @template TA The type of the value returned by the first parser.
87
+ * @template TB The type of the value returned by the second parser.
88
+ * @template TC The type of the value returned by the third parser.
89
+ * @template TD The type of the value returned by the fourth parser.
90
+ * @template TE The type of the value returned by the fifth parser.
91
+ * @template TStateA The type of the state used by the first parser.
92
+ * @template TStateB The type of the state used by the second parser.
93
+ * @template TStateC The type of the state used by the third parser.
94
+ * @template TStateD The type of the state used by the fourth parser.
95
+ * @template TStateE The type of the state used by the fifth parser.
96
+ * @param a The first {@link Parser} to try.
97
+ * @param b The second {@link Parser} to try.
98
+ * @param c The third {@link Parser} to try.
99
+ * @param d The fourth {@link Parser} to try.
100
+ * @param e The fifth {@link Parser} to try.
101
+ * @return A {@link Parser} that tries to parse using the provided parsers
102
+ * in order, returning the result of the first successful parser.
103
+ */
104
+ declare function or<TA, TB, TC, TD, TE, TStateA, TStateB, TStateC, TStateD, TStateE>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>): Parser<TA | TB | TC | TD | TE, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>]>;
105
+ /**
106
+ * Creates a parser that combines six mutually exclusive parsers into one.
107
+ * The resulting parser will try each of the provided parsers in order,
108
+ * and return the result of the first successful parser.
109
+ * @template TA The type of the value returned by the first parser.
110
+ * @template TB The type of the value returned by the second parser.
111
+ * @template TC The type of the value returned by the third parser.
112
+ * @template TD The type of the value returned by the fourth parser.
113
+ * @template TE The type of the value returned by the fifth parser.
114
+ * @template TF The type of the value returned by the sixth parser.
115
+ * @template TStateA The type of the state used by the first parser.
116
+ * @template TStateB The type of the state used by the second parser.
117
+ * @template TStateC The type of the state used by the third parser.
118
+ * @template TStateD The type of the state used by the fourth parser.
119
+ * @template TStateE The type of the state used by the fifth parser.
120
+ * @template TStateF The type of the state used by the sixth parser.
121
+ * @param a The first {@link Parser} to try.
122
+ * @param b The second {@link Parser} to try.
123
+ * @param c The third {@link Parser} to try.
124
+ * @param d The fourth {@link Parser} to try.
125
+ * @param e The fifth {@link Parser} to try.
126
+ * @param f The sixth {@link Parser} to try.
127
+ * @return A {@link Parser} that tries to parse using the provided parsers
128
+ * in order, returning the result of the first successful parser.
129
+ * @since 0.3.0
130
+ */
131
+ declare function or<TA, TB, TC, TD, TE, TF, TStateA, TStateB, TStateC, TStateD, TStateE, TStateF>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>, f: Parser<TF, TStateF>): Parser<TA | TB | TC | TD | TE | TF, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>] | [5, ParserResult<TStateF>]>;
132
+ /**
133
+ * Creates a parser that combines seven mutually exclusive parsers into one.
134
+ * The resulting parser will try each of the provided parsers in order,
135
+ * and return the result of the first successful parser.
136
+ * @template TA The type of the value returned by the first parser.
137
+ * @template TB The type of the value returned by the second parser.
138
+ * @template TC The type of the value returned by the third parser.
139
+ * @template TD The type of the value returned by the fourth parser.
140
+ * @template TE The type of the value returned by the fifth parser.
141
+ * @template TF The type of the value returned by the sixth parser.
142
+ * @template TG The type of the value returned by the seventh parser.
143
+ * @template TStateA The type of the state used by the first parser.
144
+ * @template TStateB The type of the state used by the second parser.
145
+ * @template TStateC The type of the state used by the third parser.
146
+ * @template TStateD The type of the state used by the fourth parser.
147
+ * @template TStateE The type of the state used by the fifth parser.
148
+ * @template TStateF The type of the state used by the sixth parser.
149
+ * @template TStateG The type of the state used by the seventh parser.
150
+ * @param a The first {@link Parser} to try.
151
+ * @param b The second {@link Parser} to try.
152
+ * @param c The third {@link Parser} to try.
153
+ * @param d The fourth {@link Parser} to try.
154
+ * @param e The fifth {@link Parser} to try.
155
+ * @param f The sixth {@link Parser} to try.
156
+ * @param g The seventh {@link Parser} to try.
157
+ * @return A {@link Parser} that tries to parse using the provided parsers
158
+ * in order, returning the result of the first successful parser.
159
+ * @since 0.3.0
160
+ */
161
+ declare function or<TA, TB, TC, TD, TE, TF, TG, TStateA, TStateB, TStateC, TStateD, TStateE, TStateF, TStateG>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>, f: Parser<TF, TStateF>, g: Parser<TG, TStateG>): Parser<TA | TB | TC | TD | TE | TF | TG, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>] | [5, ParserResult<TStateF>] | [6, ParserResult<TStateG>]>;
162
+ /**
163
+ * Creates a parser that combines eight mutually exclusive parsers into one.
164
+ * The resulting parser will try each of the provided parsers in order,
165
+ * and return the result of the first successful parser.
166
+ * @template TA The type of the value returned by the first parser.
167
+ * @template TB The type of the value returned by the second parser.
168
+ * @template TC The type of the value returned by the third parser.
169
+ * @template TD The type of the value returned by the fourth parser.
170
+ * @template TE The type of the value returned by the fifth parser.
171
+ * @template TF The type of the value returned by the sixth parser.
172
+ * @template TG The type of the value returned by the seventh parser.
173
+ * @template TH The type of the value returned by the eighth parser.
174
+ * @template TStateA The type of the state used by the first parser.
175
+ * @template TStateB The type of the state used by the second parser.
176
+ * @template TStateC The type of the state used by the third parser.
177
+ * @template TStateD The type of the state used by the fourth parser.
178
+ * @template TStateE The type of the state used by the fifth parser.
179
+ * @template TStateF The type of the state used by the sixth parser.
180
+ * @template TStateG The type of the state used by the seventh parser.
181
+ * @template TStateH The type of the state used by the eighth parser.
182
+ * @param a The first {@link Parser} to try.
183
+ * @param b The second {@link Parser} to try.
184
+ * @param c The third {@link Parser} to try.
185
+ * @param d The fourth {@link Parser} to try.
186
+ * @param e The fifth {@link Parser} to try.
187
+ * @param f The sixth {@link Parser} to try.
188
+ * @param g The seventh {@link Parser} to try.
189
+ * @param h The eighth {@link Parser} to try.
190
+ * @return A {@link Parser} that tries to parse using the provided parsers
191
+ * in order, returning the result of the first successful parser.
192
+ * @since 0.3.0
193
+ */
194
+ declare function or<TA, TB, TC, TD, TE, TF, TG, TH, TStateA, TStateB, TStateC, TStateD, TStateE, TStateF, TStateG, TStateH>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>, f: Parser<TF, TStateF>, g: Parser<TG, TStateG>, h: Parser<TH, TStateH>): Parser<TA | TB | TC | TD | TE | TF | TG | TH, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>] | [5, ParserResult<TStateF>] | [6, ParserResult<TStateG>] | [7, ParserResult<TStateH>]>;
195
+ /**
196
+ * Creates a parser that combines nine mutually exclusive parsers into one.
197
+ * The resulting parser will try each of the provided parsers in order,
198
+ * and return the result of the first successful parser.
199
+ * @template TA The type of the value returned by the first parser.
200
+ * @template TB The type of the value returned by the second parser.
201
+ * @template TC The type of the value returned by the third parser.
202
+ * @template TD The type of the value returned by the fourth parser.
203
+ * @template TE The type of the value returned by the fifth parser.
204
+ * @template TF The type of the value returned by the sixth parser.
205
+ * @template TG The type of the value returned by the seventh parser.
206
+ * @template TH The type of the value returned by the eighth parser.
207
+ * @template TI The type of the value returned by the ninth parser.
208
+ * @template TStateA The type of the state used by the first parser.
209
+ * @template TStateB The type of the state used by the second parser.
210
+ * @template TStateC The type of the state used by the third parser.
211
+ * @template TStateD The type of the state used by the fourth parser.
212
+ * @template TStateE The type of the state used by the fifth parser.
213
+ * @template TStateF The type of the state used by the sixth parser.
214
+ * @template TStateG The type of the state used by the seventh parser.
215
+ * @template TStateH The type of the state used by the eighth parser.
216
+ * @template TStateI The type of the state used by the ninth parser.
217
+ * @param a The first {@link Parser} to try.
218
+ * @param b The second {@link Parser} to try.
219
+ * @param c The third {@link Parser} to try.
220
+ * @param d The fourth {@link Parser} to try.
221
+ * @param e The fifth {@link Parser} to try.
222
+ * @param f The sixth {@link Parser} to try.
223
+ * @param g The seventh {@link Parser} to try.
224
+ * @param h The eighth {@link Parser} to try.
225
+ * @param i The ninth {@link Parser} to try.
226
+ * @return A {@link Parser} that tries to parse using the provided parsers
227
+ * in order, returning the result of the first successful parser.
228
+ * @since 0.3.0
229
+ */
230
+ declare function or<TA, TB, TC, TD, TE, TF, TG, TH, TI, TStateA, TStateB, TStateC, TStateD, TStateE, TStateF, TStateG, TStateH, TStateI>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>, f: Parser<TF, TStateF>, g: Parser<TG, TStateG>, h: Parser<TH, TStateH>, i: Parser<TI, TStateI>): Parser<TA | TB | TC | TD | TE | TF | TG | TH | TI, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>] | [5, ParserResult<TStateF>] | [6, ParserResult<TStateG>] | [7, ParserResult<TStateH>] | [8, ParserResult<TStateI>]>;
231
+ /**
232
+ * Creates a parser that combines ten mutually exclusive parsers into one.
233
+ * The resulting parser will try each of the provided parsers in order,
234
+ * and return the result of the first successful parser.
235
+ * @template TA The type of the value returned by the first parser.
236
+ * @template TB The type of the value returned by the second parser.
237
+ * @template TC The type of the value returned by the third parser.
238
+ * @template TD The type of the value returned by the fourth parser.
239
+ * @template TE The type of the value returned by the fifth parser.
240
+ * @template TF The type of the value returned by the sixth parser.
241
+ * @template TG The type of the value returned by the seventh parser.
242
+ * @template TH The type of the value returned by the eighth parser.
243
+ * @template TI The type of the value returned by the ninth parser.
244
+ * @template TJ The type of the value returned by the tenth parser.
245
+ * @template TStateA The type of the state used by the first parser.
246
+ * @template TStateB The type of the state used by the second parser.
247
+ * @template TStateC The type of the state used by the third parser.
248
+ * @template TStateD The type of the state used by the fourth parser.
249
+ * @template TStateE The type of the state used by the fifth parser.
250
+ * @template TStateF The type of the state used by the sixth parser.
251
+ * @template TStateG The type of the state used by the seventh parser.
252
+ * @template TStateH The type of the state used by the eighth parser.
253
+ * @template TStateI The type of the state used by the ninth parser.
254
+ * @template TStateJ The type of the state used by the tenth parser.
255
+ * @param a The first {@link Parser} to try.
256
+ * @param b The second {@link Parser} to try.
257
+ * @param c The third {@link Parser} to try.
258
+ * @param d The fourth {@link Parser} to try.
259
+ * @param e The fifth {@link Parser} to try.
260
+ * @param f The sixth {@link Parser} to try.
261
+ * @param g The seventh {@link Parser} to try.
262
+ * @param h The eighth {@link Parser} to try.
263
+ * @param i The ninth {@link Parser} to try.
264
+ * @param j The tenth {@link Parser} to try.
265
+ * @return A {@link Parser} that tries to parse using the provided parsers
266
+ * in order, returning the result of the first successful parser.
267
+ * @since 0.3.0
268
+ */
269
+ declare function or<TA, TB, TC, TD, TE, TF, TG, TH, TI, TJ, TStateA, TStateB, TStateC, TStateD, TStateE, TStateF, TStateG, TStateH, TStateI, TStateJ>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>, f: Parser<TF, TStateF>, g: Parser<TG, TStateG>, h: Parser<TH, TStateH>, i: Parser<TI, TStateI>, j: Parser<TJ, TStateJ>): Parser<TA | TB | TC | TD | TE | TF | TG | TH | TI | TJ, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>] | [5, ParserResult<TStateF>] | [6, ParserResult<TStateG>] | [7, ParserResult<TStateH>] | [8, ParserResult<TStateI>] | [9, ParserResult<TStateJ>]>;
270
+ declare function or(...parsers: Parser<unknown, unknown>[]): Parser<unknown, undefined | [number, ParserResult<unknown>]>;
271
+ /**
272
+ * Creates a parser that tries each parser in sequence until one succeeds,
273
+ * with custom error message options.
274
+ * @param parser1 The first parser to try.
275
+ * @param rest Additional parsers and {@link OrOptions} for error customization.
276
+ * @returns A parser that succeeds if any of the input parsers succeed.
277
+ * @since 0.5.0
278
+ */
279
+ declare function or(parser1: Parser<unknown, unknown>, ...rest: [...parsers: Parser<unknown, unknown>[], options: OrOptions]): Parser<unknown, undefined | [number, ParserResult<unknown>]>;
280
+ /**
281
+ * Options for customizing error messages in the {@link longestMatch}
282
+ * combinator.
283
+ * @since 0.5.0
284
+ */
285
+ interface LongestMatchOptions {
286
+ /**
287
+ * Error message customization options.
288
+ */
289
+ errors?: LongestMatchErrorOptions;
290
+ }
291
+ /**
292
+ * Options for customizing error messages in the {@link longesMatch} parser.
293
+ * @since 0.5.0
294
+ */
295
+ interface LongestMatchErrorOptions {
296
+ /**
297
+ * Custom error message when no parser matches.
298
+ */
299
+ noMatch?: Message;
300
+ /**
301
+ * Custom error message for unexpected input.
302
+ * Can be a static message or a function that receives the unexpected token.
303
+ */
304
+ unexpectedInput?: Message | ((token: string) => Message);
305
+ }
306
+ /**
307
+ * Creates a parser that combines two mutually exclusive parsers into one,
308
+ * selecting the parser that consumes the most tokens.
309
+ * The resulting parser will try both parsers and return the result
310
+ * of the parser that consumed more input tokens.
311
+ * @template TA The type of the value returned by the first parser.
312
+ * @template TB The type of the value returned by the second parser.
313
+ * @template TStateA The type of the state used by the first parser.
314
+ * @template TStateB The type of the state used by the second parser.
315
+ * @param a The first {@link Parser} to try.
316
+ * @param b The second {@link Parser} to try.
317
+ * @returns A {@link Parser} that tries to parse using both parsers
318
+ * and returns the result of the parser that consumed more tokens.
319
+ * @since 0.3.0
320
+ */
321
+ declare function longestMatch<TA, TB, TStateA, TStateB>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>): Parser<TA | TB, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>]>;
322
+ /**
323
+ * Creates a parser that combines three mutually exclusive parsers into one,
324
+ * selecting the parser that consumes the most tokens.
325
+ * The resulting parser will try all parsers and return the result
326
+ * of the parser that consumed the most input tokens.
327
+ * @template TA The type of the value returned by the first parser.
328
+ * @template TB The type of the value returned by the second parser.
329
+ * @template TC The type of the value returned by the third parser.
330
+ * @template TStateA The type of the state used by the first parser.
331
+ * @template TStateB The type of the state used by the second parser.
332
+ * @template TStateC The type of the state used by the third parser.
333
+ * @param a The first {@link Parser} to try.
334
+ * @param b The second {@link Parser} to try.
335
+ * @param c The third {@link Parser} to try.
336
+ * @returns A {@link Parser} that tries to parse using all parsers
337
+ * and returns the result of the parser that consumed the most tokens.
338
+ * @since 0.3.0
339
+ */
340
+ declare function longestMatch<TA, TB, TC, TStateA, TStateB, TStateC>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>): Parser<TA | TB | TC, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>]>;
341
+ /**
342
+ * Creates a parser that combines four mutually exclusive parsers into one,
343
+ * selecting the parser that consumes the most tokens.
344
+ * The resulting parser will try all parsers and return the result
345
+ * of the parser that consumed the most input tokens.
346
+ * @template TA The type of the value returned by the first parser.
347
+ * @template TB The type of the value returned by the second parser.
348
+ * @template TC The type of the value returned by the third parser.
349
+ * @template TD The type of the value returned by the fourth parser.
350
+ * @template TStateA The type of the state used by the first parser.
351
+ * @template TStateB The type of the state used by the second parser.
352
+ * @template TStateC The type of the state used by the third parser.
353
+ * @template TStateD The type of the state used by the fourth parser.
354
+ * @param a The first {@link Parser} to try.
355
+ * @param b The second {@link Parser} to try.
356
+ * @param c The third {@link Parser} to try.
357
+ * @param d The fourth {@link Parser} to try.
358
+ * @returns A {@link Parser} that tries to parse using all parsers
359
+ * and returns the result of the parser that consumed the most tokens.
360
+ * @since 0.3.0
361
+ */
362
+ declare function longestMatch<TA, TB, TC, TD, TStateA, TStateB, TStateC, TStateD>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>): Parser<TA | TB | TC | TD, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>]>;
363
+ /**
364
+ * Creates a parser that combines five mutually exclusive parsers into one,
365
+ * selecting the parser that consumes the most tokens.
366
+ * The resulting parser will try all parsers and return the result
367
+ * of the parser that consumed the most input tokens.
368
+ * @template TA The type of the value returned by the first parser.
369
+ * @template TB The type of the value returned by the second parser.
370
+ * @template TC The type of the value returned by the third parser.
371
+ * @template TD The type of the value returned by the fourth parser.
372
+ * @template TE The type of the value returned by the fifth parser.
373
+ * @template TStateA The type of the state used by the first parser.
374
+ * @template TStateB The type of the state used by the second parser.
375
+ * @template TStateC The type of the state used by the third parser.
376
+ * @template TStateD The type of the state used by the fourth parser.
377
+ * @template TStateE The type of the state used by the fifth parser.
378
+ * @param a The first {@link Parser} to try.
379
+ * @param b The second {@link Parser} to try.
380
+ * @param c The third {@link Parser} to try.
381
+ * @param d The fourth {@link Parser} to try.
382
+ * @param e The fifth {@link Parser} to try.
383
+ * @returns A {@link Parser} that tries to parse using all parsers
384
+ * and returns the result of the parser that consumed the most tokens.
385
+ * @since 0.3.0
386
+ */
387
+ declare function longestMatch<TA, TB, TC, TD, TE, TStateA, TStateB, TStateC, TStateD, TStateE>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>): Parser<TA | TB | TC | TD | TE, undefined | [0, ParserResult<TStateA>] | [1, ParserResult<TStateB>] | [2, ParserResult<TStateC>] | [3, ParserResult<TStateD>] | [4, ParserResult<TStateE>]>;
388
+ declare function longestMatch(...parsers: Parser<unknown, unknown>[]): Parser<unknown, undefined | [number, ParserResult<unknown>]>;
389
+ /**
390
+ * Creates a parser that tries all parsers and selects the one that consumes
391
+ * the most input, with custom error message options.
392
+ * @param parser1 The first parser to try.
393
+ * @param rest Additional parsers and {@link LongestMatchOptions} for error customization.
394
+ * @returns A parser that succeeds with the result from the parser that
395
+ * consumed the most input.
396
+ * @since 0.5.0
397
+ */
398
+ declare function longestMatch(parser1: Parser<unknown, unknown>, ...rest: [...parsers: Parser<unknown, unknown>[], options: LongestMatchOptions]): Parser<unknown, undefined | [number, ParserResult<unknown>]>;
399
+ /**
400
+ * Options for the {@link object} parser.
401
+ * @since 0.5.0
402
+ */
403
+ interface ObjectOptions {
404
+ /**
405
+ * Error messages customization.
406
+ */
407
+ readonly errors?: ObjectErrorOptions;
408
+ }
409
+ /**
410
+ * Options for customizing error messages in the {@link object} parser.
411
+ * @since 0.5.0
412
+ */
413
+ interface ObjectErrorOptions {
414
+ /**
415
+ * Error message when an unexpected option or argument is encountered.
416
+ */
417
+ readonly unexpectedInput?: Message | ((token: string) => Message);
418
+ /**
419
+ * Error message when end of input is reached unexpectedly.
420
+ */
421
+ readonly endOfInput?: Message;
422
+ }
423
+ /**
424
+ * Creates a parser that combines multiple parsers into a single object parser.
425
+ * Each parser in the object is applied to parse different parts of the input,
426
+ * and the results are combined into an object with the same structure.
427
+ * @template T A record type where each value is a {@link Parser}.
428
+ * @param parsers An object containing named parsers that will be combined
429
+ * into a single object parser.
430
+ * @returns A {@link Parser} that produces an object with the same keys as
431
+ * the input, where each value is the result of the corresponding
432
+ * parser.
433
+ */
434
+ declare function object<T extends {
435
+ readonly [key: string | symbol]: Parser<unknown, unknown>;
436
+ }>(parsers: T): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
437
+ /**
438
+ * Creates a parser that combines multiple parsers into a single object parser.
439
+ * Each parser in the object is applied to parse different parts of the input,
440
+ * and the results are combined into an object with the same structure.
441
+ * @template T A record type where each value is a {@link Parser}.
442
+ * @param parsers An object containing named parsers that will be combined
443
+ * into a single object parser.
444
+ * @param options Optional configuration for error customization.
445
+ * See {@link ObjectOptions}.
446
+ * @returns A {@link Parser} that produces an object with the same keys as
447
+ * the input, where each value is the result of the corresponding
448
+ * parser.
449
+ * @since 0.5.0
450
+ */
451
+ declare function object<T extends {
452
+ readonly [key: string | symbol]: Parser<unknown, unknown>;
453
+ }>(parsers: T, options: ObjectOptions): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
454
+ /**
455
+ * Creates a labeled parser that combines multiple parsers into a single
456
+ * object parser with an associated label for documentation or error reporting.
457
+ * @template T A record type where each value is a {@link Parser}.
458
+ * @param label A descriptive label for this parser group, used for
459
+ * documentation and error messages.
460
+ * @param parsers An object containing named parsers that will be combined
461
+ * into a single object parser.
462
+ * @returns A {@link Parser} that produces an object with the same keys as
463
+ * the input, where each value is the result of the corresponding
464
+ * parser.
465
+ */
466
+ declare function object<T extends {
467
+ readonly [key: string | symbol]: Parser<unknown, unknown>;
468
+ }>(label: string, parsers: T): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
469
+ /**
470
+ * Creates a labeled parser that combines multiple parsers into a single
471
+ * object parser with an associated label for documentation or error reporting.
472
+ * @template T A record type where each value is a {@link Parser}.
473
+ * @param label A descriptive label for this parser group, used for
474
+ * documentation and error messages.
475
+ * @param parsers An object containing named parsers that will be combined
476
+ * into a single object parser.
477
+ * @param options Optional configuration for error customization.
478
+ * See {@link ObjectOptions}.
479
+ * @returns A {@link Parser} that produces an object with the same keys as
480
+ * the input, where each value is the result of the corresponding
481
+ * parser.
482
+ * @since 0.5.0
483
+ */
484
+ declare function object<T extends {
485
+ readonly [key: string | symbol]: Parser<unknown, unknown>;
486
+ }>(label: string, parsers: T, options: ObjectOptions): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
487
+ /**
488
+ * Creates a parser that combines multiple parsers into a sequential tuple parser.
489
+ * The parsers are applied in the order they appear in the array, and all must
490
+ * succeed for the tuple parser to succeed.
491
+ * @template T A readonly array type where each element is a {@link Parser}.
492
+ * @param parsers An array of parsers that will be applied sequentially
493
+ * to create a tuple of their results.
494
+ * @returns A {@link Parser} that produces a readonly tuple with the same length
495
+ * as the input array, where each element is the result of the
496
+ * corresponding parser.
497
+ */
498
+ declare function tuple<const T extends readonly Parser<unknown, unknown>[]>(parsers: T): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
499
+ /**
500
+ * Creates a labeled parser that combines multiple parsers into a sequential
501
+ * tuple parser with an associated label for documentation or error reporting.
502
+ * @template T A readonly array type where each element is a {@link Parser}.
503
+ * @param label A descriptive label for this parser group, used for
504
+ * documentation and error messages.
505
+ * @param parsers An array of parsers that will be applied sequentially
506
+ * to create a tuple of their results.
507
+ * @returns A {@link Parser} that produces a readonly tuple with the same length
508
+ * as the input array, where each element is the result of the
509
+ * corresponding parser.
510
+ */
511
+ declare function tuple<const T extends readonly Parser<unknown, unknown>[]>(label: string, parsers: T): Parser<{ readonly [K in keyof T]: T[K]["$valueType"][number] extends (infer U) ? U : never }, { readonly [K in keyof T]: T[K]["$stateType"][number] extends (infer U2) ? U2 : never }>;
512
+ /**
513
+ * Helper type to check if all members of a union are object-like.
514
+ * This allows merge() to work with parsers like withDefault() that produce union types.
515
+ */
516
+ type AllObjectLike<T> = T extends readonly unknown[] ? never : T extends Record<string | symbol, unknown> ? T : never;
517
+ /**
518
+ * Helper type to extract object-like types from parser value types,
519
+ * including union types where all members are objects.
520
+ */
521
+ type ExtractObjectTypes<P> = P extends Parser<infer V, unknown> ? [AllObjectLike<V>] extends [never] ? never : V : never;
522
+ /**
523
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
524
+ * It is useful for combining multiple {@link object} parsers so that
525
+ * the unified parser produces a single object containing all the values
526
+ * from the individual parsers while separating the fields into multiple
527
+ * groups.
528
+ * @template TA The type of the first parser.
529
+ * @template TB The type of the second parser.
530
+ * @param a The first {@link object} parser to merge.
531
+ * @param b The second {@link object} parser to merge.
532
+ * @return A new {@link object} parser that combines the values and states
533
+ * of the two parsers into a single object.
534
+ */
535
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>>(a: ExtractObjectTypes<TA> extends never ? never : TA, b: ExtractObjectTypes<TB> extends never ? never : TB): Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB>, Record<string | symbol, unknown>>;
536
+ /**
537
+ * Merges multiple {@link object} parsers into a single {@link object} parser
538
+ * with a label for documentation and help text organization.
539
+ * It is useful for combining multiple {@link object} parsers so that
540
+ * the unified parser produces a single object containing all the values
541
+ * from the individual parsers while separating the fields into multiple
542
+ * groups.
543
+ * @template TA The type of the first parser.
544
+ * @template TB The type of the second parser.
545
+ * @param label A descriptive label for this merged group, used for
546
+ * documentation and help messages.
547
+ * @param a The first {@link object} parser to merge.
548
+ * @param b The second {@link object} parser to merge.
549
+ * @return A new {@link object} parser that combines the values and states
550
+ * of the two parsers into a single object.
551
+ */
552
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>>(label: string, a: ExtractObjectTypes<TA> extends never ? never : TA, b: ExtractObjectTypes<TB> extends never ? never : TB): Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB>, Record<string | symbol, unknown>>;
553
+ /**
554
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
555
+ * It is useful for combining multiple {@link object} parsers so that
556
+ * the unified parser produces a single object containing all the values
557
+ * from the individual parsers while separating the fields into multiple
558
+ * groups.
559
+ * @template TA The type of the first parser.
560
+ * @template TB The type of the second parser.
561
+ * @template TC The type of the third parser.
562
+ * @param a The first {@link object} parser to merge.
563
+ * @param b The second {@link object} parser to merge.
564
+ * @param c The third {@link object} parser to merge.
565
+ * @return A new {@link object} parser that combines the values and states
566
+ * of the two parsers into a single object.
567
+ */
568
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>>(a: ExtractObjectTypes<TA> extends never ? never : TA, b: ExtractObjectTypes<TB> extends never ? never : TB, c: ExtractObjectTypes<TC> extends never ? never : TC): Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC>, Record<string | symbol, unknown>>;
569
+ /**
570
+ * Merges multiple {@link object} parsers into a single {@link object} parser
571
+ * with a label for documentation and help text organization.
572
+ * It is useful for combining multiple {@link object} parsers so that
573
+ * the unified parser produces a single object containing all the values
574
+ * from the individual parsers while separating the fields into multiple
575
+ * groups.
576
+ * @template TA The type of the first parser.
577
+ * @template TB The type of the second parser.
578
+ * @template TC The type of the third parser.
579
+ * @param label A descriptive label for this merged group, used for
580
+ * documentation and help messages.
581
+ * @param a The first {@link object} parser to merge.
582
+ * @param b The second {@link object} parser to merge.
583
+ * @param c The third {@link object} parser to merge.
584
+ * @return A new {@link object} parser that combines the values and states
585
+ * of the two parsers into a single object.
586
+ */
587
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC>, Record<string | symbol, unknown>>;
588
+ /**
589
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
590
+ * It is useful for combining multiple {@link object} parsers so that
591
+ * the unified parser produces a single object containing all the values
592
+ * from the individual parsers while separating the fields into multiple
593
+ * groups.
594
+ * @template TA The type of the first parser.
595
+ * @template TB The type of the second parser.
596
+ * @template TC The type of the third parser.
597
+ * @template TD The type of the fourth parser.
598
+ * @param a The first {@link object} parser to merge.
599
+ * @param b The second {@link object} parser to merge.
600
+ * @param c The third {@link object} parser to merge.
601
+ * @param d The fourth {@link object} parser to merge.
602
+ * @return A new {@link object} parser that combines the values and states
603
+ * of the two parsers into a single object.
604
+ */
605
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD>, Record<string | symbol, unknown>>;
606
+ /**
607
+ * Merges multiple {@link object} parsers into a single {@link object} parser
608
+ * with a label for documentation and help text organization.
609
+ * It is useful for combining multiple {@link object} parsers so that
610
+ * the unified parser produces a single object containing all the values
611
+ * from the individual parsers while separating the fields into multiple
612
+ * groups.
613
+ * @template TA The type of the first parser.
614
+ * @template TB The type of the second parser.
615
+ * @template TC The type of the third parser.
616
+ * @template TD The type of the fourth parser.
617
+ * @param label A descriptive label for this merged group, used for
618
+ * documentation and help messages.
619
+ * @param a The first {@link object} parser to merge.
620
+ * @param b The second {@link object} parser to merge.
621
+ * @param c The third {@link object} parser to merge.
622
+ * @param d The fourth {@link object} parser to merge.
623
+ * @return A new {@link object} parser that combines the values and states
624
+ * of the two parsers into a single object.
625
+ */
626
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD>, Record<string | symbol, unknown>>;
627
+ /**
628
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
629
+ * It is useful for combining multiple {@link object} parsers so that
630
+ * the unified parser produces a single object containing all the values
631
+ * from the individual parsers while separating the fields into multiple
632
+ * groups.
633
+ * @template TA The type of the first parser.
634
+ * @template TB The type of the second parser.
635
+ * @template TC The type of the third parser.
636
+ * @template TD The type of the fourth parser.
637
+ * @template TE The type of the fifth parser.
638
+ * @param a The first {@link object} parser to merge.
639
+ * @param b The second {@link object} parser to merge.
640
+ * @param c The third {@link object} parser to merge.
641
+ * @param d The fourth {@link object} parser to merge.
642
+ * @param e The fifth {@link object} parser to merge.
643
+ * @return A new {@link object} parser that combines the values and states
644
+ * of the two parsers into a single object.
645
+ */
646
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>>(a: ExtractObjectTypes<TA> extends never ? never : TA, b: ExtractObjectTypes<TB> extends never ? never : TB, c: ExtractObjectTypes<TC> extends never ? never : TC, d: ExtractObjectTypes<TD> extends never ? never : TD, e: ExtractObjectTypes<TE> extends never ? never : TE): Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE>, Record<string | symbol, unknown>>;
647
+ /**
648
+ * Merges multiple {@link object} parsers into a single {@link object} parser
649
+ * with a label for documentation and help text organization.
650
+ * It is useful for combining multiple {@link object} parsers so that
651
+ * the unified parser produces a single object containing all the values
652
+ * from the individual parsers while separating the fields into multiple
653
+ * groups.
654
+ * @template TA The type of the first parser.
655
+ * @template TB The type of the second parser.
656
+ * @template TC The type of the third parser.
657
+ * @template TD The type of the fourth parser.
658
+ * @template TE The type of the fifth parser.
659
+ * @param label A descriptive label for this merged group, used for
660
+ * documentation and help messages.
661
+ * @param a The first {@link object} parser to merge.
662
+ * @param b The second {@link object} parser to merge.
663
+ * @param c The third {@link object} parser to merge.
664
+ * @param d The fourth {@link object} parser to merge.
665
+ * @param e The fifth {@link object} parser to merge.
666
+ * @return A new {@link object} parser that combines the values and states
667
+ * of the two parsers into a single object.
668
+ */
669
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE>, Record<string | symbol, unknown>>;
670
+ /**
671
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
672
+ * It is useful for combining multiple {@link object} parsers so that
673
+ * the unified parser produces a single object containing all the values
674
+ * from the individual parsers while separating the fields into multiple
675
+ * groups.
676
+ * @template TA The type of the first parser.
677
+ * @template TB The type of the second parser.
678
+ * @template TC The type of the third parser.
679
+ * @template TD The type of the fourth parser.
680
+ * @template TE The type of the fifth parser.
681
+ * @template TF The type of the sixth parser.
682
+ * @param a The first {@link object} parser to merge.
683
+ * @param b The second {@link object} parser to merge.
684
+ * @param c The third {@link object} parser to merge.
685
+ * @param d The fourth {@link object} parser to merge.
686
+ * @param e The fifth {@link object} parser to merge.
687
+ * @param f The sixth {@link object} parser to merge.
688
+ * @return A new {@link object} parser that combines the values and states
689
+ * of the parsers into a single object.
690
+ * @since 0.4.0
691
+ */
692
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD, e: TE, f: TF): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF>, Record<string | symbol, unknown>>;
693
+ /**
694
+ * Merges multiple {@link object} parsers into a single {@link object} parser
695
+ * with a label for documentation and help text organization.
696
+ * It is useful for combining multiple {@link object} parsers so that
697
+ * the unified parser produces a single object containing all the values
698
+ * from the individual parsers while separating the fields into multiple
699
+ * groups.
700
+ * @template TA The type of the first parser.
701
+ * @template TB The type of the second parser.
702
+ * @template TC The type of the third parser.
703
+ * @template TD The type of the fourth parser.
704
+ * @template TE The type of the fifth parser.
705
+ * @template TF The type of the sixth parser.
706
+ * @param label A descriptive label for this merged group, used for
707
+ * documentation and help messages.
708
+ * @param a The first {@link object} parser to merge.
709
+ * @param b The second {@link object} parser to merge.
710
+ * @param c The third {@link object} parser to merge.
711
+ * @param d The fourth {@link object} parser to merge.
712
+ * @param e The fifth {@link object} parser to merge.
713
+ * @param f The sixth {@link object} parser to merge.
714
+ * @return A new {@link object} parser that combines the values and states
715
+ * of the parsers into a single object.
716
+ * @since 0.4.0
717
+ */
718
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE, f: TF): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF>, Record<string | symbol, unknown>>;
719
+ /**
720
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
721
+ * It is useful for combining multiple {@link object} parsers so that
722
+ * the unified parser produces a single object containing all the values
723
+ * from the individual parsers while separating the fields into multiple
724
+ * groups.
725
+ * @template TA The type of the first parser.
726
+ * @template TB The type of the second parser.
727
+ * @template TC The type of the third parser.
728
+ * @template TD The type of the fourth parser.
729
+ * @template TE The type of the fifth parser.
730
+ * @template TF The type of the sixth parser.
731
+ * @template TG The type of the seventh parser.
732
+ * @param a The first {@link object} parser to merge.
733
+ * @param b The second {@link object} parser to merge.
734
+ * @param c The third {@link object} parser to merge.
735
+ * @param d The fourth {@link object} parser to merge.
736
+ * @param e The fifth {@link object} parser to merge.
737
+ * @param f The sixth {@link object} parser to merge.
738
+ * @param g The seventh {@link object} parser to merge.
739
+ * @return A new {@link object} parser that combines the values and states
740
+ * of the parsers into a single object.
741
+ * @since 0.4.0
742
+ */
743
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG>, Record<string | symbol, unknown>>;
744
+ /**
745
+ * Merges multiple {@link object} parsers into a single {@link object} parser
746
+ * with a label for documentation and help text organization.
747
+ * It is useful for combining multiple {@link object} parsers so that
748
+ * the unified parser produces a single object containing all the values
749
+ * from the individual parsers while separating the fields into multiple
750
+ * groups.
751
+ * @template TA The type of the first parser.
752
+ * @template TB The type of the second parser.
753
+ * @template TC The type of the third parser.
754
+ * @template TD The type of the fourth parser.
755
+ * @template TE The type of the fifth parser.
756
+ * @template TF The type of the sixth parser.
757
+ * @template TG The type of the seventh parser.
758
+ * @param label A descriptive label for this merged group, used for
759
+ * documentation and help messages.
760
+ * @param a The first {@link object} parser to merge.
761
+ * @param b The second {@link object} parser to merge.
762
+ * @param c The third {@link object} parser to merge.
763
+ * @param d The fourth {@link object} parser to merge.
764
+ * @param e The fifth {@link object} parser to merge.
765
+ * @param f The sixth {@link object} parser to merge.
766
+ * @param g The seventh {@link object} parser to merge.
767
+ * @return A new {@link object} parser that combines the values and states
768
+ * of the parsers into a single object.
769
+ * @since 0.4.0
770
+ */
771
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG>, Record<string | symbol, unknown>>;
772
+ /**
773
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
774
+ * It is useful for combining multiple {@link object} parsers so that
775
+ * the unified parser produces a single object containing all the values
776
+ * from the individual parsers while separating the fields into multiple
777
+ * groups.
778
+ * @template TA The type of the first parser.
779
+ * @template TB The type of the second parser.
780
+ * @template TC The type of the third parser.
781
+ * @template TD The type of the fourth parser.
782
+ * @template TE The type of the fifth parser.
783
+ * @template TF The type of the sixth parser.
784
+ * @template TG The type of the seventh parser.
785
+ * @template TH The type of the eighth parser.
786
+ * @param a The first {@link object} parser to merge.
787
+ * @param b The second {@link object} parser to merge.
788
+ * @param c The third {@link object} parser to merge.
789
+ * @param d The fourth {@link object} parser to merge.
790
+ * @param e The fifth {@link object} parser to merge.
791
+ * @param f The sixth {@link object} parser to merge.
792
+ * @param g The seventh {@link object} parser to merge.
793
+ * @param h The eighth {@link object} parser to merge.
794
+ * @return A new {@link object} parser that combines the values and states
795
+ * of the parsers into a single object.
796
+ * @since 0.4.0
797
+ */
798
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH>, Record<string | symbol, unknown>>;
799
+ /**
800
+ * Merges multiple {@link object} parsers into a single {@link object} parser
801
+ * with a label for documentation and help text organization.
802
+ * It is useful for combining multiple {@link object} parsers so that
803
+ * the unified parser produces a single object containing all the values
804
+ * from the individual parsers while separating the fields into multiple
805
+ * groups.
806
+ * @template TA The type of the first parser.
807
+ * @template TB The type of the second parser.
808
+ * @template TC The type of the third parser.
809
+ * @template TD The type of the fourth parser.
810
+ * @template TE The type of the fifth parser.
811
+ * @template TF The type of the sixth parser.
812
+ * @template TG The type of the seventh parser.
813
+ * @template TH The type of the eighth parser.
814
+ * @param label A descriptive label for this merged group, used for
815
+ * documentation and help messages.
816
+ * @param a The first {@link object} parser to merge.
817
+ * @param b The second {@link object} parser to merge.
818
+ * @param c The third {@link object} parser to merge.
819
+ * @param d The fourth {@link object} parser to merge.
820
+ * @param e The fifth {@link object} parser to merge.
821
+ * @param f The sixth {@link object} parser to merge.
822
+ * @param g The seventh {@link object} parser to merge.
823
+ * @param h The eighth {@link object} parser to merge.
824
+ * @return A new {@link object} parser that combines the values and states
825
+ * of the parsers into a single object.
826
+ * @since 0.4.0
827
+ */
828
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH>, Record<string | symbol, unknown>>;
829
+ /**
830
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
831
+ * It is useful for combining multiple {@link object} parsers so that
832
+ * the unified parser produces a single object containing all the values
833
+ * from the individual parsers while separating the fields into multiple
834
+ * groups.
835
+ * @template TA The type of the first parser.
836
+ * @template TB The type of the second parser.
837
+ * @template TC The type of the third parser.
838
+ * @template TD The type of the fourth parser.
839
+ * @template TE The type of the fifth parser.
840
+ * @template TF The type of the sixth parser.
841
+ * @template TG The type of the seventh parser.
842
+ * @template TH The type of the eighth parser.
843
+ * @template TI The type of the ninth parser.
844
+ * @param a The first {@link object} parser to merge.
845
+ * @param b The second {@link object} parser to merge.
846
+ * @param c The third {@link object} parser to merge.
847
+ * @param d The fourth {@link object} parser to merge.
848
+ * @param e The fifth {@link object} parser to merge.
849
+ * @param f The sixth {@link object} parser to merge.
850
+ * @param g The seventh {@link object} parser to merge.
851
+ * @param h The eighth {@link object} parser to merge.
852
+ * @param i The ninth {@link object} parser to merge.
853
+ * @return A new {@link object} parser that combines the values and states
854
+ * of the parsers into a single object.
855
+ * @since 0.4.0
856
+ */
857
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>, TI extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH, i: TI): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : ExtractObjectTypes<TI> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH> & ExtractObjectTypes<TI>, Record<string | symbol, unknown>>;
858
+ /**
859
+ * Merges multiple {@link object} parsers into a single {@link object} parser
860
+ * with a label for documentation and help text organization.
861
+ * It is useful for combining multiple {@link object} parsers so that
862
+ * the unified parser produces a single object containing all the values
863
+ * from the individual parsers while separating the fields into multiple
864
+ * groups.
865
+ * @template TA The type of the first parser.
866
+ * @template TB The type of the second parser.
867
+ * @template TC The type of the third parser.
868
+ * @template TD The type of the fourth parser.
869
+ * @template TE The type of the fifth parser.
870
+ * @template TF The type of the sixth parser.
871
+ * @template TG The type of the seventh parser.
872
+ * @template TH The type of the eighth parser.
873
+ * @template TI The type of the ninth parser.
874
+ * @param label A descriptive label for this merged group, used for
875
+ * documentation and help messages.
876
+ * @param a The first {@link object} parser to merge.
877
+ * @param b The second {@link object} parser to merge.
878
+ * @param c The third {@link object} parser to merge.
879
+ * @param d The fourth {@link object} parser to merge.
880
+ * @param e The fifth {@link object} parser to merge.
881
+ * @param f The sixth {@link object} parser to merge.
882
+ * @param g The seventh {@link object} parser to merge.
883
+ * @param h The eighth {@link object} parser to merge.
884
+ * @param i The ninth {@link object} parser to merge.
885
+ * @return A new {@link object} parser that combines the values and states
886
+ * of the parsers into a single object.
887
+ * @since 0.4.0
888
+ */
889
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>, TI extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH, i: TI): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : ExtractObjectTypes<TI> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH> & ExtractObjectTypes<TI>, Record<string | symbol, unknown>>;
890
+ /**
891
+ * Merges multiple {@link object} parsers into a single {@link object} parser.
892
+ * It is useful for combining multiple {@link object} parsers so that
893
+ * the unified parser produces a single object containing all the values
894
+ * from the individual parsers while separating the fields into multiple
895
+ * groups.
896
+ * @template TA The type of the first parser.
897
+ * @template TB The type of the second parser.
898
+ * @template TC The type of the third parser.
899
+ * @template TD The type of the fourth parser.
900
+ * @template TE The type of the fifth parser.
901
+ * @template TF The type of the sixth parser.
902
+ * @template TG The type of the seventh parser.
903
+ * @template TH The type of the eighth parser.
904
+ * @template TI The type of the ninth parser.
905
+ * @template TJ The type of the tenth parser.
906
+ * @param a The first {@link object} parser to merge.
907
+ * @param b The second {@link object} parser to merge.
908
+ * @param c The third {@link object} parser to merge.
909
+ * @param d The fourth {@link object} parser to merge.
910
+ * @param e The fifth {@link object} parser to merge.
911
+ * @param f The sixth {@link object} parser to merge.
912
+ * @param g The seventh {@link object} parser to merge.
913
+ * @param h The eighth {@link object} parser to merge.
914
+ * @param i The ninth {@link object} parser to merge.
915
+ * @param j The tenth {@link object} parser to merge.
916
+ * @return A new {@link object} parser that combines the values and states
917
+ * of the parsers into a single object.
918
+ * @since 0.4.0
919
+ */
920
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>, TI extends Parser<unknown, unknown>, TJ extends Parser<unknown, unknown>>(a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH, i: TI, j: TJ): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : ExtractObjectTypes<TI> extends never ? never : ExtractObjectTypes<TJ> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH> & ExtractObjectTypes<TI> & ExtractObjectTypes<TJ>, Record<string | symbol, unknown>>;
921
+ /**
922
+ * Merges multiple {@link object} parsers into a single {@link object} parser
923
+ * with a label for documentation and help text organization.
924
+ * It is useful for combining multiple {@link object} parsers so that
925
+ * the unified parser produces a single object containing all the values
926
+ * from the individual parsers while separating the fields into multiple
927
+ * groups.
928
+ * @template TA The type of the first parser.
929
+ * @template TB The type of the second parser.
930
+ * @template TC The type of the third parser.
931
+ * @template TD The type of the fourth parser.
932
+ * @template TE The type of the fifth parser.
933
+ * @template TF The type of the sixth parser.
934
+ * @template TG The type of the seventh parser.
935
+ * @template TH The type of the eighth parser.
936
+ * @template TI The type of the ninth parser.
937
+ * @template TJ The type of the tenth parser.
938
+ * @param label A descriptive label for this merged group, used for
939
+ * documentation and help messages.
940
+ * @param a The first {@link object} parser to merge.
941
+ * @param b The second {@link object} parser to merge.
942
+ * @param c The third {@link object} parser to merge.
943
+ * @param d The fourth {@link object} parser to merge.
944
+ * @param e The fifth {@link object} parser to merge.
945
+ * @param f The sixth {@link object} parser to merge.
946
+ * @param g The seventh {@link object} parser to merge.
947
+ * @param h The eighth {@link object} parser to merge.
948
+ * @param i The ninth {@link object} parser to merge.
949
+ * @param j The tenth {@link object} parser to merge.
950
+ * @return A new {@link object} parser that combines the values and states
951
+ * of the parsers into a single object.
952
+ * @since 0.4.0
953
+ */
954
+ declare function merge<TA extends Parser<unknown, unknown>, TB extends Parser<unknown, unknown>, TC extends Parser<unknown, unknown>, TD extends Parser<unknown, unknown>, TE extends Parser<unknown, unknown>, TF extends Parser<unknown, unknown>, TG extends Parser<unknown, unknown>, TH extends Parser<unknown, unknown>, TI extends Parser<unknown, unknown>, TJ extends Parser<unknown, unknown>>(label: string, a: TA, b: TB, c: TC, d: TD, e: TE, f: TF, g: TG, h: TH, i: TI, j: TJ): ExtractObjectTypes<TA> extends never ? never : ExtractObjectTypes<TB> extends never ? never : ExtractObjectTypes<TC> extends never ? never : ExtractObjectTypes<TD> extends never ? never : ExtractObjectTypes<TE> extends never ? never : ExtractObjectTypes<TF> extends never ? never : ExtractObjectTypes<TG> extends never ? never : ExtractObjectTypes<TH> extends never ? never : ExtractObjectTypes<TI> extends never ? never : ExtractObjectTypes<TJ> extends never ? never : Parser<ExtractObjectTypes<TA> & ExtractObjectTypes<TB> & ExtractObjectTypes<TC> & ExtractObjectTypes<TD> & ExtractObjectTypes<TE> & ExtractObjectTypes<TF> & ExtractObjectTypes<TG> & ExtractObjectTypes<TH> & ExtractObjectTypes<TI> & ExtractObjectTypes<TJ>, Record<string | symbol, unknown>>;
955
+ /**
956
+ * Concatenates two {@link tuple} parsers into a single parser that produces
957
+ * a flattened tuple containing the values from both parsers in order.
958
+ *
959
+ * This is similar to {@link merge} for object parsers, but operates on tuple
960
+ * parsers and preserves the sequential, positional nature of tuples by
961
+ * flattening the results into a single tuple array.
962
+ *
963
+ * @example
964
+ * ```typescript
965
+ * const basicTuple = tuple([
966
+ * option("-v", "--verbose"),
967
+ * option("-p", "--port", integer()),
968
+ * ]);
969
+ *
970
+ * const serverTuple = tuple([
971
+ * option("-h", "--host", string()),
972
+ * option("-d", "--debug"),
973
+ * ]);
974
+ *
975
+ * const combined = concat(basicTuple, serverTuple);
976
+ * // Type: Parser<[boolean, number, string, boolean], [BasicState, ServerState]>
977
+ *
978
+ * const result = parse(combined, ["-v", "-p", "8080", "-h", "localhost", "-d"]);
979
+ * // result.value: [true, 8080, "localhost", true]
980
+ * ```
981
+ *
982
+ * @template TA The value type of the first tuple parser.
983
+ * @template TB The value type of the second tuple parser.
984
+ * @template TStateA The state type of the first tuple parser.
985
+ * @template TStateB The state type of the second tuple parser.
986
+ * @param a The first {@link tuple} parser to concatenate.
987
+ * @param b The second {@link tuple} parser to concatenate.
988
+ * @return A new {@link tuple} parser that combines the values of both parsers
989
+ * into a single flattened tuple.
990
+ * @since 0.2.0
991
+ */
992
+ declare function concat<TA extends readonly unknown[], TB extends readonly unknown[], TStateA, TStateB>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>): Parser<[...TA, ...TB], [TStateA, TStateB]>;
993
+ /**
994
+ * Concatenates three {@link tuple} parsers into a single parser that produces
995
+ * a flattened tuple containing the values from all parsers in order.
996
+ *
997
+ * @template TA The value type of the first tuple parser.
998
+ * @template TB The value type of the second tuple parser.
999
+ * @template TC The value type of the third tuple parser.
1000
+ * @template TStateA The state type of the first tuple parser.
1001
+ * @template TStateB The state type of the second tuple parser.
1002
+ * @template TStateC The state type of the third tuple parser.
1003
+ * @param a The first {@link tuple} parser to concatenate.
1004
+ * @param b The second {@link tuple} parser to concatenate.
1005
+ * @param c The third {@link tuple} parser to concatenate.
1006
+ * @return A new {@link tuple} parser that combines the values of all parsers
1007
+ * into a single flattened tuple.
1008
+ * @since 0.2.0
1009
+ */
1010
+ declare function concat<TA extends readonly unknown[], TB extends readonly unknown[], TC extends readonly unknown[], TStateA, TStateB, TStateC>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>): Parser<[...TA, ...TB, ...TC], [TStateA, TStateB, TStateC]>;
1011
+ /**
1012
+ * Concatenates four {@link tuple} parsers into a single parser that produces
1013
+ * a flattened tuple containing the values from all parsers in order.
1014
+ *
1015
+ * @template TA The value type of the first tuple parser.
1016
+ * @template TB The value type of the second tuple parser.
1017
+ * @template TC The value type of the third tuple parser.
1018
+ * @template TD The value type of the fourth tuple parser.
1019
+ * @template TStateA The state type of the first tuple parser.
1020
+ * @template TStateB The state type of the second tuple parser.
1021
+ * @template TStateC The state type of the third tuple parser.
1022
+ * @template TStateD The state type of the fourth tuple parser.
1023
+ * @param a The first {@link tuple} parser to concatenate.
1024
+ * @param b The second {@link tuple} parser to concatenate.
1025
+ * @param c The third {@link tuple} parser to concatenate.
1026
+ * @param d The fourth {@link tuple} parser to concatenate.
1027
+ * @return A new {@link tuple} parser that combines the values of all parsers
1028
+ * into a single flattened tuple.
1029
+ * @since 0.2.0
1030
+ */
1031
+ declare function concat<TA extends readonly unknown[], TB extends readonly unknown[], TC extends readonly unknown[], TD extends readonly unknown[], TStateA, TStateB, TStateC, TStateD>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>): Parser<[...TA, ...TB, ...TC, ...TD], [TStateA, TStateB, TStateC, TStateD]>;
1032
+ /**
1033
+ * Concatenates five {@link tuple} parsers into a single parser that produces
1034
+ * a flattened tuple containing the values from all parsers in order.
1035
+ *
1036
+ * @template TA The value type of the first tuple parser.
1037
+ * @template TB The value type of the second tuple parser.
1038
+ * @template TC The value type of the third tuple parser.
1039
+ * @template TD The value type of the fourth tuple parser.
1040
+ * @template TE The value type of the fifth tuple parser.
1041
+ * @template TStateA The state type of the first tuple parser.
1042
+ * @template TStateB The state type of the second tuple parser.
1043
+ * @template TStateC The state type of the third tuple parser.
1044
+ * @template TStateD The state type of the fourth tuple parser.
1045
+ * @template TStateE The state type of the fifth tuple parser.
1046
+ * @param a The first {@link tuple} parser to concatenate.
1047
+ * @param b The second {@link tuple} parser to concatenate.
1048
+ * @param c The third {@link tuple} parser to concatenate.
1049
+ * @param d The fourth {@link tuple} parser to concatenate.
1050
+ * @param e The fifth {@link tuple} parser to concatenate.
1051
+ * @return A new {@link tuple} parser that combines the values of all parsers
1052
+ * into a single flattened tuple.
1053
+ * @since 0.2.0
1054
+ */
1055
+ declare function concat<TA extends readonly unknown[], TB extends readonly unknown[], TC extends readonly unknown[], TD extends readonly unknown[], TE extends readonly unknown[], TStateA, TStateB, TStateC, TStateD, TStateE>(a: Parser<TA, TStateA>, b: Parser<TB, TStateB>, c: Parser<TC, TStateC>, d: Parser<TD, TStateD>, e: Parser<TE, TStateE>): Parser<[...TA, ...TB, ...TC, ...TD, ...TE], [TStateA, TStateB, TStateC, TStateD, TStateE]>;
1056
+ /**
1057
+ * Wraps a parser with a group label for documentation purposes.
1058
+ *
1059
+ * The `group()` function is a documentation-only wrapper that applies a label
1060
+ * to any parser for help text organization. This allows you to use clean code
1061
+ * structure with combinators like {@link merge} while maintaining well-organized
1062
+ * help text through group labeling.
1063
+ *
1064
+ * The wrapped parser has identical parsing behavior but generates documentation
1065
+ * fragments wrapped in a labeled section. This is particularly useful when
1066
+ * combining parsers using {@link merge}—you can wrap the merged result with
1067
+ * `group()` to add a section header in help output.
1068
+ *
1069
+ * @example
1070
+ * ```typescript
1071
+ * const apiOptions = merge(
1072
+ * object({ endpoint: option("--endpoint", string()) }),
1073
+ * object({ timeout: option("--timeout", integer()) })
1074
+ * );
1075
+ *
1076
+ * const groupedApiOptions = group("API Options", apiOptions);
1077
+ * // Now produces a labeled "API Options" section in help text
1078
+ * ```
1079
+ *
1080
+ * @example
1081
+ * ```typescript
1082
+ * // Can be used with any parser, not just merge()
1083
+ * const verboseGroup = group("Verbosity", object({
1084
+ * verbose: option("-v", "--verbose"),
1085
+ * quiet: option("-q", "--quiet")
1086
+ * }));
1087
+ * ```
1088
+ *
1089
+ * @template TValue The value type of the wrapped parser.
1090
+ * @template TState The state type of the wrapped parser.
1091
+ * @param label A descriptive label for this parser group, used for
1092
+ * documentation and help text organization.
1093
+ * @param parser The parser to wrap with a group label.
1094
+ * @returns A new parser that behaves identically to the input parser
1095
+ * but generates documentation within a labeled section.
1096
+ * @since 0.4.0
1097
+ */
1098
+ declare function group<TValue, TState>(label: string, parser: Parser<TValue, TState>): Parser<TValue, TState>;
1099
+ //#endregion
1100
+ export { LongestMatchErrorOptions, LongestMatchOptions, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, concat, group, longestMatch, merge, object, or, tuple };