@ax-llm/ax 9.0.57 → 9.0.60

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.
Files changed (43) hide show
  1. package/ai/google-gemini/api.js +7 -4
  2. package/ai/google-gemini/api.js.map +1 -1
  3. package/ai/google-gemini/types.d.ts +6 -2
  4. package/ai/google-gemini/types.js +1 -1
  5. package/ai/google-gemini/types.js.map +1 -1
  6. package/cjs/ai/google-gemini/api.js +7 -4
  7. package/cjs/ai/google-gemini/api.js.map +1 -1
  8. package/cjs/ai/google-gemini/types.d.ts +6 -2
  9. package/cjs/ai/google-gemini/types.js +1 -1
  10. package/cjs/ai/google-gemini/types.js.map +1 -1
  11. package/cjs/dsp/datetime.d.ts +1 -0
  12. package/cjs/dsp/datetime.js +7 -0
  13. package/cjs/dsp/datetime.js.map +1 -1
  14. package/cjs/dsp/extract.js +7 -3
  15. package/cjs/dsp/extract.js.map +1 -1
  16. package/cjs/dsp/index.d.ts +1 -1
  17. package/cjs/dsp/parser.d.ts +33 -80
  18. package/cjs/dsp/parser.js +148 -1566
  19. package/cjs/dsp/parser.js.map +1 -1
  20. package/cjs/dsp/prompt.js +13 -2
  21. package/cjs/dsp/prompt.js.map +1 -1
  22. package/cjs/dsp/sig.d.ts +2 -1
  23. package/cjs/dsp/sig.js +7 -7
  24. package/cjs/dsp/sig.js.map +1 -1
  25. package/cjs/dsp/util.js +4 -0
  26. package/cjs/dsp/util.js.map +1 -1
  27. package/dsp/datetime.d.ts +1 -0
  28. package/dsp/datetime.js +5 -0
  29. package/dsp/datetime.js.map +1 -1
  30. package/dsp/extract.js +7 -3
  31. package/dsp/extract.js.map +1 -1
  32. package/dsp/index.d.ts +1 -1
  33. package/dsp/parser.d.ts +33 -80
  34. package/dsp/parser.js +147 -1565
  35. package/dsp/parser.js.map +1 -1
  36. package/dsp/prompt.js +13 -2
  37. package/dsp/prompt.js.map +1 -1
  38. package/dsp/sig.d.ts +2 -1
  39. package/dsp/sig.js +8 -8
  40. package/dsp/sig.js.map +1 -1
  41. package/dsp/util.js +4 -0
  42. package/dsp/util.js.map +1 -1
  43. package/package.json +1 -1
package/cjs/dsp/parser.js CHANGED
@@ -1,1587 +1,169 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PeggySyntaxError = exports.parse = void 0;
5
- const peggyParser = // Generated by Peggy 3.0.2.
6
-
7
- //
8
- // https://peggyjs.org/
9
- // @ts-ignore
10
- (function () {
11
- // @ts-ignore
12
- "use strict";
13
- // @ts-ignore
14
- function peg$subclass(child, parent) {
15
- // @ts-ignore
16
- function C() { this.constructor = child; }
17
- // @ts-ignore
18
- C.prototype = parent.prototype;
19
- // @ts-ignore
20
- child.prototype = new C();
3
+ exports.parseSignature = parseSignature;
4
+ class SignatureParser {
5
+ input;
6
+ position;
7
+ constructor(input) {
8
+ this.input = input;
9
+ this.position = 0;
21
10
  }
22
- // @ts-ignore
23
- function peg$SyntaxError(message, expected, found, location) {
24
- // @ts-ignore
25
- var self = Error.call(this, message);
26
- // istanbul ignore next Check is a necessary evil to support older environments
27
- // @ts-ignore
28
- if (Object.setPrototypeOf) {
29
- // @ts-ignore
30
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
31
- }
32
- // @ts-ignore
33
- self.expected = expected;
34
- // @ts-ignore
35
- self.found = found;
36
- // @ts-ignore
37
- self.location = location;
38
- // @ts-ignore
39
- self.name = "SyntaxError";
40
- // @ts-ignore
41
- return self;
11
+ parse() {
12
+ this.skipWhitespace();
13
+ const optionalDesc = this.parseParsedString();
14
+ this.skipWhitespace();
15
+ const inputs = this.parseInputParsedFieldList();
16
+ this.skipWhitespace();
17
+ this.expect('->');
18
+ this.skipWhitespace();
19
+ const outputs = this.parseOutputParsedFieldList();
20
+ return {
21
+ desc: optionalDesc?.trim(),
22
+ inputs,
23
+ outputs,
24
+ };
42
25
  }
43
- // @ts-ignore
44
- peg$subclass(peg$SyntaxError, Error);
45
- // @ts-ignore
46
- function peg$padEnd(str, targetLength, padString) {
47
- // @ts-ignore
48
- padString = padString || " ";
49
- // @ts-ignore
50
- if (str.length > targetLength) {
51
- return str;
52
- }
53
- // @ts-ignore
54
- targetLength -= str.length;
55
- // @ts-ignore
56
- padString += padString.repeat(targetLength);
57
- // @ts-ignore
58
- return str + padString.slice(0, targetLength);
26
+ parseInputParsedFieldList() {
27
+ const fields = [];
28
+ fields.push(this.parseInputParsedField());
29
+ while (this.match(',')) {
30
+ this.skipWhitespace();
31
+ fields.push(this.parseInputParsedField());
32
+ }
33
+ return fields;
59
34
  }
60
- // @ts-ignore
61
- peg$SyntaxError.prototype.format = function (sources) {
62
- // @ts-ignore
63
- var str = "Error: " + this.message;
64
- // @ts-ignore
65
- if (this.location) {
66
- // @ts-ignore
67
- var src = null;
68
- // @ts-ignore
69
- var k;
70
- // @ts-ignore
71
- for (k = 0; k < sources.length; k++) {
72
- // @ts-ignore
73
- if (sources[k].source === this.location.source) {
74
- // @ts-ignore
75
- src = sources[k].text.split(/\r\n|\n|\r/g);
76
- // @ts-ignore
77
- break;
78
- }
79
- }
80
- // @ts-ignore
81
- var s = this.location.start;
82
- // @ts-ignore
83
- var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
84
- // @ts-ignore
85
- ? this.location.source.offset(s)
86
- // @ts-ignore
87
- : s;
88
- // @ts-ignore
89
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
90
- // @ts-ignore
91
- if (src) {
92
- // @ts-ignore
93
- var e = this.location.end;
94
- // @ts-ignore
95
- var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
96
- // @ts-ignore
97
- var line = src[s.line - 1];
98
- // @ts-ignore
99
- var last = s.line === e.line ? e.column : line.length + 1;
100
- // @ts-ignore
101
- var hatLen = (last - s.column) || 1;
102
- // @ts-ignore
103
- str += "\n --> " + loc + "\n"
104
- // @ts-ignore
105
- + filler + " |\n"
106
- // @ts-ignore
107
- + offset_s.line + " | " + line + "\n"
108
- // @ts-ignore
109
- + filler + " | " + peg$padEnd("", s.column - 1, ' ')
110
- // @ts-ignore
111
- + peg$padEnd("", hatLen, "^");
112
- // @ts-ignore
113
- }
114
- else {
115
- // @ts-ignore
116
- str += "\n at " + loc;
117
- }
118
- }
119
- // @ts-ignore
120
- return str;
121
- };
122
- // @ts-ignore
123
- peg$SyntaxError.buildMessage = function (expected, found) {
124
- // @ts-ignore
125
- var DESCRIBE_EXPECTATION_FNS = {
126
- // @ts-ignore
127
- literal: function (expectation) {
128
- // @ts-ignore
129
- return "\"" + literalEscape(expectation.text) + "\"";
130
- },
131
- // @ts-ignore
132
- class: function (expectation) {
133
- // @ts-ignore
134
- var escapedParts = expectation.parts.map(function (part) {
135
- // @ts-ignore
136
- return Array.isArray(part)
137
- // @ts-ignore
138
- ? classEscape(part[0]) + "-" + classEscape(part[1])
139
- // @ts-ignore
140
- : classEscape(part);
141
- });
142
- // @ts-ignore
143
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
144
- },
145
- // @ts-ignore
146
- any: function () {
147
- // @ts-ignore
148
- return "any character";
149
- },
150
- // @ts-ignore
151
- end: function () {
152
- // @ts-ignore
153
- return "end of input";
154
- },
155
- // @ts-ignore
156
- other: function (expectation) {
157
- // @ts-ignore
158
- return expectation.description;
159
- }
160
- };
161
- // @ts-ignore
162
- function hex(ch) {
163
- // @ts-ignore
164
- return ch.charCodeAt(0).toString(16).toUpperCase();
165
- }
166
- // @ts-ignore
167
- function literalEscape(s) {
168
- // @ts-ignore
169
- return s
170
- // @ts-ignore
171
- .replace(/\\/g, "\\\\")
172
- // @ts-ignore
173
- .replace(/"/g, "\\\"")
174
- // @ts-ignore
175
- .replace(/\0/g, "\\0")
176
- // @ts-ignore
177
- .replace(/\t/g, "\\t")
178
- // @ts-ignore
179
- .replace(/\n/g, "\\n")
180
- // @ts-ignore
181
- .replace(/\r/g, "\\r")
182
- // @ts-ignore
183
- .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
184
- // @ts-ignore
185
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
186
- }
187
- // @ts-ignore
188
- function classEscape(s) {
189
- // @ts-ignore
190
- return s
191
- // @ts-ignore
192
- .replace(/\\/g, "\\\\")
193
- // @ts-ignore
194
- .replace(/\]/g, "\\]")
195
- // @ts-ignore
196
- .replace(/\^/g, "\\^")
197
- // @ts-ignore
198
- .replace(/-/g, "\\-")
199
- // @ts-ignore
200
- .replace(/\0/g, "\\0")
201
- // @ts-ignore
202
- .replace(/\t/g, "\\t")
203
- // @ts-ignore
204
- .replace(/\n/g, "\\n")
205
- // @ts-ignore
206
- .replace(/\r/g, "\\r")
207
- // @ts-ignore
208
- .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
209
- // @ts-ignore
210
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
211
- }
212
- // @ts-ignore
213
- function describeExpectation(expectation) {
214
- // @ts-ignore
215
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
216
- }
217
- // @ts-ignore
218
- function describeExpected(expected) {
219
- // @ts-ignore
220
- var descriptions = expected.map(describeExpectation);
221
- // @ts-ignore
222
- var i, j;
223
- // @ts-ignore
224
- descriptions.sort();
225
- // @ts-ignore
226
- if (descriptions.length > 0) {
227
- // @ts-ignore
228
- for (i = 1, j = 1; i < descriptions.length; i++) {
229
- // @ts-ignore
230
- if (descriptions[i - 1] !== descriptions[i]) {
231
- // @ts-ignore
232
- descriptions[j] = descriptions[i];
233
- // @ts-ignore
234
- j++;
235
- }
236
- }
237
- // @ts-ignore
238
- descriptions.length = j;
239
- }
240
- // @ts-ignore
241
- switch (descriptions.length) {
242
- // @ts-ignore
243
- case 1:
244
- // @ts-ignore
245
- return descriptions[0];
246
- // @ts-ignore
247
- case 2:
248
- // @ts-ignore
249
- return descriptions[0] + " or " + descriptions[1];
250
- // @ts-ignore
251
- default:
252
- // @ts-ignore
253
- return descriptions.slice(0, -1).join(", ")
254
- // @ts-ignore
255
- + ", or "
256
- // @ts-ignore
257
- + descriptions[descriptions.length - 1];
258
- }
259
- }
260
- // @ts-ignore
261
- function describeFound(found) {
262
- // @ts-ignore
263
- return found ? "\"" + literalEscape(found) + "\"" : "end of input";
264
- }
265
- // @ts-ignore
266
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
267
- };
268
- // @ts-ignore
269
- function peg$parse(input, options) {
270
- // @ts-ignore
271
- options = options !== undefined ? options : {};
272
- // @ts-ignore
273
- var peg$FAILED = {};
274
- // @ts-ignore
275
- var peg$source = options.grammarSource;
276
- // @ts-ignore
277
- var peg$startRuleFunctions = { ParsedSignature: peg$parseParsedSignature };
278
- // @ts-ignore
279
- var peg$startRuleFunction = peg$parseParsedSignature;
280
- // @ts-ignore
281
- var peg$c0 = "->";
282
- var peg$c1 = ",";
283
- var peg$c2 = "?";
284
- var peg$c3 = ":";
285
- var peg$c4 = "[]";
286
- var peg$c5 = "string";
287
- var peg$c6 = "number";
288
- var peg$c7 = "boolean";
289
- var peg$c8 = "json";
290
- var peg$c9 = "image";
291
- var peg$c10 = "datetime";
292
- var peg$c11 = "date";
293
- var peg$c12 = "'";
294
- var peg$c13 = "\"";
295
- var peg$r0 = /^[a-zA-Z_0-9]/;
296
- var peg$r1 = /^[^']/;
297
- var peg$r2 = /^[^"]/;
298
- var peg$r3 = /^[ \t\r\n]/;
299
- var peg$e0 = peg$literalExpectation("->", false);
300
- var peg$e1 = peg$literalExpectation(",", false);
301
- var peg$e2 = peg$literalExpectation("?", false);
302
- var peg$e3 = peg$literalExpectation(":", false);
303
- var peg$e4 = peg$literalExpectation("[]", false);
304
- var peg$e5 = peg$literalExpectation("string", false);
305
- var peg$e6 = peg$literalExpectation("number", false);
306
- var peg$e7 = peg$literalExpectation("boolean", false);
307
- var peg$e8 = peg$literalExpectation("json", false);
308
- var peg$e9 = peg$literalExpectation("image", false);
309
- var peg$e10 = peg$literalExpectation("datetime", false);
310
- var peg$e11 = peg$literalExpectation("date", false);
311
- var peg$e12 = peg$classExpectation([["a", "z"], ["A", "Z"], "_", ["0", "9"]], false, false);
312
- var peg$e13 = peg$literalExpectation("'", false);
313
- var peg$e14 = peg$classExpectation(["'"], true, false);
314
- var peg$e15 = peg$literalExpectation("\"", false);
315
- var peg$e16 = peg$classExpectation(["\""], true, false);
316
- var peg$e17 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false);
317
- // @ts-ignore
318
- var peg$f0 = function (optionalDesc, inputs, outputs) {
319
- // @ts-ignore
320
- return {
321
- // @ts-ignore
322
- desc: optionalDesc ? optionalDesc.join("").trim() : undefined,
323
- // @ts-ignore
324
- inputs,
325
- // @ts-ignore
326
- outputs
327
- };
328
- }; // @ts-ignore
329
- var peg$f1 = function (name, isOptional, optionalType, optionalDesc) {
330
- // @ts-ignore
331
- return {
332
- // @ts-ignore
333
- name,
334
- // @ts-ignore
335
- desc: optionalDesc ? optionalDesc.join("").trim() : undefined,
336
- // @ts-ignore
337
- type: optionalType ? optionalType.at(-1) : undefined,
338
- // @ts-ignore
339
- isOptional: isOptional ? true : undefined
340
- };
341
- }; // @ts-ignore
342
- var peg$f2 = function (type, isArray) {
343
- // @ts-ignore
344
- return { name: type, isArray: isArray ? true : false };
345
- }; // @ts-ignore
346
- var peg$f3 = function (chars) {
347
- // @ts-ignore
348
- return chars.join("");
349
- }; // @ts-ignore
350
- var peg$f4 = function (content) {
351
- return content.join("");
352
- }; // @ts-ignore
353
- var peg$f5 = function (content) {
354
- return content.join("");
355
- }; // @ts-ignore
356
- var peg$f6 = function () {
357
- // @ts-ignore
358
- return "";
359
- }; // @ts-ignore
360
- var peg$f7 = function () {
361
- // @ts-ignore
362
- return "";
35
+ parseOutputParsedFieldList() {
36
+ const fields = [];
37
+ fields.push(this.parseOutputParsedField());
38
+ while (this.match(',')) {
39
+ this.skipWhitespace();
40
+ fields.push(this.parseOutputParsedField());
41
+ }
42
+ return fields;
43
+ }
44
+ parseInputParsedField() {
45
+ this.skipWhitespace();
46
+ const name = this.parseParsedIdentifier();
47
+ const isOptional = this.match('?');
48
+ let type;
49
+ let desc;
50
+ if (this.match(':')) {
51
+ this.skipWhitespace();
52
+ const typeName = this.parseTypeNotClass();
53
+ const isArray = this.match('[]');
54
+ type = { name: typeName, isArray };
55
+ }
56
+ this.skipWhitespace();
57
+ desc = this.parseParsedString();
58
+ return {
59
+ name,
60
+ desc: desc?.trim(),
61
+ type,
62
+ isOptional,
363
63
  };
364
- // @ts-ignore
365
- var peg$currPos = 0;
366
- // @ts-ignore
367
- var peg$savedPos = 0;
368
- // @ts-ignore
369
- var peg$posDetailsCache = [{ line: 1, column: 1 }];
370
- // @ts-ignore
371
- var peg$maxFailPos = 0;
372
- // @ts-ignore
373
- var peg$maxFailExpected = [];
374
- // @ts-ignore
375
- var peg$silentFails = 0;
376
- // @ts-ignore
377
- var peg$resultsCache = {};
378
- // @ts-ignore
379
- var peg$result;
380
- // @ts-ignore
381
- if ("startRule" in options) {
382
- // @ts-ignore
383
- if (!(options.startRule in peg$startRuleFunctions)) {
384
- // @ts-ignore
385
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
386
- }
387
- // @ts-ignore
388
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
389
- }
390
- // @ts-ignore
391
- function text() {
392
- // @ts-ignore
393
- return input.substring(peg$savedPos, peg$currPos);
394
- }
395
- // @ts-ignore
396
- function offset() {
397
- // @ts-ignore
398
- return peg$savedPos;
399
- }
400
- // @ts-ignore
401
- function range() {
402
- // @ts-ignore
403
- return {
404
- // @ts-ignore
405
- source: peg$source,
406
- // @ts-ignore
407
- start: peg$savedPos,
408
- // @ts-ignore
409
- end: peg$currPos
410
- };
411
- }
412
- // @ts-ignore
413
- function location() {
414
- // @ts-ignore
415
- return peg$computeLocation(peg$savedPos, peg$currPos);
416
- }
417
- // @ts-ignore
418
- function expected(description, location) {
419
- // @ts-ignore
420
- location = location !== undefined
421
- // @ts-ignore
422
- ? location
423
- // @ts-ignore
424
- : peg$computeLocation(peg$savedPos, peg$currPos);
425
- // @ts-ignore
426
- throw peg$buildStructuredError(
427
- // @ts-ignore
428
- [peg$otherExpectation(description)],
429
- // @ts-ignore
430
- input.substring(peg$savedPos, peg$currPos),
431
- // @ts-ignore
432
- location);
433
- }
434
- // @ts-ignore
435
- function error(message, location) {
436
- // @ts-ignore
437
- location = location !== undefined
438
- // @ts-ignore
439
- ? location
440
- // @ts-ignore
441
- : peg$computeLocation(peg$savedPos, peg$currPos);
442
- // @ts-ignore
443
- throw peg$buildSimpleError(message, location);
444
- }
445
- // @ts-ignore
446
- function peg$literalExpectation(text, ignoreCase) {
447
- // @ts-ignore
448
- return { type: "literal", text: text, ignoreCase: ignoreCase };
449
- }
450
- // @ts-ignore
451
- function peg$classExpectation(parts, inverted, ignoreCase) {
452
- // @ts-ignore
453
- return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
454
- }
455
- // @ts-ignore
456
- function peg$anyExpectation() {
457
- // @ts-ignore
458
- return { type: "any" };
459
- }
460
- // @ts-ignore
461
- function peg$endExpectation() {
462
- // @ts-ignore
463
- return { type: "end" };
464
- }
465
- // @ts-ignore
466
- function peg$otherExpectation(description) {
467
- // @ts-ignore
468
- return { type: "other", description: description };
469
- }
470
- // @ts-ignore
471
- function peg$computePosDetails(pos) {
472
- // @ts-ignore
473
- var details = peg$posDetailsCache[pos];
474
- // @ts-ignore
475
- var p;
476
- // @ts-ignore
477
- if (details) {
478
- // @ts-ignore
479
- return details;
480
- // @ts-ignore
64
+ }
65
+ parseOutputParsedField() {
66
+ this.skipWhitespace();
67
+ const name = this.parseParsedIdentifier();
68
+ const isOptional = this.match('?');
69
+ this.skipWhitespace();
70
+ if (this.match(':')) {
71
+ this.skipWhitespace();
72
+ if (this.match('class')) {
73
+ const isArray = this.match('[]');
74
+ this.skipWhitespace();
75
+ const desc = this.parseParsedString();
76
+ if (!desc) {
77
+ throw new Error("Expected description containing class names after type 'class'");
78
+ }
79
+ const classNames = desc.split(',').map(s => s.trim());
80
+ return {
81
+ name,
82
+ type: { name: 'class', isArray, classes: classNames },
83
+ isOptional,
84
+ };
481
85
  }
482
86
  else {
483
- // @ts-ignore
484
- p = pos - 1;
485
- // @ts-ignore
486
- while (!peg$posDetailsCache[p]) {
487
- // @ts-ignore
488
- p--;
489
- }
490
- // @ts-ignore
491
- details = peg$posDetailsCache[p];
492
- // @ts-ignore
493
- details = {
494
- // @ts-ignore
495
- line: details.line,
496
- // @ts-ignore
497
- column: details.column
87
+ const typeName = this.parseTypeNotClass();
88
+ const isArray = this.match('[]');
89
+ this.skipWhitespace();
90
+ const desc = this.parseParsedString();
91
+ return {
92
+ name,
93
+ desc: desc?.trim(),
94
+ type: { name: typeName, isArray },
95
+ isOptional,
498
96
  };
499
- // @ts-ignore
500
- while (p < pos) {
501
- // @ts-ignore
502
- if (input.charCodeAt(p) === 10) {
503
- // @ts-ignore
504
- details.line++;
505
- // @ts-ignore
506
- details.column = 1;
507
- // @ts-ignore
508
- }
509
- else {
510
- // @ts-ignore
511
- details.column++;
512
- }
513
- // @ts-ignore
514
- p++;
515
- }
516
- // @ts-ignore
517
- peg$posDetailsCache[pos] = details;
518
- // @ts-ignore
519
- return details;
520
97
  }
521
98
  }
522
- // @ts-ignore
523
- function peg$computeLocation(startPos, endPos, offset) {
524
- // @ts-ignore
525
- var startPosDetails = peg$computePosDetails(startPos);
526
- // @ts-ignore
527
- var endPosDetails = peg$computePosDetails(endPos);
528
- // @ts-ignore
529
- var res = {
530
- // @ts-ignore
531
- source: peg$source,
532
- // @ts-ignore
533
- start: {
534
- // @ts-ignore
535
- offset: startPos,
536
- // @ts-ignore
537
- line: startPosDetails.line,
538
- // @ts-ignore
539
- column: startPosDetails.column
540
- },
541
- // @ts-ignore
542
- end: {
543
- // @ts-ignore
544
- offset: endPos,
545
- // @ts-ignore
546
- line: endPosDetails.line,
547
- // @ts-ignore
548
- column: endPosDetails.column
549
- }
99
+ else {
100
+ this.skipWhitespace();
101
+ const desc = this.parseParsedString();
102
+ return {
103
+ name,
104
+ desc: desc?.trim(),
105
+ type: undefined,
106
+ isOptional,
550
107
  };
551
- // @ts-ignore
552
- if (offset && peg$source && (typeof peg$source.offset === "function")) {
553
- // @ts-ignore
554
- res.start = peg$source.offset(res.start);
555
- // @ts-ignore
556
- res.end = peg$source.offset(res.end);
557
- }
558
- // @ts-ignore
559
- return res;
560
- }
561
- // @ts-ignore
562
- function peg$fail(expected) {
563
- // @ts-ignore
564
- if (peg$currPos < peg$maxFailPos) {
565
- return;
566
- }
567
- // @ts-ignore
568
- if (peg$currPos > peg$maxFailPos) {
569
- // @ts-ignore
570
- peg$maxFailPos = peg$currPos;
571
- // @ts-ignore
572
- peg$maxFailExpected = [];
573
- }
574
- // @ts-ignore
575
- peg$maxFailExpected.push(expected);
576
- }
577
- // @ts-ignore
578
- function peg$buildSimpleError(message, location) {
579
- // @ts-ignore
580
- return new peg$SyntaxError(message, null, null, location);
581
- }
582
- // @ts-ignore
583
- function peg$buildStructuredError(expected, found, location) {
584
- // @ts-ignore
585
- return new peg$SyntaxError(
586
- // @ts-ignore
587
- peg$SyntaxError.buildMessage(expected, found),
588
- // @ts-ignore
589
- expected,
590
- // @ts-ignore
591
- found,
592
- // @ts-ignore
593
- location);
594
- }
595
- // @ts-ignore
596
- function peg$parseParsedSignature() {
597
- // @ts-ignore
598
- var s0, s1, s2, s3, s4, s5, s6, s7;
599
- // @ts-ignore
600
- var key = peg$currPos * 9 + 0;
601
- // @ts-ignore
602
- var cached = peg$resultsCache[key];
603
- // @ts-ignore
604
- if (cached) {
605
- // @ts-ignore
606
- peg$currPos = cached.nextPos;
607
- // @ts-ignore
608
- return cached.result;
609
- }
610
- // @ts-ignore
611
- s0 = peg$currPos;
612
- // @ts-ignore
613
- s1 = peg$currPos;
614
- // @ts-ignore
615
- s2 = peg$parse_();
616
- // @ts-ignore
617
- s3 = peg$parseParsedString();
618
- // @ts-ignore
619
- if (s3 !== peg$FAILED) {
620
- // @ts-ignore
621
- s4 = peg$parse_();
622
- // @ts-ignore
623
- s2 = [s2, s3, s4];
624
- // @ts-ignore
625
- s1 = s2;
626
- // @ts-ignore
627
- }
628
- else {
629
- // @ts-ignore
630
- peg$currPos = s1;
631
- // @ts-ignore
632
- s1 = peg$FAILED;
633
- }
634
- // @ts-ignore
635
- if (s1 === peg$FAILED) {
636
- // @ts-ignore
637
- s1 = null;
638
- }
639
- // @ts-ignore
640
- s2 = peg$parseParsedFieldList();
641
- // @ts-ignore
642
- s3 = peg$parse__();
643
- // @ts-ignore
644
- if (s3 !== peg$FAILED) {
645
- // @ts-ignore
646
- if (input.substr(peg$currPos, 2) === peg$c0) {
647
- // @ts-ignore
648
- s4 = peg$c0;
649
- // @ts-ignore
650
- peg$currPos += 2;
651
- // @ts-ignore
652
- }
653
- else {
654
- // @ts-ignore
655
- s4 = peg$FAILED;
656
- // @ts-ignore
657
- if (peg$silentFails === 0) {
658
- peg$fail(peg$e0);
659
- }
660
- }
661
- // @ts-ignore
662
- if (s4 !== peg$FAILED) {
663
- // @ts-ignore
664
- s5 = peg$parse__();
665
- // @ts-ignore
666
- if (s5 !== peg$FAILED) {
667
- // @ts-ignore
668
- s6 = peg$parseParsedFieldList();
669
- // @ts-ignore
670
- s7 = peg$parse_();
671
- // @ts-ignore
672
- peg$savedPos = s0;
673
- // @ts-ignore
674
- s0 = peg$f0(s1, s2, s6);
675
- // @ts-ignore
676
- }
677
- else {
678
- // @ts-ignore
679
- peg$currPos = s0;
680
- // @ts-ignore
681
- s0 = peg$FAILED;
682
- }
683
- // @ts-ignore
684
- }
685
- else {
686
- // @ts-ignore
687
- peg$currPos = s0;
688
- // @ts-ignore
689
- s0 = peg$FAILED;
690
- }
691
- // @ts-ignore
692
- }
693
- else {
694
- // @ts-ignore
695
- peg$currPos = s0;
696
- // @ts-ignore
697
- s0 = peg$FAILED;
698
- }
699
- // @ts-ignore
700
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
701
- // @ts-ignore
702
- return s0;
703
- }
704
- // @ts-ignore
705
- function peg$parseParsedFieldList() {
706
- // @ts-ignore
707
- var s0, s1, s2, s3, s4, s5;
708
- // @ts-ignore
709
- var key = peg$currPos * 9 + 1;
710
- // @ts-ignore
711
- var cached = peg$resultsCache[key];
712
- // @ts-ignore
713
- if (cached) {
714
- // @ts-ignore
715
- peg$currPos = cached.nextPos;
716
- // @ts-ignore
717
- return cached.result;
718
- }
719
- // @ts-ignore
720
- s0 = [];
721
- // @ts-ignore
722
- s1 = peg$parseParsedField();
723
- // @ts-ignore
724
- while (s1 !== peg$FAILED) {
725
- // @ts-ignore
726
- s0.push(s1);
727
- // @ts-ignore
728
- s1 = peg$currPos;
729
- // @ts-ignore
730
- s2 = peg$currPos;
731
- // @ts-ignore
732
- s3 = peg$parse_();
733
- // @ts-ignore
734
- if (input.charCodeAt(peg$currPos) === 44) {
735
- // @ts-ignore
736
- s4 = peg$c1;
737
- // @ts-ignore
738
- peg$currPos++;
739
- // @ts-ignore
740
- }
741
- else {
742
- // @ts-ignore
743
- s4 = peg$FAILED;
744
- // @ts-ignore
745
- if (peg$silentFails === 0) {
746
- peg$fail(peg$e1);
747
- }
748
- }
749
- // @ts-ignore
750
- if (s4 !== peg$FAILED) {
751
- // @ts-ignore
752
- s5 = peg$parse_();
753
- // @ts-ignore
754
- s3 = [s3, s4, s5];
755
- // @ts-ignore
756
- s2 = s3;
757
- // @ts-ignore
758
- }
759
- else {
760
- // @ts-ignore
761
- peg$currPos = s2;
762
- // @ts-ignore
763
- s2 = peg$FAILED;
764
- }
765
- // @ts-ignore
766
- if (s2 !== peg$FAILED) {
767
- // @ts-ignore
768
- s2 = peg$parseParsedField();
769
- // @ts-ignore
770
- s1 = s2;
771
- // @ts-ignore
772
- }
773
- else {
774
- // @ts-ignore
775
- s1 = s2;
776
- }
777
- }
778
- // @ts-ignore
779
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
780
- // @ts-ignore
781
- return s0;
782
- }
783
- // @ts-ignore
784
- function peg$parseParsedField() {
785
- // @ts-ignore
786
- var s0, s1, s2, s3, s4, s5, s6, s7, s8;
787
- // @ts-ignore
788
- var key = peg$currPos * 9 + 2;
789
- // @ts-ignore
790
- var cached = peg$resultsCache[key];
791
- // @ts-ignore
792
- if (cached) {
793
- // @ts-ignore
794
- peg$currPos = cached.nextPos;
795
- // @ts-ignore
796
- return cached.result;
797
- }
798
- // @ts-ignore
799
- s0 = peg$currPos;
800
- // @ts-ignore
801
- s1 = peg$parse_();
802
- // @ts-ignore
803
- s2 = peg$parseParsedIdentifier();
804
- // @ts-ignore
805
- if (input.charCodeAt(peg$currPos) === 63) {
806
- // @ts-ignore
807
- s3 = peg$c2;
808
- // @ts-ignore
809
- peg$currPos++;
810
- // @ts-ignore
811
- }
812
- else {
813
- // @ts-ignore
814
- s3 = peg$FAILED;
815
- // @ts-ignore
816
- if (peg$silentFails === 0) {
817
- peg$fail(peg$e2);
818
- }
819
- }
820
- // @ts-ignore
821
- if (s3 === peg$FAILED) {
822
- // @ts-ignore
823
- s3 = null;
824
- }
825
- // @ts-ignore
826
- s4 = peg$currPos;
827
- // @ts-ignore
828
- s5 = peg$parse_();
829
- // @ts-ignore
830
- if (input.charCodeAt(peg$currPos) === 58) {
831
- // @ts-ignore
832
- s6 = peg$c3;
833
- // @ts-ignore
834
- peg$currPos++;
835
- // @ts-ignore
836
- }
837
- else {
838
- // @ts-ignore
839
- s6 = peg$FAILED;
840
- // @ts-ignore
841
- if (peg$silentFails === 0) {
842
- peg$fail(peg$e3);
843
- }
844
- }
845
- // @ts-ignore
846
- if (s6 !== peg$FAILED) {
847
- // @ts-ignore
848
- s7 = peg$parse_();
849
- // @ts-ignore
850
- s8 = peg$parseParsedType();
851
- // @ts-ignore
852
- if (s8 !== peg$FAILED) {
853
- // @ts-ignore
854
- s5 = [s5, s6, s7, s8];
855
- // @ts-ignore
856
- s4 = s5;
857
- // @ts-ignore
858
- }
859
- else {
860
- // @ts-ignore
861
- peg$currPos = s4;
862
- // @ts-ignore
863
- s4 = peg$FAILED;
864
- }
865
- // @ts-ignore
866
- }
867
- else {
868
- // @ts-ignore
869
- peg$currPos = s4;
870
- // @ts-ignore
871
- s4 = peg$FAILED;
872
- }
873
- // @ts-ignore
874
- if (s4 === peg$FAILED) {
875
- // @ts-ignore
876
- s4 = null;
877
- }
878
- // @ts-ignore
879
- s5 = peg$currPos;
880
- // @ts-ignore
881
- s6 = peg$parse_();
882
- // @ts-ignore
883
- s7 = peg$parseParsedString();
884
- // @ts-ignore
885
- if (s7 !== peg$FAILED) {
886
- // @ts-ignore
887
- s6 = [s6, s7];
888
- // @ts-ignore
889
- s5 = s6;
890
- // @ts-ignore
891
- }
892
- else {
893
- // @ts-ignore
894
- peg$currPos = s5;
895
- // @ts-ignore
896
- s5 = peg$FAILED;
897
- }
898
- // @ts-ignore
899
- if (s5 === peg$FAILED) {
900
- // @ts-ignore
901
- s5 = null;
902
- }
903
- // @ts-ignore
904
- peg$savedPos = s0;
905
- // @ts-ignore
906
- s0 = peg$f1(s2, s3, s4, s5);
907
- // @ts-ignore
908
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
909
- // @ts-ignore
910
- return s0;
911
108
  }
912
- // @ts-ignore
913
- function peg$parseParsedType() {
914
- // @ts-ignore
915
- var s0, s1, s2;
916
- // @ts-ignore
917
- var key = peg$currPos * 9 + 3;
918
- // @ts-ignore
919
- var cached = peg$resultsCache[key];
920
- // @ts-ignore
921
- if (cached) {
922
- // @ts-ignore
923
- peg$currPos = cached.nextPos;
924
- // @ts-ignore
925
- return cached.result;
926
- }
927
- // @ts-ignore
928
- s0 = peg$currPos;
929
- // @ts-ignore
930
- s1 = peg$parseType();
931
- // @ts-ignore
932
- if (s1 !== peg$FAILED) {
933
- // @ts-ignore
934
- if (input.substr(peg$currPos, 2) === peg$c4) {
935
- // @ts-ignore
936
- s2 = peg$c4;
937
- // @ts-ignore
938
- peg$currPos += 2;
939
- // @ts-ignore
940
- }
941
- else {
942
- // @ts-ignore
943
- s2 = peg$FAILED;
944
- // @ts-ignore
945
- if (peg$silentFails === 0) {
946
- peg$fail(peg$e4);
947
- }
948
- }
949
- // @ts-ignore
950
- if (s2 === peg$FAILED) {
951
- // @ts-ignore
952
- s2 = null;
953
- }
954
- // @ts-ignore
955
- peg$savedPos = s0;
956
- // @ts-ignore
957
- s0 = peg$f2(s1, s2);
958
- // @ts-ignore
959
- }
960
- else {
961
- // @ts-ignore
962
- peg$currPos = s0;
963
- // @ts-ignore
964
- s0 = peg$FAILED;
965
- }
966
- // @ts-ignore
967
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
968
- // @ts-ignore
969
- return s0;
970
- }
971
- // @ts-ignore
972
- function peg$parseType() {
973
- // @ts-ignore
974
- var s0;
975
- // @ts-ignore
976
- var key = peg$currPos * 9 + 4;
977
- // @ts-ignore
978
- var cached = peg$resultsCache[key];
979
- // @ts-ignore
980
- if (cached) {
981
- // @ts-ignore
982
- peg$currPos = cached.nextPos;
983
- // @ts-ignore
984
- return cached.result;
985
- }
986
- // @ts-ignore
987
- if (input.substr(peg$currPos, 6) === peg$c5) {
988
- // @ts-ignore
989
- s0 = peg$c5;
990
- // @ts-ignore
991
- peg$currPos += 6;
992
- // @ts-ignore
993
- }
994
- else {
995
- // @ts-ignore
996
- s0 = peg$FAILED;
997
- // @ts-ignore
998
- if (peg$silentFails === 0) {
999
- peg$fail(peg$e5);
1000
- }
1001
- }
1002
- // @ts-ignore
1003
- if (s0 === peg$FAILED) {
1004
- // @ts-ignore
1005
- if (input.substr(peg$currPos, 6) === peg$c6) {
1006
- // @ts-ignore
1007
- s0 = peg$c6;
1008
- // @ts-ignore
1009
- peg$currPos += 6;
1010
- // @ts-ignore
1011
- }
1012
- else {
1013
- // @ts-ignore
1014
- s0 = peg$FAILED;
1015
- // @ts-ignore
1016
- if (peg$silentFails === 0) {
1017
- peg$fail(peg$e6);
1018
- }
1019
- }
1020
- // @ts-ignore
1021
- if (s0 === peg$FAILED) {
1022
- // @ts-ignore
1023
- if (input.substr(peg$currPos, 7) === peg$c7) {
1024
- // @ts-ignore
1025
- s0 = peg$c7;
1026
- // @ts-ignore
1027
- peg$currPos += 7;
1028
- // @ts-ignore
1029
- }
1030
- else {
1031
- // @ts-ignore
1032
- s0 = peg$FAILED;
1033
- // @ts-ignore
1034
- if (peg$silentFails === 0) {
1035
- peg$fail(peg$e7);
1036
- }
1037
- }
1038
- // @ts-ignore
1039
- if (s0 === peg$FAILED) {
1040
- // @ts-ignore
1041
- if (input.substr(peg$currPos, 4) === peg$c8) {
1042
- // @ts-ignore
1043
- s0 = peg$c8;
1044
- // @ts-ignore
1045
- peg$currPos += 4;
1046
- // @ts-ignore
1047
- }
1048
- else {
1049
- // @ts-ignore
1050
- s0 = peg$FAILED;
1051
- // @ts-ignore
1052
- if (peg$silentFails === 0) {
1053
- peg$fail(peg$e8);
1054
- }
1055
- }
1056
- // @ts-ignore
1057
- if (s0 === peg$FAILED) {
1058
- // @ts-ignore
1059
- if (input.substr(peg$currPos, 5) === peg$c9) {
1060
- // @ts-ignore
1061
- s0 = peg$c9;
1062
- // @ts-ignore
1063
- peg$currPos += 5;
1064
- // @ts-ignore
1065
- }
1066
- else {
1067
- // @ts-ignore
1068
- s0 = peg$FAILED;
1069
- // @ts-ignore
1070
- if (peg$silentFails === 0) {
1071
- peg$fail(peg$e9);
1072
- }
1073
- }
1074
- // @ts-ignore
1075
- if (s0 === peg$FAILED) {
1076
- // @ts-ignore
1077
- if (input.substr(peg$currPos, 8) === peg$c10) {
1078
- // @ts-ignore
1079
- s0 = peg$c10;
1080
- // @ts-ignore
1081
- peg$currPos += 8;
1082
- // @ts-ignore
1083
- }
1084
- else {
1085
- // @ts-ignore
1086
- s0 = peg$FAILED;
1087
- // @ts-ignore
1088
- if (peg$silentFails === 0) {
1089
- peg$fail(peg$e10);
1090
- }
1091
- }
1092
- // @ts-ignore
1093
- if (s0 === peg$FAILED) {
1094
- // @ts-ignore
1095
- if (input.substr(peg$currPos, 4) === peg$c11) {
1096
- // @ts-ignore
1097
- s0 = peg$c11;
1098
- // @ts-ignore
1099
- peg$currPos += 4;
1100
- // @ts-ignore
1101
- }
1102
- else {
1103
- // @ts-ignore
1104
- s0 = peg$FAILED;
1105
- // @ts-ignore
1106
- if (peg$silentFails === 0) {
1107
- peg$fail(peg$e11);
1108
- }
1109
- }
1110
- }
1111
- }
1112
- }
1113
- }
1114
- }
1115
- }
1116
- // @ts-ignore
1117
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
1118
- // @ts-ignore
1119
- return s0;
1120
- }
1121
- // @ts-ignore
1122
- function peg$parseParsedIdentifier() {
1123
- // @ts-ignore
1124
- var s0, s1, s2;
1125
- // @ts-ignore
1126
- var key = peg$currPos * 9 + 5;
1127
- // @ts-ignore
1128
- var cached = peg$resultsCache[key];
1129
- // @ts-ignore
1130
- if (cached) {
1131
- // @ts-ignore
1132
- peg$currPos = cached.nextPos;
1133
- // @ts-ignore
1134
- return cached.result;
1135
- }
1136
- // @ts-ignore
1137
- s0 = peg$currPos;
1138
- // @ts-ignore
1139
- s1 = [];
1140
- // @ts-ignore
1141
- if (peg$r0.test(input.charAt(peg$currPos))) {
1142
- // @ts-ignore
1143
- s2 = input.charAt(peg$currPos);
1144
- // @ts-ignore
1145
- peg$currPos++;
1146
- // @ts-ignore
1147
- }
1148
- else {
1149
- // @ts-ignore
1150
- s2 = peg$FAILED;
1151
- // @ts-ignore
1152
- if (peg$silentFails === 0) {
1153
- peg$fail(peg$e12);
1154
- }
1155
- }
1156
- // @ts-ignore
1157
- while (s2 !== peg$FAILED) {
1158
- // @ts-ignore
1159
- s1.push(s2);
1160
- // @ts-ignore
1161
- if (peg$r0.test(input.charAt(peg$currPos))) {
1162
- // @ts-ignore
1163
- s2 = input.charAt(peg$currPos);
1164
- // @ts-ignore
1165
- peg$currPos++;
1166
- // @ts-ignore
1167
- }
1168
- else {
1169
- // @ts-ignore
1170
- s2 = peg$FAILED;
1171
- // @ts-ignore
1172
- if (peg$silentFails === 0) {
1173
- peg$fail(peg$e12);
1174
- }
1175
- }
1176
- }
1177
- // @ts-ignore
1178
- peg$savedPos = s0;
1179
- // @ts-ignore
1180
- s1 = peg$f3(s1);
1181
- // @ts-ignore
1182
- s0 = s1;
1183
- // @ts-ignore
1184
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
1185
- // @ts-ignore
1186
- return s0;
1187
- }
1188
- // @ts-ignore
1189
- function peg$parseParsedString() {
1190
- // @ts-ignore
1191
- var s0, s1, s2, s3;
1192
- // @ts-ignore
1193
- var key = peg$currPos * 9 + 6;
1194
- // @ts-ignore
1195
- var cached = peg$resultsCache[key];
1196
- // @ts-ignore
1197
- if (cached) {
1198
- // @ts-ignore
1199
- peg$currPos = cached.nextPos;
1200
- // @ts-ignore
1201
- return cached.result;
1202
- }
1203
- // @ts-ignore
1204
- s0 = peg$currPos;
1205
- // @ts-ignore
1206
- if (input.charCodeAt(peg$currPos) === 39) {
1207
- // @ts-ignore
1208
- s1 = peg$c12;
1209
- // @ts-ignore
1210
- peg$currPos++;
1211
- // @ts-ignore
1212
- }
1213
- else {
1214
- // @ts-ignore
1215
- s1 = peg$FAILED;
1216
- // @ts-ignore
1217
- if (peg$silentFails === 0) {
1218
- peg$fail(peg$e13);
1219
- }
1220
- }
1221
- // @ts-ignore
1222
- if (s1 !== peg$FAILED) {
1223
- // @ts-ignore
1224
- s2 = [];
1225
- // @ts-ignore
1226
- if (peg$r1.test(input.charAt(peg$currPos))) {
1227
- // @ts-ignore
1228
- s3 = input.charAt(peg$currPos);
1229
- // @ts-ignore
1230
- peg$currPos++;
1231
- // @ts-ignore
1232
- }
1233
- else {
1234
- // @ts-ignore
1235
- s3 = peg$FAILED;
1236
- // @ts-ignore
1237
- if (peg$silentFails === 0) {
1238
- peg$fail(peg$e14);
1239
- }
1240
- }
1241
- // @ts-ignore
1242
- while (s3 !== peg$FAILED) {
1243
- // @ts-ignore
1244
- s2.push(s3);
1245
- // @ts-ignore
1246
- if (peg$r1.test(input.charAt(peg$currPos))) {
1247
- // @ts-ignore
1248
- s3 = input.charAt(peg$currPos);
1249
- // @ts-ignore
1250
- peg$currPos++;
1251
- // @ts-ignore
1252
- }
1253
- else {
1254
- // @ts-ignore
1255
- s3 = peg$FAILED;
1256
- // @ts-ignore
1257
- if (peg$silentFails === 0) {
1258
- peg$fail(peg$e14);
1259
- }
1260
- }
1261
- }
1262
- // @ts-ignore
1263
- if (input.charCodeAt(peg$currPos) === 39) {
1264
- // @ts-ignore
1265
- s3 = peg$c12;
1266
- // @ts-ignore
1267
- peg$currPos++;
1268
- // @ts-ignore
1269
- }
1270
- else {
1271
- // @ts-ignore
1272
- s3 = peg$FAILED;
1273
- // @ts-ignore
1274
- if (peg$silentFails === 0) {
1275
- peg$fail(peg$e13);
1276
- }
1277
- }
1278
- // @ts-ignore
1279
- if (s3 !== peg$FAILED) {
1280
- // @ts-ignore
1281
- peg$savedPos = s0;
1282
- // @ts-ignore
1283
- s0 = peg$f4(s2);
1284
- // @ts-ignore
1285
- }
1286
- else {
1287
- // @ts-ignore
1288
- peg$currPos = s0;
1289
- // @ts-ignore
1290
- s0 = peg$FAILED;
1291
- }
1292
- // @ts-ignore
1293
- }
1294
- else {
1295
- // @ts-ignore
1296
- peg$currPos = s0;
1297
- // @ts-ignore
1298
- s0 = peg$FAILED;
1299
- }
1300
- // @ts-ignore
1301
- if (s0 === peg$FAILED) {
1302
- // @ts-ignore
1303
- s0 = peg$currPos;
1304
- // @ts-ignore
1305
- if (input.charCodeAt(peg$currPos) === 34) {
1306
- // @ts-ignore
1307
- s1 = peg$c13;
1308
- // @ts-ignore
1309
- peg$currPos++;
1310
- // @ts-ignore
1311
- }
1312
- else {
1313
- // @ts-ignore
1314
- s1 = peg$FAILED;
1315
- // @ts-ignore
1316
- if (peg$silentFails === 0) {
1317
- peg$fail(peg$e15);
1318
- }
1319
- }
1320
- // @ts-ignore
1321
- if (s1 !== peg$FAILED) {
1322
- // @ts-ignore
1323
- s2 = [];
1324
- // @ts-ignore
1325
- if (peg$r2.test(input.charAt(peg$currPos))) {
1326
- // @ts-ignore
1327
- s3 = input.charAt(peg$currPos);
1328
- // @ts-ignore
1329
- peg$currPos++;
1330
- // @ts-ignore
1331
- }
1332
- else {
1333
- // @ts-ignore
1334
- s3 = peg$FAILED;
1335
- // @ts-ignore
1336
- if (peg$silentFails === 0) {
1337
- peg$fail(peg$e16);
1338
- }
1339
- }
1340
- // @ts-ignore
1341
- while (s3 !== peg$FAILED) {
1342
- // @ts-ignore
1343
- s2.push(s3);
1344
- // @ts-ignore
1345
- if (peg$r2.test(input.charAt(peg$currPos))) {
1346
- // @ts-ignore
1347
- s3 = input.charAt(peg$currPos);
1348
- // @ts-ignore
1349
- peg$currPos++;
1350
- // @ts-ignore
1351
- }
1352
- else {
1353
- // @ts-ignore
1354
- s3 = peg$FAILED;
1355
- // @ts-ignore
1356
- if (peg$silentFails === 0) {
1357
- peg$fail(peg$e16);
1358
- }
1359
- }
1360
- }
1361
- // @ts-ignore
1362
- if (input.charCodeAt(peg$currPos) === 34) {
1363
- // @ts-ignore
1364
- s3 = peg$c13;
1365
- // @ts-ignore
1366
- peg$currPos++;
1367
- // @ts-ignore
1368
- }
1369
- else {
1370
- // @ts-ignore
1371
- s3 = peg$FAILED;
1372
- // @ts-ignore
1373
- if (peg$silentFails === 0) {
1374
- peg$fail(peg$e15);
1375
- }
1376
- }
1377
- // @ts-ignore
1378
- if (s3 !== peg$FAILED) {
1379
- // @ts-ignore
1380
- peg$savedPos = s0;
1381
- // @ts-ignore
1382
- s0 = peg$f5(s2);
1383
- // @ts-ignore
1384
- }
1385
- else {
1386
- // @ts-ignore
1387
- peg$currPos = s0;
1388
- // @ts-ignore
1389
- s0 = peg$FAILED;
1390
- }
1391
- // @ts-ignore
1392
- }
1393
- else {
1394
- // @ts-ignore
1395
- peg$currPos = s0;
1396
- // @ts-ignore
1397
- s0 = peg$FAILED;
1398
- }
109
+ }
110
+ parseTypeNotClass() {
111
+ const types = ["string", "number", "boolean", "json", "image", "datetime", "date"];
112
+ for (const type of types) {
113
+ if (this.match(type)) {
114
+ return type;
1399
115
  }
1400
- // @ts-ignore
1401
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
1402
- // @ts-ignore
1403
- return s0;
1404
116
  }
1405
- // @ts-ignore
1406
- function peg$parse_() {
1407
- // @ts-ignore
1408
- var s0, s1, s2;
1409
- // @ts-ignore
1410
- var key = peg$currPos * 9 + 7;
1411
- // @ts-ignore
1412
- var cached = peg$resultsCache[key];
1413
- // @ts-ignore
1414
- if (cached) {
1415
- // @ts-ignore
1416
- peg$currPos = cached.nextPos;
1417
- // @ts-ignore
1418
- return cached.result;
1419
- }
1420
- // @ts-ignore
1421
- s0 = peg$currPos;
1422
- // @ts-ignore
1423
- s1 = [];
1424
- // @ts-ignore
1425
- if (peg$r3.test(input.charAt(peg$currPos))) {
1426
- // @ts-ignore
1427
- s2 = input.charAt(peg$currPos);
1428
- // @ts-ignore
1429
- peg$currPos++;
1430
- // @ts-ignore
1431
- }
1432
- else {
1433
- // @ts-ignore
1434
- s2 = peg$FAILED;
1435
- // @ts-ignore
1436
- if (peg$silentFails === 0) {
1437
- peg$fail(peg$e17);
1438
- }
1439
- }
1440
- // @ts-ignore
1441
- while (s2 !== peg$FAILED) {
1442
- // @ts-ignore
1443
- s1.push(s2);
1444
- // @ts-ignore
1445
- if (peg$r3.test(input.charAt(peg$currPos))) {
1446
- // @ts-ignore
1447
- s2 = input.charAt(peg$currPos);
1448
- // @ts-ignore
1449
- peg$currPos++;
1450
- // @ts-ignore
1451
- }
1452
- else {
1453
- // @ts-ignore
1454
- s2 = peg$FAILED;
1455
- // @ts-ignore
1456
- if (peg$silentFails === 0) {
1457
- peg$fail(peg$e17);
1458
- }
1459
- }
1460
- }
1461
- // @ts-ignore
1462
- peg$savedPos = s0;
1463
- // @ts-ignore
1464
- s1 = peg$f6();
1465
- // @ts-ignore
1466
- s0 = s1;
1467
- // @ts-ignore
1468
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
1469
- // @ts-ignore
1470
- return s0;
117
+ throw new Error(`Expected one of ${types.join(', ')}`);
118
+ }
119
+ parseParsedIdentifier() {
120
+ const match = /^[a-zA-Z_][a-zA-Z_0-9]*/.exec(this.input.slice(this.position));
121
+ if (match) {
122
+ this.position += match[0].length;
123
+ return match[0];
1471
124
  }
1472
- // @ts-ignore
1473
- function peg$parse__() {
1474
- // @ts-ignore
1475
- var s0, s1, s2;
1476
- // @ts-ignore
1477
- var key = peg$currPos * 9 + 8;
1478
- // @ts-ignore
1479
- var cached = peg$resultsCache[key];
1480
- // @ts-ignore
1481
- if (cached) {
1482
- // @ts-ignore
1483
- peg$currPos = cached.nextPos;
1484
- // @ts-ignore
1485
- return cached.result;
1486
- }
1487
- // @ts-ignore
1488
- s0 = peg$currPos;
1489
- // @ts-ignore
1490
- s1 = [];
1491
- // @ts-ignore
1492
- if (peg$r3.test(input.charAt(peg$currPos))) {
1493
- // @ts-ignore
1494
- s2 = input.charAt(peg$currPos);
1495
- // @ts-ignore
1496
- peg$currPos++;
1497
- // @ts-ignore
1498
- }
1499
- else {
1500
- // @ts-ignore
1501
- s2 = peg$FAILED;
1502
- // @ts-ignore
1503
- if (peg$silentFails === 0) {
1504
- peg$fail(peg$e17);
1505
- }
1506
- }
1507
- // @ts-ignore
1508
- if (s2 !== peg$FAILED) {
1509
- // @ts-ignore
1510
- while (s2 !== peg$FAILED) {
1511
- // @ts-ignore
1512
- s1.push(s2);
1513
- // @ts-ignore
1514
- if (peg$r3.test(input.charAt(peg$currPos))) {
1515
- // @ts-ignore
1516
- s2 = input.charAt(peg$currPos);
1517
- // @ts-ignore
1518
- peg$currPos++;
1519
- // @ts-ignore
1520
- }
1521
- else {
1522
- // @ts-ignore
1523
- s2 = peg$FAILED;
1524
- // @ts-ignore
1525
- if (peg$silentFails === 0) {
1526
- peg$fail(peg$e17);
1527
- }
1528
- }
1529
- }
1530
- // @ts-ignore
1531
- }
1532
- else {
1533
- // @ts-ignore
1534
- s1 = peg$FAILED;
1535
- }
1536
- // @ts-ignore
1537
- if (s1 !== peg$FAILED) {
1538
- // @ts-ignore
1539
- peg$savedPos = s0;
1540
- // @ts-ignore
1541
- s1 = peg$f7();
1542
- }
1543
- // @ts-ignore
1544
- s0 = s1;
1545
- // @ts-ignore
1546
- peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
1547
- // @ts-ignore
1548
- return s0;
125
+ throw new Error('Expected identifier');
126
+ }
127
+ parseParsedString() {
128
+ if (this.match("'")) {
129
+ const endQuote = this.input.indexOf("'", this.position);
130
+ if (endQuote === -1)
131
+ throw new Error("Unterminated string");
132
+ const content = this.input.slice(this.position, endQuote);
133
+ this.position = endQuote + 1;
134
+ return content;
135
+ }
136
+ else if (this.match('"')) {
137
+ const endQuote = this.input.indexOf('"', this.position);
138
+ if (endQuote === -1)
139
+ throw new Error("Unterminated string");
140
+ const content = this.input.slice(this.position, endQuote);
141
+ this.position = endQuote + 1;
142
+ return content;
143
+ }
144
+ return undefined;
145
+ }
146
+ skipWhitespace() {
147
+ const match = /^[ \t\r\n]+/.exec(this.input.slice(this.position));
148
+ if (match) {
149
+ this.position += match[0].length;
1549
150
  }
1550
- // @ts-ignore
1551
- peg$result = peg$startRuleFunction();
1552
- // @ts-ignore
1553
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1554
- // @ts-ignore
1555
- return peg$result;
1556
- // @ts-ignore
151
+ }
152
+ match(str) {
153
+ if (this.input.startsWith(str, this.position)) {
154
+ this.position += str.length;
155
+ return true;
1557
156
  }
1558
- else {
1559
- // @ts-ignore
1560
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1561
- // @ts-ignore
1562
- peg$fail(peg$endExpectation());
1563
- }
1564
- // @ts-ignore
1565
- throw peg$buildStructuredError(
1566
- // @ts-ignore
1567
- peg$maxFailExpected,
1568
- // @ts-ignore
1569
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1570
- // @ts-ignore
1571
- peg$maxFailPos < input.length
1572
- // @ts-ignore
1573
- ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1574
- // @ts-ignore
1575
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
157
+ return false;
158
+ }
159
+ expect(str) {
160
+ if (!this.match(str)) {
161
+ throw new Error(`Expected "${str}"`);
1576
162
  }
1577
163
  }
1578
- // @ts-ignore
1579
- return {
1580
- SyntaxError: peg$SyntaxError,
1581
- parse: peg$parse
1582
- };
1583
- })();
1584
- peggyParser.SyntaxError.prototype.name = "PeggySyntaxError";
1585
- exports.parse = peggyParser.parse;
1586
- exports.PeggySyntaxError = peggyParser.SyntaxError;
164
+ }
165
+ function parseSignature(input) {
166
+ const parser = new SignatureParser(input);
167
+ return parser.parse();
168
+ }
1587
169
  //# sourceMappingURL=parser.js.map