@malloydata/malloy-sql 0.0.37-dev230525220001

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