@sapphire/lexure 1.1.1-next.dfe32a0.0 → 1.1.1
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.
- package/CHANGELOG.md +31 -0
- package/dist/index.global.js +24 -39
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +67 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var result = require('@sapphire/result');
|
|
6
|
+
|
|
3
7
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
9
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
10
|
var __publicField = (obj, key, value) => {
|
|
23
11
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
12
|
return value;
|
|
25
13
|
};
|
|
26
|
-
|
|
27
|
-
// src/index.ts
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
ArgumentStream: () => ArgumentStream,
|
|
31
|
-
BaseParameter: () => BaseParameter,
|
|
32
|
-
EmptyStrategy: () => EmptyStrategy,
|
|
33
|
-
Lexer: () => Lexer,
|
|
34
|
-
ParameterStream: () => ParameterStream,
|
|
35
|
-
Parser: () => Parser,
|
|
36
|
-
ParserResult: () => ParserResult,
|
|
37
|
-
PrefixedStrategy: () => PrefixedStrategy,
|
|
38
|
-
QuotedParameter: () => QuotedParameter,
|
|
39
|
-
TokenStream: () => TokenStream,
|
|
40
|
-
TokenType: () => TokenType,
|
|
41
|
-
WordParameter: () => WordParameter,
|
|
42
|
-
join: () => join,
|
|
43
|
-
joinRaw: () => joinRaw
|
|
44
|
-
});
|
|
45
|
-
module.exports = __toCommonJS(src_exports);
|
|
46
|
-
|
|
47
|
-
// src/lib/ArgumentStream.ts
|
|
48
|
-
var import_result = require("@sapphire/result");
|
|
49
14
|
var ArgumentStream = class {
|
|
50
15
|
constructor(results) {
|
|
51
16
|
__publicField(this, "results");
|
|
@@ -67,64 +32,64 @@ var ArgumentStream = class {
|
|
|
67
32
|
}
|
|
68
33
|
single() {
|
|
69
34
|
if (this.finished)
|
|
70
|
-
return
|
|
35
|
+
return result.Option.none;
|
|
71
36
|
while (this.state.used.has(this.state.position)) {
|
|
72
37
|
++this.state.position;
|
|
73
38
|
}
|
|
74
39
|
this.state.used.add(this.state.position);
|
|
75
|
-
return
|
|
40
|
+
return result.Option.some(this.results.ordered[this.state.position++].value);
|
|
76
41
|
}
|
|
77
42
|
singleMap(predicate, useAnyways = false) {
|
|
78
43
|
if (this.finished)
|
|
79
|
-
return
|
|
44
|
+
return result.Option.none;
|
|
80
45
|
while (this.state.used.has(this.state.position)) {
|
|
81
46
|
++this.state.position;
|
|
82
47
|
}
|
|
83
|
-
const result = predicate(this.results.ordered[this.state.position].value);
|
|
84
|
-
if (result.isSome() || useAnyways) {
|
|
48
|
+
const result$1 = predicate(this.results.ordered[this.state.position].value);
|
|
49
|
+
if (result$1.isSome() || useAnyways) {
|
|
85
50
|
this.state.used.add(this.state.position);
|
|
86
51
|
++this.state.position;
|
|
87
52
|
}
|
|
88
|
-
return result;
|
|
53
|
+
return result$1;
|
|
89
54
|
}
|
|
90
55
|
async singleMapAsync(predicate, useAnyways = false) {
|
|
91
56
|
if (this.finished)
|
|
92
|
-
return
|
|
57
|
+
return result.Option.none;
|
|
93
58
|
while (this.state.used.has(this.state.position)) {
|
|
94
59
|
++this.state.position;
|
|
95
60
|
}
|
|
96
|
-
const result = await predicate(this.results.ordered[this.state.position].value);
|
|
97
|
-
if (result.isSome() || useAnyways) {
|
|
61
|
+
const result$1 = await predicate(this.results.ordered[this.state.position].value);
|
|
62
|
+
if (result$1.isSome() || useAnyways) {
|
|
98
63
|
this.state.used.add(this.state.position);
|
|
99
64
|
++this.state.position;
|
|
100
65
|
}
|
|
101
|
-
return result;
|
|
66
|
+
return result$1;
|
|
102
67
|
}
|
|
103
68
|
singleParse(predicate, useAnyways = false) {
|
|
104
69
|
if (this.finished)
|
|
105
|
-
return
|
|
70
|
+
return result.Result.err(null);
|
|
106
71
|
while (this.state.used.has(this.state.position)) {
|
|
107
72
|
++this.state.position;
|
|
108
73
|
}
|
|
109
|
-
const result = predicate(this.results.ordered[this.state.position].value);
|
|
110
|
-
if (result.isOk() || useAnyways) {
|
|
74
|
+
const result$1 = predicate(this.results.ordered[this.state.position].value);
|
|
75
|
+
if (result$1.isOk() || useAnyways) {
|
|
111
76
|
this.state.used.add(this.state.position);
|
|
112
77
|
++this.state.position;
|
|
113
78
|
}
|
|
114
|
-
return result;
|
|
79
|
+
return result$1;
|
|
115
80
|
}
|
|
116
81
|
async singleParseAsync(predicate, useAnyways = false) {
|
|
117
82
|
if (this.finished)
|
|
118
|
-
return
|
|
83
|
+
return result.Result.err(null);
|
|
119
84
|
while (this.state.used.has(this.state.position)) {
|
|
120
85
|
++this.state.position;
|
|
121
86
|
}
|
|
122
|
-
const result = await predicate(this.results.ordered[this.state.position].value);
|
|
123
|
-
if (result.isOk() || useAnyways) {
|
|
87
|
+
const result$1 = await predicate(this.results.ordered[this.state.position].value);
|
|
88
|
+
if (result$1.isOk() || useAnyways) {
|
|
124
89
|
this.state.used.add(this.state.position);
|
|
125
90
|
++this.state.position;
|
|
126
91
|
}
|
|
127
|
-
return result;
|
|
92
|
+
return result$1;
|
|
128
93
|
}
|
|
129
94
|
find(predicate, from = this.state.position) {
|
|
130
95
|
for (let i = from; i < this.length; ++i) {
|
|
@@ -133,10 +98,10 @@ var ArgumentStream = class {
|
|
|
133
98
|
const parameter = this.results.ordered[i].value;
|
|
134
99
|
if (predicate(parameter)) {
|
|
135
100
|
this.state.used.add(i);
|
|
136
|
-
return
|
|
101
|
+
return result.Option.some(parameter);
|
|
137
102
|
}
|
|
138
103
|
}
|
|
139
|
-
return
|
|
104
|
+
return result.Option.none;
|
|
140
105
|
}
|
|
141
106
|
async findAsync(predicate, from = this.state.position) {
|
|
142
107
|
for (let i = from; i < this.length; ++i) {
|
|
@@ -145,10 +110,10 @@ var ArgumentStream = class {
|
|
|
145
110
|
const parameter = this.results.ordered[i].value;
|
|
146
111
|
if (await predicate(parameter)) {
|
|
147
112
|
this.state.used.add(i);
|
|
148
|
-
return
|
|
113
|
+
return result.Option.some(parameter);
|
|
149
114
|
}
|
|
150
115
|
}
|
|
151
|
-
return
|
|
116
|
+
return result.Option.none;
|
|
152
117
|
}
|
|
153
118
|
findMap(predicate, from = this.state.position) {
|
|
154
119
|
for (let i = from; i < this.length; ++i) {
|
|
@@ -161,7 +126,7 @@ var ArgumentStream = class {
|
|
|
161
126
|
return result;
|
|
162
127
|
}
|
|
163
128
|
}
|
|
164
|
-
return
|
|
129
|
+
return result.Option.none;
|
|
165
130
|
}
|
|
166
131
|
async findMapAsync(predicate, from = this.state.position) {
|
|
167
132
|
for (let i = from; i < this.length; ++i) {
|
|
@@ -174,7 +139,7 @@ var ArgumentStream = class {
|
|
|
174
139
|
return result;
|
|
175
140
|
}
|
|
176
141
|
}
|
|
177
|
-
return
|
|
142
|
+
return result.Option.none;
|
|
178
143
|
}
|
|
179
144
|
findParse(predicate, from = this.state.position) {
|
|
180
145
|
const errors = [];
|
|
@@ -189,7 +154,7 @@ var ArgumentStream = class {
|
|
|
189
154
|
}
|
|
190
155
|
errors.push(result.unwrapErr());
|
|
191
156
|
}
|
|
192
|
-
return
|
|
157
|
+
return result.Result.err(errors);
|
|
193
158
|
}
|
|
194
159
|
async findParseAsync(predicate, from = this.state.position) {
|
|
195
160
|
const errors = [];
|
|
@@ -204,11 +169,11 @@ var ArgumentStream = class {
|
|
|
204
169
|
}
|
|
205
170
|
errors.push(result.unwrapErr());
|
|
206
171
|
}
|
|
207
|
-
return
|
|
172
|
+
return result.Result.err(errors);
|
|
208
173
|
}
|
|
209
174
|
many(limit = Infinity, from = this.state.position) {
|
|
210
175
|
if (this.finished)
|
|
211
|
-
return
|
|
176
|
+
return result.Option.none;
|
|
212
177
|
const parameters = [];
|
|
213
178
|
for (let i = from; i < this.length; ++i) {
|
|
214
179
|
if (this.state.used.has(i))
|
|
@@ -218,11 +183,11 @@ var ArgumentStream = class {
|
|
|
218
183
|
if (parameters.length >= limit)
|
|
219
184
|
break;
|
|
220
185
|
}
|
|
221
|
-
return parameters.length ?
|
|
186
|
+
return parameters.length ? result.Option.some(parameters) : result.Option.none;
|
|
222
187
|
}
|
|
223
188
|
filter(predicate, from = this.state.position) {
|
|
224
189
|
if (this.finished)
|
|
225
|
-
return
|
|
190
|
+
return result.Option.none;
|
|
226
191
|
const parameters = [];
|
|
227
192
|
for (let i = from; i < this.length; ++i) {
|
|
228
193
|
if (this.state.used.has(i))
|
|
@@ -233,11 +198,11 @@ var ArgumentStream = class {
|
|
|
233
198
|
parameters.push(parameter);
|
|
234
199
|
}
|
|
235
200
|
}
|
|
236
|
-
return
|
|
201
|
+
return result.Option.some(parameters);
|
|
237
202
|
}
|
|
238
203
|
async filterAsync(predicate, from = this.state.position) {
|
|
239
204
|
if (this.finished)
|
|
240
|
-
return
|
|
205
|
+
return result.Option.none;
|
|
241
206
|
const parameters = [];
|
|
242
207
|
for (let i = from; i < this.length; ++i) {
|
|
243
208
|
if (this.state.used.has(i))
|
|
@@ -248,11 +213,11 @@ var ArgumentStream = class {
|
|
|
248
213
|
parameters.push(parameter);
|
|
249
214
|
}
|
|
250
215
|
}
|
|
251
|
-
return
|
|
216
|
+
return result.Option.some(parameters);
|
|
252
217
|
}
|
|
253
218
|
filterMap(predicate, from = this.state.position) {
|
|
254
219
|
if (this.finished)
|
|
255
|
-
return
|
|
220
|
+
return result.Option.none;
|
|
256
221
|
const parameters = [];
|
|
257
222
|
for (let i = from; i < this.length; ++i) {
|
|
258
223
|
if (this.state.used.has(i))
|
|
@@ -264,11 +229,11 @@ var ArgumentStream = class {
|
|
|
264
229
|
parameters.push(value);
|
|
265
230
|
});
|
|
266
231
|
}
|
|
267
|
-
return
|
|
232
|
+
return result.Option.some(parameters);
|
|
268
233
|
}
|
|
269
234
|
async filterMapAsync(predicate, from = this.state.position) {
|
|
270
235
|
if (this.finished)
|
|
271
|
-
return
|
|
236
|
+
return result.Option.none;
|
|
272
237
|
const parameters = [];
|
|
273
238
|
for (let i = from; i < this.length; ++i) {
|
|
274
239
|
if (this.state.used.has(i))
|
|
@@ -280,7 +245,7 @@ var ArgumentStream = class {
|
|
|
280
245
|
parameters.push(value);
|
|
281
246
|
});
|
|
282
247
|
}
|
|
283
|
-
return
|
|
248
|
+
return result.Option.some(parameters);
|
|
284
249
|
}
|
|
285
250
|
flag(...keys) {
|
|
286
251
|
return keys.some((key) => this.results.flags.has(key));
|
|
@@ -295,7 +260,7 @@ var ArgumentStream = class {
|
|
|
295
260
|
if (values)
|
|
296
261
|
entries.push(...values);
|
|
297
262
|
}
|
|
298
|
-
return entries.length ?
|
|
263
|
+
return entries.length ? result.Option.some(entries) : result.Option.none;
|
|
299
264
|
}
|
|
300
265
|
save() {
|
|
301
266
|
return {
|
|
@@ -479,15 +444,12 @@ var ParserResult = class {
|
|
|
479
444
|
}
|
|
480
445
|
};
|
|
481
446
|
__name(ParserResult, "ParserResult");
|
|
482
|
-
|
|
483
|
-
// src/lib/parser/strategies/EmptyStrategy.ts
|
|
484
|
-
var import_result2 = require("@sapphire/result");
|
|
485
447
|
var EmptyStrategy = class {
|
|
486
448
|
matchFlag() {
|
|
487
|
-
return
|
|
449
|
+
return result.Option.none;
|
|
488
450
|
}
|
|
489
451
|
matchOption() {
|
|
490
|
-
return
|
|
452
|
+
return result.Option.none;
|
|
491
453
|
}
|
|
492
454
|
};
|
|
493
455
|
__name(EmptyStrategy, "EmptyStrategy");
|
|
@@ -507,9 +469,6 @@ var Parser = class {
|
|
|
507
469
|
}
|
|
508
470
|
};
|
|
509
471
|
__name(Parser, "Parser");
|
|
510
|
-
|
|
511
|
-
// src/lib/parser/strategies/PrefixedStrategy.ts
|
|
512
|
-
var import_result3 = require("@sapphire/result");
|
|
513
472
|
var PrefixedStrategy = class {
|
|
514
473
|
constructor(prefixes, separators) {
|
|
515
474
|
__publicField(this, "prefixes");
|
|
@@ -520,26 +479,26 @@ var PrefixedStrategy = class {
|
|
|
520
479
|
matchFlag(input) {
|
|
521
480
|
const prefix = this.prefixes.find((x) => input.startsWith(x));
|
|
522
481
|
if (!prefix)
|
|
523
|
-
return
|
|
482
|
+
return result.Option.none;
|
|
524
483
|
if (this.separators.some((x) => input.includes(x, prefix.length)))
|
|
525
|
-
return
|
|
526
|
-
return
|
|
484
|
+
return result.Option.none;
|
|
485
|
+
return result.Option.some(input.slice(prefix.length));
|
|
527
486
|
}
|
|
528
487
|
matchOption(input) {
|
|
529
488
|
const prefix = this.prefixes.find((x) => input.startsWith(x));
|
|
530
489
|
if (!prefix)
|
|
531
|
-
return
|
|
490
|
+
return result.Option.none;
|
|
532
491
|
for (const separator of this.separators) {
|
|
533
492
|
const index = input.indexOf(separator, prefix.length + 1);
|
|
534
493
|
if (index === -1)
|
|
535
494
|
continue;
|
|
536
495
|
if (index + separator.length === input.length)
|
|
537
|
-
return
|
|
496
|
+
return result.Option.none;
|
|
538
497
|
const key = input.slice(prefix.length, index);
|
|
539
498
|
const value = input.slice(index + separator.length);
|
|
540
|
-
return
|
|
499
|
+
return result.Option.some([key, value]);
|
|
541
500
|
}
|
|
542
|
-
return
|
|
501
|
+
return result.Option.none;
|
|
543
502
|
}
|
|
544
503
|
};
|
|
545
504
|
__name(PrefixedStrategy, "PrefixedStrategy");
|
|
@@ -571,21 +530,19 @@ function joinRaw(parameters) {
|
|
|
571
530
|
return output;
|
|
572
531
|
}
|
|
573
532
|
__name(joinRaw, "joinRaw");
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
joinRaw
|
|
590
|
-
});
|
|
533
|
+
|
|
534
|
+
exports.ArgumentStream = ArgumentStream;
|
|
535
|
+
exports.BaseParameter = BaseParameter;
|
|
536
|
+
exports.EmptyStrategy = EmptyStrategy;
|
|
537
|
+
exports.Lexer = Lexer;
|
|
538
|
+
exports.ParameterStream = ParameterStream;
|
|
539
|
+
exports.Parser = Parser;
|
|
540
|
+
exports.ParserResult = ParserResult;
|
|
541
|
+
exports.PrefixedStrategy = PrefixedStrategy;
|
|
542
|
+
exports.QuotedParameter = QuotedParameter;
|
|
543
|
+
exports.TokenStream = TokenStream;
|
|
544
|
+
exports.TokenType = TokenType;
|
|
545
|
+
exports.WordParameter = WordParameter;
|
|
546
|
+
exports.join = join;
|
|
547
|
+
exports.joinRaw = joinRaw;
|
|
591
548
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/lib/ArgumentStream.ts","../src/lib/lexer/streams/parameters/BaseParameter.ts","../src/lib/lexer/streams/parameters/QuotedParameter.ts","../src/lib/lexer/streams/parameters/WordParameter.ts","../src/lib/lexer/streams/raw/TokenStream.ts","../src/lib/lexer/streams/ParameterStream.ts","../src/lib/lexer/Lexer.ts","../src/lib/parser/ParserResult.ts","../src/lib/parser/strategies/EmptyStrategy.ts","../src/lib/parser/Parser.ts","../src/lib/parser/strategies/PrefixedStrategy.ts","../src/lib/util/util.ts"],"sourcesContent":["export * from './lib/ArgumentStream';\nexport * from './lib/lexer/Lexer';\nexport * from './lib/lexer/streams/parameters/BaseParameter';\nexport * from './lib/lexer/streams/parameters/QuotedParameter';\nexport * from './lib/lexer/streams/parameters/WordParameter';\nexport * from './lib/lexer/streams/ParameterStream';\nexport * from './lib/lexer/streams/raw/TokenStream';\nexport * from './lib/parser/Parser';\nexport * from './lib/parser/ParserResult';\nexport * from './lib/parser/strategies/EmptyStrategy';\nexport * from './lib/parser/strategies/IUnorderedStrategy';\nexport * from './lib/parser/strategies/PrefixedStrategy';\nexport * from './lib/util/util';\n","import { Option, Result } from '@sapphire/result';\nimport type { Parameter } from './lexer/streams/ParameterStream';\nimport type { ParserResult } from './parser/ParserResult';\n\nexport class ArgumentStream {\n\tpublic readonly results: ParserResult;\n\tpublic state: ArgumentStream.State;\n\n\tpublic constructor(results: ParserResult) {\n\t\tthis.results = results;\n\t\tthis.state = { used: new Set(), position: 0 };\n\t}\n\n\t/**\n\t * Whether or not all ordered parameters were used.\n\t */\n\tpublic get finished() {\n\t\treturn this.used === this.length;\n\t}\n\n\t/**\n\t * The amount of ordered parameters.\n\t */\n\tpublic get length() {\n\t\treturn this.results.ordered.length;\n\t}\n\n\t/**\n\t * The remaining amount of ordered parameters.\n\t */\n\tpublic get remaining() {\n\t\treturn this.length - this.used;\n\t}\n\n\t/**\n\t * The amount of ordered parameters that have been used.\n\t */\n\tpublic get used() {\n\t\treturn this.state.used.size;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '1' }\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '2' }\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '3' }\n\t *\n\t * console.log(args.single());\n\t * // None\n\t * ```\n\t *\n\t * @returns The value, if any.\n\t */\n\tpublic single(): Option<string> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tthis.state.used.add(this.state.position);\n\t\treturn Option.some(this.results.ordered[this.state.position++].value);\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link singleMapAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number) ? Option.none : Option.some(number);\n\t * };\n\t *\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 1 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 2 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 3 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // None\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic singleMap<T>(predicate: (value: string) => Option<T>, useAnyways = false): Option<T> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isSome() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This is an asynchronous variant of {@link singleMap}.\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic async singleMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, useAnyways = false): Promise<Option<T>> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = await predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isSome() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Finds and retrieves the next unused parameter and transforms it.\n\t *\n\t * @note This is a variant of {@link findMap} that returns the errors on failure.\n\t * @note This does not support asynchronous results, refer to {@link singleParseAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number)\n\t * ? Result.err(`Could not parse ${value} to a number`)\n\t * : Result.ok(number);\n\t * };\n\t *\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 1 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 2 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 3 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Err { error: null }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate The predicate that determines the parameter's transformed value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the transformation failed. Defaults to `false`.\n\t * @returns The transformed value, if any.\n\t */\n\tpublic singleParse<T, E>(predicate: (value: string) => Result<T, E>, useAnyways = false): Result<T, E | null> {\n\t\tif (this.finished) return Result.err(null);\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isOk() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This is an asynchronous variant of {@link singleParse}.\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic async singleParseAsync<T, E>(predicate: (value: string) => Promise<Result<T, E>>, useAnyways = false): Promise<Result<T, E | null>> {\n\t\tif (this.finished) return Result.err(null);\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = await predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isOk() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `true`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link findAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `true`. If such an element is found, find immediately returns a `Option.some`\n\t * with that element value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic find(predicate: (value: string) => boolean, from = this.state.position): Option<string> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn Option.some(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `true`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This is an asynchronous variant of {@link find}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `true`. If such an element is found, find immediately returns a `Option.some`\n\t * with that element value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findAsync(predicate: (value: string) => Promise<boolean>, from = this.state.position): Promise<Option<string>> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (await predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn Option.some(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `Some`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link findMapAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `Some`. If such an element is found, find immediately returns the returned\n\t * value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic findMap<T>(predicate: (value: string) => Option<T>, from = this.state.position): Option<T> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tif (result.isSome()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `Some`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This is an asynchronous variant of {@link findMap}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `Some`. If such an element is found, find immediately returns the returned\n\t * value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, from = this.state.position): Promise<Option<T>> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tif (result.isSome()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Finds and retrieves the first unused parameter that could be transformed.\n\t *\n\t * @note This is a variant of {@link findMap} that returns the errors on failure.\n\t * @note This does not support asynchronous results, refer to {@link findParseAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number)\n\t * ? Result.err(`Could not parse ${value} to a number`)\n\t * : Result.ok(number);\n\t * };\n\t *\n\t * // Suppose args are from 'ba 1 cc'.\n\t *\n\t * console.log(args.findParse(parse));\n\t * // Ok { value: 1 }\n\t *\n\t * console.log(args.findParse(parse));\n\t * // Err {\n\t * // error: [\n\t * // 'Could not parse ba to a number',\n\t * // 'Could not parse cc to a number'\n\t * // ]\n\t * // }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate `findParse` calls `predicate` once for each unused ordered parameter, in ascending order, until\n\t * it finds one where `predicate` returns `Ok`. If such an element is found, `findParse` immediately returns the\n\t * returned value. Otherwise, `findParse` returns `Result.Err` with all the returned errors.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic findParse<T, E>(predicate: (value: string) => Result<T, E>, from = this.state.position): Result<T, E[]> {\n\t\tconst errors: E[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tif (result.isOk()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result as Result.Ok<T>;\n\t\t\t}\n\n\t\t\terrors.push(result.unwrapErr());\n\t\t}\n\n\t\treturn Result.err(errors);\n\t}\n\n\t/**\n\t * Finds and retrieves the first unused parameter that could be transformed.\n\t *\n\t * @note This is a variant of {@link findMapAsync} that returns the errors on failure.\n\t * @note This is an asynchronous variant of {@link findParse}.\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate `findParse` calls `predicate` once for each unused ordered parameter, in ascending order, until\n\t * it finds one where `predicate` returns `Ok`. If such an element is found, `findParse` immediately returns the\n\t * returned value. Otherwise, `findParse` returns `Result.Err` with all the returned errors.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findParseAsync<T, E>(predicate: (value: string) => Promise<Result<T, E>>, from = this.state.position): Promise<Result<T, E[]>> {\n\t\tconst errors: E[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tif (result.isOk()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result as Result.Ok<T>;\n\t\t\t}\n\n\t\t\terrors.push(result.unwrapErr());\n\t\t}\n\n\t\treturn Result.err(errors);\n\t}\n\n\t/**\n\t * Retrieves multiple unused parameters.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(join(args.many().unwrap()));\n\t * // '1 2 3'\n\t * ```\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(join(args.many(2).unwrap()));\n\t * // '1 2'\n\t * ```\n\t *\n\t * @param limit The maximum amount of parameters to retrieve, defaults to `Infinity`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The unused parameters within the range.\n\t */\n\tpublic many(limit = Infinity, from = this.state.position): Option<Parameter[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: Parameter[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\t// If the current parameter was already used, skip:\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\t// Mark current parameter as used, and push it to the resulting array:\n\t\t\tthis.state.used.add(i);\n\t\t\tparameters.push(this.results.ordered[i]);\n\n\t\t\t// If the parameters reached the limit, break the loop:\n\t\t\tif (parameters.length >= limit) break;\n\t\t}\n\n\t\treturn parameters.length ? Option.some(parameters) : Option.none;\n\t}\n\n\tpublic filter(predicate: (value: string) => boolean, from = this.state.position): Option<string[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: string[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic async filterAsync(predicate: (value: string) => Promise<boolean>, from = this.state.position): Promise<Option<string[]>> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: string[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (await predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic filterMap<T>(predicate: (value: string) => Option<T>, from = this.state.position): Option<T[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: T[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tresult.inspect((value) => {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(value);\n\t\t\t});\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic async filterMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, from = this.state.position): Promise<Option<T[]>> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: T[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tresult.inspect((value) => {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(value);\n\t\t\t});\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\t/**\n\t * Checks whether any of the flags were given.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--f --g':\n\t *\n\t * console.log(args.flag('f'));\n\t * // true\n\t *\n\t * console.log(args.flag('g', 'h'));\n\t * // true\n\t *\n\t * console.log(args.flag('h'));\n\t * // false\n\t * ```\n\t *\n\t * @param keys The names of the flags to check.\n\t * @returns Whether or not any of the flags were given.\n\t */\n\tpublic flag(...keys: readonly string[]): boolean {\n\t\treturn keys.some((key) => this.results.flags.has(key));\n\t}\n\n\t/**\n\t * Gets the last value of any option. When there are multiple names, the last value of the last found name is given.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--a=1 --b=2 --c=3'.\n\t * console.log(args.option('a'));\n\t * // Some { value: '1' }\n\t *\n\t * console.log(args.option('b', 'c'));\n\t * // Some { value: '3' }\n\t *\n\t * console.log(args.option('d'));\n\t * // None {}\n\t * ```\n\t *\n\t * @param keys The names of the options to check.\n\t * @returns The last value of the option, if any.\n\t */\n\tpublic option(...keys: readonly string[]): Option<string> {\n\t\treturn this.options(...keys).map((values) => values.at(-1)!);\n\t}\n\n\t/**\n\t * Gets all values from all options.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--a=1 --a=1 --b=2 --c=3'.\n\t * console.log(args.option('a'));\n\t * // Some { value: ['1', '1'] }\n\t *\n\t * console.log(args.option('b', 'c'));\n\t * // Some { value: ['2', '3'] }\n\t *\n\t * console.log(args.option('d'));\n\t * // None {}\n\t * ```\n\t *\n\t * @param keys The names of the options to check.\n\t * @returns The values from all the options concatenated, if any.\n\t */\n\tpublic options(...keys: readonly string[]): Option<readonly string[]> {\n\t\tconst entries: string[] = [];\n\t\tfor (const key of keys) {\n\t\t\tconst values = this.results.options.get(key);\n\t\t\tif (values) entries.push(...values);\n\t\t}\n\n\t\treturn entries.length ? Option.some(entries) : Option.none;\n\t}\n\n\tpublic save(): ArgumentStream.State {\n\t\treturn {\n\t\t\tused: new Set(this.state.used),\n\t\t\tposition: this.state.position\n\t\t};\n\t}\n\n\tpublic restore(state: ArgumentStream.State) {\n\t\tthis.state = state;\n\t}\n\n\tpublic reset() {\n\t\tthis.restore({ used: new Set(), position: 0 });\n\t}\n}\n\nexport namespace ArgumentStream {\n\texport interface State {\n\t\tused: Set<number>;\n\t\tposition: number;\n\t}\n}\n","export abstract class BaseParameter {\n\tpublic readonly separators: readonly string[];\n\n\tpublic constructor(separators: readonly string[]) {\n\t\tthis.separators = separators;\n\t}\n\n\tpublic get leading(): string {\n\t\treturn this.separators.join('');\n\t}\n\n\tpublic abstract get raw(): string;\n}\n","import type { QuotedToken } from '../raw/TokenStream';\nimport { BaseParameter } from './BaseParameter';\n\nexport class QuotedParameter extends BaseParameter {\n\tpublic readonly value: string;\n\tpublic readonly open: string;\n\tpublic readonly close: string;\n\n\tpublic constructor(separators: readonly string[], part: Omit<QuotedToken, 'type'>) {\n\t\tsuper(separators);\n\t\tthis.value = part.value;\n\t\tthis.open = part.open;\n\t\tthis.close = part.close;\n\t}\n\n\tpublic get raw() {\n\t\treturn `${this.open}${this.value}${this.close}`;\n\t}\n}\n","import type { WordToken } from '../raw/TokenStream';\nimport { BaseParameter } from './BaseParameter';\n\nexport class WordParameter extends BaseParameter {\n\tpublic readonly value: string;\n\n\tpublic constructor(separators: readonly string[], part: Omit<WordToken, 'type'>) {\n\t\tsuper(separators);\n\t\tthis.value = part.value;\n\t}\n\n\tpublic get raw() {\n\t\treturn this.value;\n\t}\n}\n","import type { Lexer } from '../../Lexer';\n\nexport class TokenStream implements Iterable<Token> {\n\tprivate readonly input: string;\n\tprivate readonly quotes: readonly [string, string][];\n\tprivate readonly separator: string;\n\tprivate position = 0;\n\n\tpublic constructor(lexer: Lexer, input: string) {\n\t\tthis.quotes = lexer.quotes;\n\t\tthis.separator = lexer.separator;\n\t\tthis.input = input;\n\t}\n\n\tpublic get finished() {\n\t\treturn this.position >= this.input.length;\n\t}\n\n\tpublic *[Symbol.iterator](): Iterator<Token> {\n\t\twhile (!this.finished) {\n\t\t\tyield this.getPossibleSeparator() ?? this.getPossibleQuotedArgument() ?? this.getParameter();\n\t\t}\n\t}\n\n\tprivate getPossibleSeparator(): SeparatorToken | null {\n\t\tif (this.input.startsWith(this.separator, this.position)) {\n\t\t\tthis.position += this.separator.length;\n\t\t\treturn { type: TokenType.Separator, value: this.separator };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate getPossibleQuotedArgument(): QuotedToken | null {\n\t\tfor (const [open, close] of this.quotes) {\n\t\t\tif (!this.input.startsWith(open, this.position)) continue;\n\n\t\t\tconst end = this.input.indexOf(close, this.position + open.length);\n\t\t\tif (end === -1) continue;\n\n\t\t\tconst value = this.input.slice(this.position + open.length, end);\n\t\t\tthis.position = end + close.length;\n\n\t\t\treturn { type: TokenType.Quoted, value, open, close };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate getParameter(): WordToken {\n\t\tconst index = this.input.indexOf(this.separator, this.position);\n\t\tconst value = index === -1 ? this.input.slice(this.position) : this.input.slice(this.position, index);\n\t\tthis.position += value.length;\n\t\treturn { type: TokenType.Parameter, value };\n\t}\n}\n\nexport enum TokenType {\n\tParameter,\n\tQuoted,\n\tSeparator\n}\n\nexport type Token = WordToken | QuotedToken | SeparatorToken;\n\nexport interface WordToken {\n\treadonly type: TokenType.Parameter;\n\treadonly value: string;\n}\n\nexport interface QuotedToken {\n\treadonly type: TokenType.Quoted;\n\treadonly value: string;\n\treadonly open: string;\n\treadonly close: string;\n}\n\nexport interface SeparatorToken {\n\treadonly type: TokenType.Separator;\n\treadonly value: string;\n}\n","import { QuotedParameter } from './parameters/QuotedParameter';\nimport { WordParameter } from './parameters/WordParameter';\nimport { TokenType, type Token } from './raw/TokenStream';\n\nexport class ParameterStream {\n\tprivate readonly stream: Iterable<Token>;\n\tprivate separators: string[] = [];\n\n\tpublic constructor(stream: Iterable<Token>) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic *[Symbol.iterator](): Iterator<Parameter, string[]> {\n\t\tfor (const part of this.stream) {\n\t\t\tif (part.type === TokenType.Separator) {\n\t\t\t\tthis.separators.push(part.value);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tyield part.type === TokenType.Quoted ? new QuotedParameter(this.separators, part) : new WordParameter(this.separators, part);\n\t\t\tthis.separators = [];\n\t\t}\n\n\t\treturn this.separators;\n\t}\n}\n\nexport type Parameter = QuotedParameter | WordParameter;\n","import { ParameterStream } from './streams/ParameterStream';\nimport { TokenStream } from './streams/raw/TokenStream';\n\nexport class Lexer {\n\tpublic readonly quotes: readonly [open: string, close: string][];\n\tpublic readonly separator: string;\n\n\tpublic constructor(options: Lexer.Options = {}) {\n\t\tthis.quotes = options.quotes ?? [];\n\t\tthis.separator = options.separator ?? ' ';\n\t}\n\n\tpublic run(input: string) {\n\t\treturn new ParameterStream(this.raw(input));\n\t}\n\n\tpublic raw(input: string) {\n\t\treturn new TokenStream(this, input);\n\t}\n}\n\nexport namespace Lexer {\n\texport interface Options {\n\t\tseparator?: string;\n\t\tquotes?: readonly [open: string, close: string][];\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\nimport type { Parser } from './Parser';\nimport type { IUnorderedStrategy } from './strategies/IUnorderedStrategy';\n\nexport class ParserResult {\n\tpublic readonly ordered: Parameter[] = [];\n\tpublic readonly flags = new Set<string>();\n\tpublic readonly options = new Map<string, string[]>();\n\tprivate readonly strategy: IUnorderedStrategy;\n\n\tpublic constructor(parser: Parser) {\n\t\tthis.strategy = parser.strategy;\n\t}\n\n\tpublic parse(parameters: Iterable<Parameter>) {\n\t\tfor (const parameter of parameters) {\n\t\t\tthis.parsePossibleFlag(parameter) || this.parsePossibleOptions(parameter) || this.parseOrdered(parameter);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprivate parsePossibleFlag(parameter: Parameter): boolean {\n\t\treturn this.strategy\n\t\t\t.matchFlag(parameter.value)\n\t\t\t.inspect((value) => this.flags.add(value))\n\t\t\t.isSome();\n\t}\n\n\tprivate parsePossibleOptions(parameter: Parameter): boolean {\n\t\treturn this.strategy\n\t\t\t.matchOption(parameter.value)\n\t\t\t.inspect(([key, value]) => {\n\t\t\t\tconst existing = this.options.get(key);\n\t\t\t\tif (existing) existing.push(value);\n\t\t\t\telse this.options.set(key, [value]);\n\t\t\t})\n\t\t\t.isSome();\n\t}\n\n\tprivate parseOrdered(parameter: Parameter): boolean {\n\t\tthis.ordered.push(parameter);\n\t\treturn true;\n\t}\n}\n","import { Option } from '@sapphire/result';\nimport type { IUnorderedStrategy } from './IUnorderedStrategy';\n\nexport class EmptyStrategy implements IUnorderedStrategy {\n\tpublic matchFlag(): Option<string> {\n\t\treturn Option.none;\n\t}\n\n\tpublic matchOption(): Option<readonly [key: string, value: string]> {\n\t\treturn Option.none;\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\nimport type { IUnorderedStrategy } from './strategies/IUnorderedStrategy';\nimport { ParserResult } from './ParserResult';\nimport { EmptyStrategy } from './strategies/EmptyStrategy';\n\nexport class Parser {\n\tpublic strategy: IUnorderedStrategy;\n\n\tpublic constructor(strategy?: IUnorderedStrategy) {\n\t\tthis.strategy = strategy ?? new EmptyStrategy();\n\t}\n\n\tpublic setUnorderedStrategy(strategy: IUnorderedStrategy) {\n\t\tthis.strategy = strategy;\n\t\treturn this;\n\t}\n\n\tpublic run(input: Iterable<Parameter>): ParserResult {\n\t\treturn new ParserResult(this).parse(input);\n\t}\n}\n","import { Option } from '@sapphire/result';\nimport type { IUnorderedStrategy } from './IUnorderedStrategy';\n\nexport class PrefixedStrategy implements IUnorderedStrategy {\n\tpublic readonly prefixes: readonly string[];\n\tpublic readonly separators: readonly string[];\n\n\tpublic constructor(prefixes: readonly string[], separators: readonly string[]) {\n\t\tthis.prefixes = prefixes;\n\t\tthis.separators = separators;\n\t}\n\n\tpublic matchFlag(input: string): Option<string> {\n\t\tconst prefix = this.prefixes.find((x) => input.startsWith(x));\n\n\t\t// If the prefix is missing, return None:\n\t\tif (!prefix) return Option.none;\n\n\t\t// If the separator is present, return None:\n\t\tif (this.separators.some((x) => input.includes(x, prefix.length))) return Option.none;\n\n\t\treturn Option.some(input.slice(prefix.length));\n\t}\n\n\tpublic matchOption(input: string): Option<readonly [key: string, value: string]> {\n\t\tconst prefix = this.prefixes.find((x) => input.startsWith(x));\n\n\t\t// If the prefix is missing, return None:\n\t\tif (!prefix) return Option.none;\n\n\t\tfor (const separator of this.separators) {\n\t\t\tconst index = input.indexOf(separator, prefix.length + 1);\n\n\t\t\t// If the separator is missing, skip:\n\t\t\tif (index === -1) continue;\n\n\t\t\t// If the separator is present, but has no value, return None:\n\t\t\tif (index + separator.length === input.length) return Option.none;\n\n\t\t\tconst key = input.slice(prefix.length, index);\n\t\t\tconst value = input.slice(index + separator.length);\n\t\t\treturn Option.some([key, value] as const);\n\t\t}\n\n\t\treturn Option.none;\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\n\n/**\n * Joins the parameters by their `leading` value, using the `value` property.\n * @seealso {@link joinRaw} for the version using `raw` instead of `value`.\n * @param parameters The parameters to join.\n * @returns The result of joining the parameters.\n */\nexport function join(parameters: readonly Parameter[]) {\n\tif (parameters.length === 0) return '';\n\tif (parameters.length === 1) return parameters[0].value;\n\n\tlet output = parameters[0].value;\n\tfor (let i = 1; i < parameters.length; i++) {\n\t\tconst parameter = parameters[i];\n\t\toutput += parameter.leading + parameter.value;\n\t}\n\n\treturn output;\n}\n\n/**\n * Joins the parameters by their `leading` value, using the `raw` property.\n * @seealso {@link join} for the version using `value` instead of `raw`.\n * @param parameters The parameters to join.\n * @returns The result of joining the parameters.\n */\nexport function joinRaw(parameters: readonly Parameter[]) {\n\tif (parameters.length === 0) return '';\n\tif (parameters.length === 1) return parameters[0].raw;\n\n\tlet output = parameters[0].raw;\n\tfor (let i = 1; i < parameters.length; i++) {\n\t\tconst parameter = parameters[i];\n\t\toutput += parameter.leading + parameter.raw;\n\t}\n\n\treturn output;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA+B;AAIxB,IAAM,iBAAN,MAAqB;AAAA,EAIpB,YAAY,SAAuB;AAH1C,wBAAgB;AAChB,wBAAO;AAGN,SAAK,UAAU;AACf,SAAK,QAAQ,EAAE,MAAM,oBAAI,IAAI,GAAG,UAAU,EAAE;AAAA,EAC7C;AAAA,EAKA,IAAW,WAAW;AACrB,WAAO,KAAK,SAAS,KAAK;AAAA,EAC3B;AAAA,EAKA,IAAW,SAAS;AACnB,WAAO,KAAK,QAAQ,QAAQ;AAAA,EAC7B;AAAA,EAKA,IAAW,YAAY;AACtB,WAAO,KAAK,SAAS,KAAK;AAAA,EAC3B;AAAA,EAKA,IAAW,OAAO;AACjB,WAAO,KAAK,MAAM,KAAK;AAAA,EACxB;AAAA,EAwBO,SAAyB;AAC/B,QAAI,KAAK;AAAU,aAAO,qBAAO;AAEjC,WAAO,KAAK,MAAM,KAAK,IAAI,KAAK,MAAM,QAAQ,GAAG;AAChD,QAAE,KAAK,MAAM;AAAA,IACd;AAEA,SAAK,MAAM,KAAK,IAAI,KAAK,MAAM,QAAQ;AACvC,WAAO,qBAAO,KAAK,KAAK,QAAQ,QAAQ,KAAK,MAAM,YAAY,KAAK;AAAA,EACrE;AAAA,EAkCO,UAAa,WAAyC,aAAa,OAAkB;AAC3F,QAAI,KAAK;AAAU,aAAO,qBAAO;AAEjC,WAAO,KAAK,MAAM,KAAK,IAAI,KAAK,MAAM,QAAQ,GAA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M,YAAY,WAAW;AAC7B,cAAU,UAAU,UAAU,UAAU;AAAA,EACzC;AAEA,SAAO;AACR;AAXgB;AAmBT,SAAS,QAAQ,YAAkC;AACzD,MAAI,WAAW,WAAW;AAAG,WAAO;AACpC,MAAI,WAAW,WAAW;AAAG,WAAO,WAAW,GAAG;AAElD,MAAI,SAAS,WAAW,GAAG;AAC3B,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC3C,UAAM,YAAY,WAAW;AAC7B,cAAU,UAAU,UAAU,UAAU;AAAA,EACzC;AAEA,SAAO;AACR;AAXgB;","names":["TokenType","import_result","import_result"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/ArgumentStream.ts","../src/lib/lexer/streams/parameters/BaseParameter.ts","../src/lib/lexer/streams/parameters/QuotedParameter.ts","../src/lib/lexer/streams/parameters/WordParameter.ts","../src/lib/lexer/streams/raw/TokenStream.ts","../src/lib/lexer/streams/ParameterStream.ts","../src/lib/lexer/Lexer.ts","../src/lib/parser/ParserResult.ts","../src/lib/parser/strategies/EmptyStrategy.ts","../src/lib/parser/Parser.ts","../src/lib/parser/strategies/PrefixedStrategy.ts","../src/lib/util/util.ts"],"names":["TokenType","Option"],"mappings":";;;;;;;;;AAAA,SAAS,QAAQ,cAAc;AAIxB,IAAM,iBAAN,MAAqB;AAAA,EAIpB,YAAY,SAAuB;AAH1C,wBAAgB;AAChB,wBAAO;AAGN,SAAK,UAAU;AACf,SAAK,QAAQ,EAAE,MAAM,oBAAI,IAAI,GAAG,UAAU,EAAE;AAAA,EAC7C;AAAA,EAKA,IAAW,WAAW;AACrB,WAAO,KAAK,SAAS,KAAK;AAAA,EAC3B;AAAA,EAKA,IAAW,SAAS;AACnB,WAAO,KAAK,QAAQ,QAAQ;AAAA,EAC7B;AAAA,EAKA,IAAW,YAAY;AACtB,WAAO,KAAK,SAAS,KAAK;AAAA,EAC3B;AAAA,EAKA,IAAW,OAAO;AACjB,WAAO,KAAK,MAAM,KAAK;AAAA,E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D,YAAM,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK;AAC5C,YAAM,QAAQ,MAAM,MAAM,QAAQ,UAAU,MAAM;AAClD,aAAOA,QAAO,KAAK,CAAC,KAAK,KAAK,CAAU;AAAA,IACzC;AAEA,WAAOA,QAAO;AAAA,EACf;AACD;AA3Ca;;;ACKN,SAAS,KAAK,YAAkC;AACtD,MAAI,WAAW,WAAW;AAAG,WAAO;AACpC,MAAI,WAAW,WAAW;AAAG,WAAO,WAAW,GAAG;AAElD,MAAI,SAAS,WAAW,GAAG;AAC3B,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC3C,UAAM,YAAY,WAAW;AAC7B,cAAU,UAAU,UAAU,UAAU;AAAA,EACzC;AAEA,SAAO;AACR;AAXgB;AAmBT,SAAS,QAAQ,YAAkC;AACzD,MAAI,WAAW,WAAW;AAAG,WAAO;AACpC,MAAI,WAAW,WAAW;AAAG,WAAO,WAAW,GAAG;AAElD,MAAI,SAAS,WAAW,GAAG;AAC3B,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AAC3C,UAAM,YAAY,WAAW;AAC7B,cAAU,UAAU,UAAU,UAAU;AAAA,EACzC;AAEA,SAAO;AACR;AAXgB","sourcesContent":["import { Option, Result } from '@sapphire/result';\nimport type { Parameter } from './lexer/streams/ParameterStream';\nimport type { ParserResult } from './parser/ParserResult';\n\nexport class ArgumentStream {\n\tpublic readonly results: ParserResult;\n\tpublic state: ArgumentStream.State;\n\n\tpublic constructor(results: ParserResult) {\n\t\tthis.results = results;\n\t\tthis.state = { used: new Set(), position: 0 };\n\t}\n\n\t/**\n\t * Whether or not all ordered parameters were used.\n\t */\n\tpublic get finished() {\n\t\treturn this.used === this.length;\n\t}\n\n\t/**\n\t * The amount of ordered parameters.\n\t */\n\tpublic get length() {\n\t\treturn this.results.ordered.length;\n\t}\n\n\t/**\n\t * The remaining amount of ordered parameters.\n\t */\n\tpublic get remaining() {\n\t\treturn this.length - this.used;\n\t}\n\n\t/**\n\t * The amount of ordered parameters that have been used.\n\t */\n\tpublic get used() {\n\t\treturn this.state.used.size;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '1' }\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '2' }\n\t *\n\t * console.log(args.single());\n\t * // Ok { value: '3' }\n\t *\n\t * console.log(args.single());\n\t * // None\n\t * ```\n\t *\n\t * @returns The value, if any.\n\t */\n\tpublic single(): Option<string> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tthis.state.used.add(this.state.position);\n\t\treturn Option.some(this.results.ordered[this.state.position++].value);\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link singleMapAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number) ? Option.none : Option.some(number);\n\t * };\n\t *\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 1 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 2 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // Some { value: 3 }\n\t *\n\t * console.log(args.singleMap(parse));\n\t * // None\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic singleMap<T>(predicate: (value: string) => Option<T>, useAnyways = false): Option<T> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isSome() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This is an asynchronous variant of {@link singleMap}.\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic async singleMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, useAnyways = false): Promise<Option<T>> {\n\t\tif (this.finished) return Option.none;\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = await predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isSome() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Finds and retrieves the next unused parameter and transforms it.\n\t *\n\t * @note This is a variant of {@link findMap} that returns the errors on failure.\n\t * @note This does not support asynchronous results, refer to {@link singleParseAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number)\n\t * ? Result.err(`Could not parse ${value} to a number`)\n\t * : Result.ok(number);\n\t * };\n\t *\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 1 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 2 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Ok { value: 3 }\n\t *\n\t * console.log(args.singleParse(parse));\n\t * // Err { error: null }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate The predicate that determines the parameter's transformed value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the transformation failed. Defaults to `false`.\n\t * @returns The transformed value, if any.\n\t */\n\tpublic singleParse<T, E>(predicate: (value: string) => Result<T, E>, useAnyways = false): Result<T, E | null> {\n\t\tif (this.finished) return Result.err(null);\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isOk() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Retrieves the value of the next unused ordered token, but only if it could be transformed.\n\t *\n\t * @note This is an asynchronous variant of {@link singleParse}.\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate The predicate that determines the parameter's mapped value, or nothing if failed.\n\t * @param useAnyways Whether to consider the parameter used even if the mapping failed. Defaults to `false`.\n\t * @returns The mapped value, if any.\n\t */\n\tpublic async singleParseAsync<T, E>(predicate: (value: string) => Promise<Result<T, E>>, useAnyways = false): Promise<Result<T, E | null>> {\n\t\tif (this.finished) return Result.err(null);\n\n\t\twhile (this.state.used.has(this.state.position)) {\n\t\t\t++this.state.position;\n\t\t}\n\n\t\tconst result = await predicate(this.results.ordered[this.state.position].value);\n\t\tif (result.isOk() || useAnyways) {\n\t\t\tthis.state.used.add(this.state.position);\n\t\t\t++this.state.position;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `true`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link findAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `true`. If such an element is found, find immediately returns a `Option.some`\n\t * with that element value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic find(predicate: (value: string) => boolean, from = this.state.position): Option<string> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn Option.some(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `true`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This is an asynchronous variant of {@link find}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `true`. If such an element is found, find immediately returns a `Option.some`\n\t * with that element value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findAsync(predicate: (value: string) => Promise<boolean>, from = this.state.position): Promise<Option<string>> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (await predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn Option.some(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `Some`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This does not support asynchronous results, refer to {@link findMapAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `Some`. If such an element is found, find immediately returns the returned\n\t * value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic findMap<T>(predicate: (value: string) => Option<T>, from = this.state.position): Option<T> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tif (result.isSome()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Returns the value of the first element in the array within `Option.some` where `predicate` returns `Some`, and\n\t * `Option.none` otherwise.\n\t *\n\t * @note This is an asynchronous variant of {@link findMap}.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Suppose args are from 'ba aa cc'.\n\t *\n\t * console.log(args.find((value) => value.startsWith('a')));\n\t * // Some { value: 'aa' }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @param predicate find calls `predicate` once for each unused ordered parameter, in ascending order, until it\n\t * finds one where `predicate` returns `Some`. If such an element is found, find immediately returns the returned\n\t * value. Otherwise, find returns `Option.none`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, from = this.state.position): Promise<Option<T>> {\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tif (result.isSome()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\treturn Option.none;\n\t}\n\n\t/**\n\t * Finds and retrieves the first unused parameter that could be transformed.\n\t *\n\t * @note This is a variant of {@link findMap} that returns the errors on failure.\n\t * @note This does not support asynchronous results, refer to {@link findParseAsync}.\n\t *\n\t * @example\n\t * ```typescript\n\t * const parse = (value) => {\n\t * const number = Number(value);\n\t * return Number.isNaN(number)\n\t * ? Result.err(`Could not parse ${value} to a number`)\n\t * : Result.ok(number);\n\t * };\n\t *\n\t * // Suppose args are from 'ba 1 cc'.\n\t *\n\t * console.log(args.findParse(parse));\n\t * // Ok { value: 1 }\n\t *\n\t * console.log(args.findParse(parse));\n\t * // Err {\n\t * // error: [\n\t * // 'Could not parse ba to a number',\n\t * // 'Could not parse cc to a number'\n\t * // ]\n\t * // }\n\t * ```\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate `findParse` calls `predicate` once for each unused ordered parameter, in ascending order, until\n\t * it finds one where `predicate` returns `Ok`. If such an element is found, `findParse` immediately returns the\n\t * returned value. Otherwise, `findParse` returns `Result.Err` with all the returned errors.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic findParse<T, E>(predicate: (value: string) => Result<T, E>, from = this.state.position): Result<T, E[]> {\n\t\tconst errors: E[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tif (result.isOk()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result as Result.Ok<T>;\n\t\t\t}\n\n\t\t\terrors.push(result.unwrapErr());\n\t\t}\n\n\t\treturn Result.err(errors);\n\t}\n\n\t/**\n\t * Finds and retrieves the first unused parameter that could be transformed.\n\t *\n\t * @note This is a variant of {@link findMapAsync} that returns the errors on failure.\n\t * @note This is an asynchronous variant of {@link findParse}.\n\t *\n\t * @typeparam T The output type.\n\t * @typeparam E The error type.\n\t * @param predicate `findParse` calls `predicate` once for each unused ordered parameter, in ascending order, until\n\t * it finds one where `predicate` returns `Ok`. If such an element is found, `findParse` immediately returns the\n\t * returned value. Otherwise, `findParse` returns `Result.Err` with all the returned errors.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The found parameter's value.\n\t */\n\tpublic async findParseAsync<T, E>(predicate: (value: string) => Promise<Result<T, E>>, from = this.state.position): Promise<Result<T, E[]>> {\n\t\tconst errors: E[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tif (result.isOk()) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\treturn result as Result.Ok<T>;\n\t\t\t}\n\n\t\t\terrors.push(result.unwrapErr());\n\t\t}\n\n\t\treturn Result.err(errors);\n\t}\n\n\t/**\n\t * Retrieves multiple unused parameters.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(join(args.many().unwrap()));\n\t * // '1 2 3'\n\t * ```\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '1 2 3':\n\t *\n\t * console.log(join(args.many(2).unwrap()));\n\t * // '1 2'\n\t * ```\n\t *\n\t * @param limit The maximum amount of parameters to retrieve, defaults to `Infinity`.\n\t * @param from The position where to start looking for unused parameters, defaults to current position.\n\t * @returns The unused parameters within the range.\n\t */\n\tpublic many(limit = Infinity, from = this.state.position): Option<Parameter[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: Parameter[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\t// If the current parameter was already used, skip:\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\t// Mark current parameter as used, and push it to the resulting array:\n\t\t\tthis.state.used.add(i);\n\t\t\tparameters.push(this.results.ordered[i]);\n\n\t\t\t// If the parameters reached the limit, break the loop:\n\t\t\tif (parameters.length >= limit) break;\n\t\t}\n\n\t\treturn parameters.length ? Option.some(parameters) : Option.none;\n\t}\n\n\tpublic filter(predicate: (value: string) => boolean, from = this.state.position): Option<string[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: string[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic async filterAsync(predicate: (value: string) => Promise<boolean>, from = this.state.position): Promise<Option<string[]>> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: string[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tif (await predicate(parameter)) {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(parameter);\n\t\t\t}\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic filterMap<T>(predicate: (value: string) => Option<T>, from = this.state.position): Option<T[]> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: T[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = predicate(parameter);\n\t\t\tresult.inspect((value) => {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(value);\n\t\t\t});\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\tpublic async filterMapAsync<T>(predicate: (value: string) => Promise<Option<T>>, from = this.state.position): Promise<Option<T[]>> {\n\t\tif (this.finished) return Option.none;\n\n\t\tconst parameters: T[] = [];\n\t\tfor (let i = from; i < this.length; ++i) {\n\t\t\tif (this.state.used.has(i)) continue;\n\n\t\t\tconst parameter = this.results.ordered[i].value;\n\t\t\tconst result = await predicate(parameter);\n\t\t\tresult.inspect((value) => {\n\t\t\t\tthis.state.used.add(i);\n\t\t\t\tparameters.push(value);\n\t\t\t});\n\t\t}\n\n\t\treturn Option.some(parameters);\n\t}\n\n\t/**\n\t * Checks whether any of the flags were given.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--f --g':\n\t *\n\t * console.log(args.flag('f'));\n\t * // true\n\t *\n\t * console.log(args.flag('g', 'h'));\n\t * // true\n\t *\n\t * console.log(args.flag('h'));\n\t * // false\n\t * ```\n\t *\n\t * @param keys The names of the flags to check.\n\t * @returns Whether or not any of the flags were given.\n\t */\n\tpublic flag(...keys: readonly string[]): boolean {\n\t\treturn keys.some((key) => this.results.flags.has(key));\n\t}\n\n\t/**\n\t * Gets the last value of any option. When there are multiple names, the last value of the last found name is given.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--a=1 --b=2 --c=3'.\n\t * console.log(args.option('a'));\n\t * // Some { value: '1' }\n\t *\n\t * console.log(args.option('b', 'c'));\n\t * // Some { value: '3' }\n\t *\n\t * console.log(args.option('d'));\n\t * // None {}\n\t * ```\n\t *\n\t * @param keys The names of the options to check.\n\t * @returns The last value of the option, if any.\n\t */\n\tpublic option(...keys: readonly string[]): Option<string> {\n\t\treturn this.options(...keys).map((values) => values.at(-1)!);\n\t}\n\n\t/**\n\t * Gets all values from all options.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Assume args are '--a=1 --a=1 --b=2 --c=3'.\n\t * console.log(args.option('a'));\n\t * // Some { value: ['1', '1'] }\n\t *\n\t * console.log(args.option('b', 'c'));\n\t * // Some { value: ['2', '3'] }\n\t *\n\t * console.log(args.option('d'));\n\t * // None {}\n\t * ```\n\t *\n\t * @param keys The names of the options to check.\n\t * @returns The values from all the options concatenated, if any.\n\t */\n\tpublic options(...keys: readonly string[]): Option<readonly string[]> {\n\t\tconst entries: string[] = [];\n\t\tfor (const key of keys) {\n\t\t\tconst values = this.results.options.get(key);\n\t\t\tif (values) entries.push(...values);\n\t\t}\n\n\t\treturn entries.length ? Option.some(entries) : Option.none;\n\t}\n\n\tpublic save(): ArgumentStream.State {\n\t\treturn {\n\t\t\tused: new Set(this.state.used),\n\t\t\tposition: this.state.position\n\t\t};\n\t}\n\n\tpublic restore(state: ArgumentStream.State) {\n\t\tthis.state = state;\n\t}\n\n\tpublic reset() {\n\t\tthis.restore({ used: new Set(), position: 0 });\n\t}\n}\n\nexport namespace ArgumentStream {\n\texport interface State {\n\t\tused: Set<number>;\n\t\tposition: number;\n\t}\n}\n","export abstract class BaseParameter {\n\tpublic readonly separators: readonly string[];\n\n\tpublic constructor(separators: readonly string[]) {\n\t\tthis.separators = separators;\n\t}\n\n\tpublic get leading(): string {\n\t\treturn this.separators.join('');\n\t}\n\n\tpublic abstract get raw(): string;\n}\n","import type { QuotedToken } from '../raw/TokenStream';\nimport { BaseParameter } from './BaseParameter';\n\nexport class QuotedParameter extends BaseParameter {\n\tpublic readonly value: string;\n\tpublic readonly open: string;\n\tpublic readonly close: string;\n\n\tpublic constructor(separators: readonly string[], part: Omit<QuotedToken, 'type'>) {\n\t\tsuper(separators);\n\t\tthis.value = part.value;\n\t\tthis.open = part.open;\n\t\tthis.close = part.close;\n\t}\n\n\tpublic get raw() {\n\t\treturn `${this.open}${this.value}${this.close}`;\n\t}\n}\n","import type { WordToken } from '../raw/TokenStream';\nimport { BaseParameter } from './BaseParameter';\n\nexport class WordParameter extends BaseParameter {\n\tpublic readonly value: string;\n\n\tpublic constructor(separators: readonly string[], part: Omit<WordToken, 'type'>) {\n\t\tsuper(separators);\n\t\tthis.value = part.value;\n\t}\n\n\tpublic get raw() {\n\t\treturn this.value;\n\t}\n}\n","import type { Lexer } from '../../Lexer';\n\nexport class TokenStream implements Iterable<Token> {\n\tprivate readonly input: string;\n\tprivate readonly quotes: readonly [string, string][];\n\tprivate readonly separator: string;\n\tprivate position = 0;\n\n\tpublic constructor(lexer: Lexer, input: string) {\n\t\tthis.quotes = lexer.quotes;\n\t\tthis.separator = lexer.separator;\n\t\tthis.input = input;\n\t}\n\n\tpublic get finished() {\n\t\treturn this.position >= this.input.length;\n\t}\n\n\tpublic *[Symbol.iterator](): Iterator<Token> {\n\t\twhile (!this.finished) {\n\t\t\tyield this.getPossibleSeparator() ?? this.getPossibleQuotedArgument() ?? this.getParameter();\n\t\t}\n\t}\n\n\tprivate getPossibleSeparator(): SeparatorToken | null {\n\t\tif (this.input.startsWith(this.separator, this.position)) {\n\t\t\tthis.position += this.separator.length;\n\t\t\treturn { type: TokenType.Separator, value: this.separator };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate getPossibleQuotedArgument(): QuotedToken | null {\n\t\tfor (const [open, close] of this.quotes) {\n\t\t\tif (!this.input.startsWith(open, this.position)) continue;\n\n\t\t\tconst end = this.input.indexOf(close, this.position + open.length);\n\t\t\tif (end === -1) continue;\n\n\t\t\tconst value = this.input.slice(this.position + open.length, end);\n\t\t\tthis.position = end + close.length;\n\n\t\t\treturn { type: TokenType.Quoted, value, open, close };\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate getParameter(): WordToken {\n\t\tconst index = this.input.indexOf(this.separator, this.position);\n\t\tconst value = index === -1 ? this.input.slice(this.position) : this.input.slice(this.position, index);\n\t\tthis.position += value.length;\n\t\treturn { type: TokenType.Parameter, value };\n\t}\n}\n\nexport enum TokenType {\n\tParameter,\n\tQuoted,\n\tSeparator\n}\n\nexport type Token = WordToken | QuotedToken | SeparatorToken;\n\nexport interface WordToken {\n\treadonly type: TokenType.Parameter;\n\treadonly value: string;\n}\n\nexport interface QuotedToken {\n\treadonly type: TokenType.Quoted;\n\treadonly value: string;\n\treadonly open: string;\n\treadonly close: string;\n}\n\nexport interface SeparatorToken {\n\treadonly type: TokenType.Separator;\n\treadonly value: string;\n}\n","import { QuotedParameter } from './parameters/QuotedParameter';\nimport { WordParameter } from './parameters/WordParameter';\nimport { TokenType, type Token } from './raw/TokenStream';\n\nexport class ParameterStream {\n\tprivate readonly stream: Iterable<Token>;\n\tprivate separators: string[] = [];\n\n\tpublic constructor(stream: Iterable<Token>) {\n\t\tthis.stream = stream;\n\t}\n\n\tpublic *[Symbol.iterator](): Iterator<Parameter, string[]> {\n\t\tfor (const part of this.stream) {\n\t\t\tif (part.type === TokenType.Separator) {\n\t\t\t\tthis.separators.push(part.value);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tyield part.type === TokenType.Quoted ? new QuotedParameter(this.separators, part) : new WordParameter(this.separators, part);\n\t\t\tthis.separators = [];\n\t\t}\n\n\t\treturn this.separators;\n\t}\n}\n\nexport type Parameter = QuotedParameter | WordParameter;\n","import { ParameterStream } from './streams/ParameterStream';\nimport { TokenStream } from './streams/raw/TokenStream';\n\nexport class Lexer {\n\tpublic readonly quotes: readonly [open: string, close: string][];\n\tpublic readonly separator: string;\n\n\tpublic constructor(options: Lexer.Options = {}) {\n\t\tthis.quotes = options.quotes ?? [];\n\t\tthis.separator = options.separator ?? ' ';\n\t}\n\n\tpublic run(input: string) {\n\t\treturn new ParameterStream(this.raw(input));\n\t}\n\n\tpublic raw(input: string) {\n\t\treturn new TokenStream(this, input);\n\t}\n}\n\nexport namespace Lexer {\n\texport interface Options {\n\t\tseparator?: string;\n\t\tquotes?: readonly [open: string, close: string][];\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\nimport type { Parser } from './Parser';\nimport type { IUnorderedStrategy } from './strategies/IUnorderedStrategy';\n\nexport class ParserResult {\n\tpublic readonly ordered: Parameter[] = [];\n\tpublic readonly flags = new Set<string>();\n\tpublic readonly options = new Map<string, string[]>();\n\tprivate readonly strategy: IUnorderedStrategy;\n\n\tpublic constructor(parser: Parser) {\n\t\tthis.strategy = parser.strategy;\n\t}\n\n\tpublic parse(parameters: Iterable<Parameter>) {\n\t\tfor (const parameter of parameters) {\n\t\t\tthis.parsePossibleFlag(parameter) || this.parsePossibleOptions(parameter) || this.parseOrdered(parameter);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprivate parsePossibleFlag(parameter: Parameter): boolean {\n\t\treturn this.strategy\n\t\t\t.matchFlag(parameter.value)\n\t\t\t.inspect((value) => this.flags.add(value))\n\t\t\t.isSome();\n\t}\n\n\tprivate parsePossibleOptions(parameter: Parameter): boolean {\n\t\treturn this.strategy\n\t\t\t.matchOption(parameter.value)\n\t\t\t.inspect(([key, value]) => {\n\t\t\t\tconst existing = this.options.get(key);\n\t\t\t\tif (existing) existing.push(value);\n\t\t\t\telse this.options.set(key, [value]);\n\t\t\t})\n\t\t\t.isSome();\n\t}\n\n\tprivate parseOrdered(parameter: Parameter): boolean {\n\t\tthis.ordered.push(parameter);\n\t\treturn true;\n\t}\n}\n","import { Option } from '@sapphire/result';\nimport type { IUnorderedStrategy } from './IUnorderedStrategy';\n\nexport class EmptyStrategy implements IUnorderedStrategy {\n\tpublic matchFlag(): Option<string> {\n\t\treturn Option.none;\n\t}\n\n\tpublic matchOption(): Option<readonly [key: string, value: string]> {\n\t\treturn Option.none;\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\nimport type { IUnorderedStrategy } from './strategies/IUnorderedStrategy';\nimport { ParserResult } from './ParserResult';\nimport { EmptyStrategy } from './strategies/EmptyStrategy';\n\nexport class Parser {\n\tpublic strategy: IUnorderedStrategy;\n\n\tpublic constructor(strategy?: IUnorderedStrategy) {\n\t\tthis.strategy = strategy ?? new EmptyStrategy();\n\t}\n\n\tpublic setUnorderedStrategy(strategy: IUnorderedStrategy) {\n\t\tthis.strategy = strategy;\n\t\treturn this;\n\t}\n\n\tpublic run(input: Iterable<Parameter>): ParserResult {\n\t\treturn new ParserResult(this).parse(input);\n\t}\n}\n","import { Option } from '@sapphire/result';\nimport type { IUnorderedStrategy } from './IUnorderedStrategy';\n\nexport class PrefixedStrategy implements IUnorderedStrategy {\n\tpublic readonly prefixes: readonly string[];\n\tpublic readonly separators: readonly string[];\n\n\tpublic constructor(prefixes: readonly string[], separators: readonly string[]) {\n\t\tthis.prefixes = prefixes;\n\t\tthis.separators = separators;\n\t}\n\n\tpublic matchFlag(input: string): Option<string> {\n\t\tconst prefix = this.prefixes.find((x) => input.startsWith(x));\n\n\t\t// If the prefix is missing, return None:\n\t\tif (!prefix) return Option.none;\n\n\t\t// If the separator is present, return None:\n\t\tif (this.separators.some((x) => input.includes(x, prefix.length))) return Option.none;\n\n\t\treturn Option.some(input.slice(prefix.length));\n\t}\n\n\tpublic matchOption(input: string): Option<readonly [key: string, value: string]> {\n\t\tconst prefix = this.prefixes.find((x) => input.startsWith(x));\n\n\t\t// If the prefix is missing, return None:\n\t\tif (!prefix) return Option.none;\n\n\t\tfor (const separator of this.separators) {\n\t\t\tconst index = input.indexOf(separator, prefix.length + 1);\n\n\t\t\t// If the separator is missing, skip:\n\t\t\tif (index === -1) continue;\n\n\t\t\t// If the separator is present, but has no value, return None:\n\t\t\tif (index + separator.length === input.length) return Option.none;\n\n\t\t\tconst key = input.slice(prefix.length, index);\n\t\t\tconst value = input.slice(index + separator.length);\n\t\t\treturn Option.some([key, value] as const);\n\t\t}\n\n\t\treturn Option.none;\n\t}\n}\n","import type { Parameter } from '../lexer/streams/ParameterStream';\n\n/**\n * Joins the parameters by their `leading` value, using the `value` property.\n * @seealso {@link joinRaw} for the version using `raw` instead of `value`.\n * @param parameters The parameters to join.\n * @returns The result of joining the parameters.\n */\nexport function join(parameters: readonly Parameter[]) {\n\tif (parameters.length === 0) return '';\n\tif (parameters.length === 1) return parameters[0].value;\n\n\tlet output = parameters[0].value;\n\tfor (let i = 1; i < parameters.length; i++) {\n\t\tconst parameter = parameters[i];\n\t\toutput += parameter.leading + parameter.value;\n\t}\n\n\treturn output;\n}\n\n/**\n * Joins the parameters by their `leading` value, using the `raw` property.\n * @seealso {@link join} for the version using `value` instead of `raw`.\n * @param parameters The parameters to join.\n * @returns The result of joining the parameters.\n */\nexport function joinRaw(parameters: readonly Parameter[]) {\n\tif (parameters.length === 0) return '';\n\tif (parameters.length === 1) return parameters[0].raw;\n\n\tlet output = parameters[0].raw;\n\tfor (let i = 1; i < parameters.length; i++) {\n\t\tconst parameter = parameters[i];\n\t\toutput += parameter.leading + parameter.raw;\n\t}\n\n\treturn output;\n}\n"]}
|