@malloydata/malloy-sql 0.0.62-dev230725172242 → 0.0.62-dev230725225657

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,1096 @@
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 = "--";
160
+ var peg$c6 = "/*";
161
+ var peg$c7 = "*/";
162
+ var peg$r0 = /^[ \t]/;
163
+ var peg$r1 = /^[\n\r]/;
164
+ var peg$e0 = peg$otherExpectation("query string");
165
+ var peg$e1 = peg$anyExpectation();
166
+ var peg$e2 = peg$literalExpectation("(", false);
167
+ var peg$e3 = peg$literalExpectation(")", false);
168
+ var peg$e4 = peg$literalExpectation("%{", false);
169
+ var peg$e5 = peg$literalExpectation("}%", false);
170
+ var peg$e6 = peg$otherExpectation("comment");
171
+ var peg$e7 = peg$literalExpectation("//", false);
172
+ var peg$e8 = peg$literalExpectation("--", false);
173
+ var peg$e9 = peg$literalExpectation("/*", false);
174
+ var peg$e10 = peg$literalExpectation("*/", false);
175
+ var peg$e11 = peg$classExpectation([" ", "\t"], false, false);
176
+ var peg$e12 = peg$otherExpectation("end of line");
177
+ var peg$e13 = peg$classExpectation(["\n", "\r"], false, false);
178
+ var peg$f0 = function (p) {
179
+ return {
180
+ parts: p,
181
+ range: location(),
182
+ statementText: p.map((s) => { return s.text; }).join('')
183
+ };
184
+ };
185
+ var peg$f1 = function (s) {
186
+ return {
187
+ type: "other",
188
+ text: s,
189
+ range: location()
190
+ };
191
+ };
192
+ var peg$f2 = function (em) {
193
+ return {
194
+ type: "malloy",
195
+ text: text(),
196
+ malloy: em.malloy,
197
+ malloyRange: em.malloyRange,
198
+ range: location(),
199
+ parenthized: true
200
+ };
201
+ };
202
+ var peg$f3 = function (m) {
203
+ return {
204
+ type: "malloy",
205
+ text: text(),
206
+ malloy: m.text,
207
+ malloyRange: m.malloyRange,
208
+ range: location(),
209
+ parenthized: false
210
+ };
211
+ };
212
+ var peg$f4 = function () {
213
+ return {
214
+ malloyRange: location(),
215
+ text: text()
216
+ };
217
+ };
218
+ var peg$f5 = function (c) {
219
+ return {
220
+ type: "comment",
221
+ text: c,
222
+ range: location()
223
+ };
224
+ };
225
+ var peg$currPos = 0;
226
+ var peg$savedPos = 0;
227
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
228
+ var peg$maxFailPos = 0;
229
+ var peg$maxFailExpected = [];
230
+ var peg$silentFails = 0;
231
+ var peg$result;
232
+ if ("startRule" in options) {
233
+ if (!(options.startRule in peg$startRuleFunctions)) {
234
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
235
+ }
236
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
237
+ }
238
+ function text() {
239
+ return input.substring(peg$savedPos, peg$currPos);
240
+ }
241
+ function offset() {
242
+ return peg$savedPos;
243
+ }
244
+ function range() {
245
+ return {
246
+ source: peg$source,
247
+ start: peg$savedPos,
248
+ end: peg$currPos
249
+ };
250
+ }
251
+ function location() {
252
+ return peg$computeLocation(peg$savedPos, peg$currPos);
253
+ }
254
+ function expected(description, location) {
255
+ location = location !== undefined
256
+ ? location
257
+ : peg$computeLocation(peg$savedPos, peg$currPos);
258
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
259
+ }
260
+ function error(message, location) {
261
+ location = location !== undefined
262
+ ? location
263
+ : peg$computeLocation(peg$savedPos, peg$currPos);
264
+ throw peg$buildSimpleError(message, location);
265
+ }
266
+ function peg$literalExpectation(text, ignoreCase) {
267
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
268
+ }
269
+ function peg$classExpectation(parts, inverted, ignoreCase) {
270
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
271
+ }
272
+ function peg$anyExpectation() {
273
+ return { type: "any" };
274
+ }
275
+ function peg$endExpectation() {
276
+ return { type: "end" };
277
+ }
278
+ function peg$otherExpectation(description) {
279
+ return { type: "other", description: description };
280
+ }
281
+ function peg$computePosDetails(pos) {
282
+ var details = peg$posDetailsCache[pos];
283
+ var p;
284
+ if (details) {
285
+ return details;
286
+ }
287
+ else {
288
+ p = pos - 1;
289
+ while (!peg$posDetailsCache[p]) {
290
+ p--;
291
+ }
292
+ details = peg$posDetailsCache[p];
293
+ details = {
294
+ line: details.line,
295
+ column: details.column
296
+ };
297
+ while (p < pos) {
298
+ if (input.charCodeAt(p) === 10) {
299
+ details.line++;
300
+ details.column = 1;
301
+ }
302
+ else {
303
+ details.column++;
304
+ }
305
+ p++;
306
+ }
307
+ peg$posDetailsCache[pos] = details;
308
+ return details;
309
+ }
310
+ }
311
+ function peg$computeLocation(startPos, endPos, offset) {
312
+ var startPosDetails = peg$computePosDetails(startPos);
313
+ var endPosDetails = peg$computePosDetails(endPos);
314
+ var res = {
315
+ source: peg$source,
316
+ start: {
317
+ offset: startPos,
318
+ line: startPosDetails.line,
319
+ column: startPosDetails.column
320
+ },
321
+ end: {
322
+ offset: endPos,
323
+ line: endPosDetails.line,
324
+ column: endPosDetails.column
325
+ }
326
+ };
327
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
328
+ res.start = peg$source.offset(res.start);
329
+ res.end = peg$source.offset(res.end);
330
+ }
331
+ return res;
332
+ }
333
+ function peg$fail(expected) {
334
+ if (peg$currPos < peg$maxFailPos) {
335
+ return;
336
+ }
337
+ if (peg$currPos > peg$maxFailPos) {
338
+ peg$maxFailPos = peg$currPos;
339
+ peg$maxFailExpected = [];
340
+ }
341
+ peg$maxFailExpected.push(expected);
342
+ }
343
+ function peg$buildSimpleError(message, location) {
344
+ return new peg$SyntaxError(message, null, null, location);
345
+ }
346
+ function peg$buildStructuredError(expected, found, location) {
347
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
348
+ }
349
+ function peg$parsestart() {
350
+ var s0;
351
+ s0 = peg$parsestatement();
352
+ return s0;
353
+ }
354
+ function peg$parsestatement() {
355
+ var s0, s1, s2;
356
+ s0 = peg$currPos;
357
+ s1 = [];
358
+ s2 = peg$parsecomment();
359
+ if (s2 === peg$FAILED) {
360
+ s2 = peg$parseembedded_malloy();
361
+ if (s2 === peg$FAILED) {
362
+ s2 = peg$parseother();
363
+ }
364
+ }
365
+ while (s2 !== peg$FAILED) {
366
+ s1.push(s2);
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
+ }
375
+ peg$savedPos = s0;
376
+ s1 = peg$f0(s1);
377
+ s0 = s1;
378
+ return s0;
379
+ }
380
+ function peg$parseother() {
381
+ var s0, s1, s2, s3, s4, s5, s6;
382
+ peg$silentFails++;
383
+ s0 = peg$currPos;
384
+ s1 = peg$currPos;
385
+ s2 = [];
386
+ s3 = peg$currPos;
387
+ s4 = peg$currPos;
388
+ peg$silentFails++;
389
+ s5 = peg$parsecomment();
390
+ peg$silentFails--;
391
+ if (s5 === peg$FAILED) {
392
+ s4 = undefined;
393
+ }
394
+ else {
395
+ peg$currPos = s4;
396
+ s4 = peg$FAILED;
397
+ }
398
+ if (s4 !== peg$FAILED) {
399
+ s5 = peg$currPos;
400
+ peg$silentFails++;
401
+ s6 = peg$parseembedded_malloy();
402
+ peg$silentFails--;
403
+ if (s6 === peg$FAILED) {
404
+ s5 = undefined;
405
+ }
406
+ else {
407
+ peg$currPos = s5;
408
+ s5 = peg$FAILED;
409
+ }
410
+ if (s5 !== peg$FAILED) {
411
+ if (input.length > peg$currPos) {
412
+ s6 = input.charAt(peg$currPos);
413
+ peg$currPos++;
414
+ }
415
+ else {
416
+ s6 = peg$FAILED;
417
+ if (peg$silentFails === 0) {
418
+ peg$fail(peg$e1);
419
+ }
420
+ }
421
+ if (s6 !== peg$FAILED) {
422
+ s4 = [s4, s5, s6];
423
+ s3 = s4;
424
+ }
425
+ else {
426
+ peg$currPos = s3;
427
+ s3 = peg$FAILED;
428
+ }
429
+ }
430
+ else {
431
+ peg$currPos = s3;
432
+ s3 = peg$FAILED;
433
+ }
434
+ }
435
+ else {
436
+ peg$currPos = s3;
437
+ s3 = peg$FAILED;
438
+ }
439
+ if (s3 !== peg$FAILED) {
440
+ while (s3 !== peg$FAILED) {
441
+ s2.push(s3);
442
+ s3 = peg$currPos;
443
+ s4 = peg$currPos;
444
+ peg$silentFails++;
445
+ s5 = peg$parsecomment();
446
+ peg$silentFails--;
447
+ if (s5 === peg$FAILED) {
448
+ s4 = undefined;
449
+ }
450
+ else {
451
+ peg$currPos = s4;
452
+ s4 = peg$FAILED;
453
+ }
454
+ if (s4 !== peg$FAILED) {
455
+ s5 = peg$currPos;
456
+ peg$silentFails++;
457
+ s6 = peg$parseembedded_malloy();
458
+ peg$silentFails--;
459
+ if (s6 === peg$FAILED) {
460
+ s5 = undefined;
461
+ }
462
+ else {
463
+ peg$currPos = s5;
464
+ s5 = peg$FAILED;
465
+ }
466
+ if (s5 !== peg$FAILED) {
467
+ if (input.length > peg$currPos) {
468
+ s6 = input.charAt(peg$currPos);
469
+ peg$currPos++;
470
+ }
471
+ else {
472
+ s6 = peg$FAILED;
473
+ if (peg$silentFails === 0) {
474
+ peg$fail(peg$e1);
475
+ }
476
+ }
477
+ if (s6 !== peg$FAILED) {
478
+ s4 = [s4, s5, s6];
479
+ s3 = s4;
480
+ }
481
+ else {
482
+ peg$currPos = s3;
483
+ s3 = peg$FAILED;
484
+ }
485
+ }
486
+ else {
487
+ peg$currPos = s3;
488
+ s3 = peg$FAILED;
489
+ }
490
+ }
491
+ else {
492
+ peg$currPos = s3;
493
+ s3 = peg$FAILED;
494
+ }
495
+ }
496
+ }
497
+ else {
498
+ s2 = peg$FAILED;
499
+ }
500
+ if (s2 !== peg$FAILED) {
501
+ s1 = input.substring(s1, peg$currPos);
502
+ }
503
+ else {
504
+ s1 = s2;
505
+ }
506
+ if (s1 !== peg$FAILED) {
507
+ peg$savedPos = s0;
508
+ s1 = peg$f1(s1);
509
+ }
510
+ s0 = s1;
511
+ peg$silentFails--;
512
+ if (s0 === peg$FAILED) {
513
+ s1 = peg$FAILED;
514
+ if (peg$silentFails === 0) {
515
+ peg$fail(peg$e0);
516
+ }
517
+ }
518
+ return s0;
519
+ }
520
+ function peg$parseembedded_malloy() {
521
+ var s0;
522
+ s0 = peg$parseparenthized_embedded_malloy();
523
+ if (s0 === peg$FAILED) {
524
+ s0 = peg$parseplain_embedded_malloy();
525
+ }
526
+ return s0;
527
+ }
528
+ function peg$parseparenthized_embedded_malloy() {
529
+ var s0, s1, s2, s3, s4, s5;
530
+ s0 = peg$currPos;
531
+ if (input.charCodeAt(peg$currPos) === 40) {
532
+ s1 = peg$c0;
533
+ peg$currPos++;
534
+ }
535
+ else {
536
+ s1 = peg$FAILED;
537
+ if (peg$silentFails === 0) {
538
+ peg$fail(peg$e2);
539
+ }
540
+ }
541
+ if (s1 !== peg$FAILED) {
542
+ s2 = peg$parse__();
543
+ s3 = peg$parseplain_embedded_malloy();
544
+ if (s3 !== peg$FAILED) {
545
+ s4 = peg$parse__();
546
+ if (input.charCodeAt(peg$currPos) === 41) {
547
+ s5 = peg$c1;
548
+ peg$currPos++;
549
+ }
550
+ else {
551
+ s5 = peg$FAILED;
552
+ if (peg$silentFails === 0) {
553
+ peg$fail(peg$e3);
554
+ }
555
+ }
556
+ if (s5 !== peg$FAILED) {
557
+ peg$savedPos = s0;
558
+ s0 = peg$f2(s3);
559
+ }
560
+ else {
561
+ peg$currPos = s0;
562
+ s0 = peg$FAILED;
563
+ }
564
+ }
565
+ else {
566
+ peg$currPos = s0;
567
+ s0 = peg$FAILED;
568
+ }
569
+ }
570
+ else {
571
+ peg$currPos = s0;
572
+ s0 = peg$FAILED;
573
+ }
574
+ return s0;
575
+ }
576
+ function peg$parseplain_embedded_malloy() {
577
+ var s0, s1, s2, s3;
578
+ s0 = peg$currPos;
579
+ if (input.substr(peg$currPos, 2) === peg$c2) {
580
+ s1 = peg$c2;
581
+ peg$currPos += 2;
582
+ }
583
+ else {
584
+ s1 = peg$FAILED;
585
+ if (peg$silentFails === 0) {
586
+ peg$fail(peg$e4);
587
+ }
588
+ }
589
+ if (s1 !== peg$FAILED) {
590
+ s2 = peg$parsemalloy();
591
+ if (input.substr(peg$currPos, 2) === peg$c3) {
592
+ s3 = peg$c3;
593
+ peg$currPos += 2;
594
+ }
595
+ else {
596
+ s3 = peg$FAILED;
597
+ if (peg$silentFails === 0) {
598
+ peg$fail(peg$e5);
599
+ }
600
+ }
601
+ if (s3 !== peg$FAILED) {
602
+ peg$savedPos = s0;
603
+ s0 = peg$f3(s2);
604
+ }
605
+ else {
606
+ peg$currPos = s0;
607
+ s0 = peg$FAILED;
608
+ }
609
+ }
610
+ else {
611
+ peg$currPos = s0;
612
+ s0 = peg$FAILED;
613
+ }
614
+ return s0;
615
+ }
616
+ function peg$parsemalloy() {
617
+ var s0, s1, s2, s3, s4;
618
+ s0 = peg$currPos;
619
+ s1 = [];
620
+ s2 = peg$currPos;
621
+ s3 = peg$currPos;
622
+ peg$silentFails++;
623
+ if (input.substr(peg$currPos, 2) === peg$c3) {
624
+ s4 = peg$c3;
625
+ peg$currPos += 2;
626
+ }
627
+ else {
628
+ s4 = peg$FAILED;
629
+ if (peg$silentFails === 0) {
630
+ peg$fail(peg$e5);
631
+ }
632
+ }
633
+ peg$silentFails--;
634
+ if (s4 === peg$FAILED) {
635
+ s3 = undefined;
636
+ }
637
+ else {
638
+ peg$currPos = s3;
639
+ s3 = peg$FAILED;
640
+ }
641
+ if (s3 !== peg$FAILED) {
642
+ if (input.length > peg$currPos) {
643
+ s4 = input.charAt(peg$currPos);
644
+ peg$currPos++;
645
+ }
646
+ else {
647
+ s4 = peg$FAILED;
648
+ if (peg$silentFails === 0) {
649
+ peg$fail(peg$e1);
650
+ }
651
+ }
652
+ if (s4 !== peg$FAILED) {
653
+ s3 = [s3, s4];
654
+ s2 = s3;
655
+ }
656
+ else {
657
+ peg$currPos = s2;
658
+ s2 = peg$FAILED;
659
+ }
660
+ }
661
+ else {
662
+ peg$currPos = s2;
663
+ s2 = peg$FAILED;
664
+ }
665
+ while (s2 !== peg$FAILED) {
666
+ s1.push(s2);
667
+ s2 = peg$currPos;
668
+ s3 = peg$currPos;
669
+ peg$silentFails++;
670
+ if (input.substr(peg$currPos, 2) === peg$c3) {
671
+ s4 = peg$c3;
672
+ peg$currPos += 2;
673
+ }
674
+ else {
675
+ s4 = peg$FAILED;
676
+ if (peg$silentFails === 0) {
677
+ peg$fail(peg$e5);
678
+ }
679
+ }
680
+ peg$silentFails--;
681
+ if (s4 === peg$FAILED) {
682
+ s3 = undefined;
683
+ }
684
+ else {
685
+ peg$currPos = s3;
686
+ s3 = peg$FAILED;
687
+ }
688
+ if (s3 !== peg$FAILED) {
689
+ if (input.length > peg$currPos) {
690
+ s4 = input.charAt(peg$currPos);
691
+ peg$currPos++;
692
+ }
693
+ else {
694
+ s4 = peg$FAILED;
695
+ if (peg$silentFails === 0) {
696
+ peg$fail(peg$e1);
697
+ }
698
+ }
699
+ if (s4 !== peg$FAILED) {
700
+ s3 = [s3, s4];
701
+ s2 = s3;
702
+ }
703
+ else {
704
+ peg$currPos = s2;
705
+ s2 = peg$FAILED;
706
+ }
707
+ }
708
+ else {
709
+ peg$currPos = s2;
710
+ s2 = peg$FAILED;
711
+ }
712
+ }
713
+ peg$savedPos = s0;
714
+ s1 = peg$f4();
715
+ s0 = s1;
716
+ return s0;
717
+ }
718
+ function peg$parsecomment() {
719
+ var s0, s1;
720
+ peg$silentFails++;
721
+ s0 = peg$currPos;
722
+ s1 = peg$parsesingle_comment();
723
+ if (s1 === peg$FAILED) {
724
+ s1 = peg$parsemulti_comment();
725
+ }
726
+ if (s1 !== peg$FAILED) {
727
+ peg$savedPos = s0;
728
+ s1 = peg$f5(s1);
729
+ }
730
+ s0 = s1;
731
+ peg$silentFails--;
732
+ if (s0 === peg$FAILED) {
733
+ s1 = peg$FAILED;
734
+ if (peg$silentFails === 0) {
735
+ peg$fail(peg$e6);
736
+ }
737
+ }
738
+ return s0;
739
+ }
740
+ function peg$parsesingle_comment() {
741
+ var s0, s1, s2, s3, s4, s5, s6;
742
+ s0 = peg$currPos;
743
+ s1 = peg$currPos;
744
+ if (input.substr(peg$currPos, 2) === peg$c4) {
745
+ s2 = peg$c4;
746
+ peg$currPos += 2;
747
+ }
748
+ else {
749
+ s2 = peg$FAILED;
750
+ if (peg$silentFails === 0) {
751
+ peg$fail(peg$e7);
752
+ }
753
+ }
754
+ if (s2 === peg$FAILED) {
755
+ if (input.substr(peg$currPos, 2) === peg$c5) {
756
+ s2 = peg$c5;
757
+ peg$currPos += 2;
758
+ }
759
+ else {
760
+ s2 = peg$FAILED;
761
+ if (peg$silentFails === 0) {
762
+ peg$fail(peg$e8);
763
+ }
764
+ }
765
+ }
766
+ if (s2 !== peg$FAILED) {
767
+ s3 = [];
768
+ s4 = peg$currPos;
769
+ s5 = peg$currPos;
770
+ peg$silentFails++;
771
+ s6 = peg$parseEOL();
772
+ peg$silentFails--;
773
+ if (s6 === peg$FAILED) {
774
+ s5 = undefined;
775
+ }
776
+ else {
777
+ peg$currPos = s5;
778
+ s5 = peg$FAILED;
779
+ }
780
+ if (s5 !== peg$FAILED) {
781
+ if (input.length > peg$currPos) {
782
+ s6 = input.charAt(peg$currPos);
783
+ peg$currPos++;
784
+ }
785
+ else {
786
+ s6 = peg$FAILED;
787
+ if (peg$silentFails === 0) {
788
+ peg$fail(peg$e1);
789
+ }
790
+ }
791
+ if (s6 !== peg$FAILED) {
792
+ s5 = [s5, s6];
793
+ s4 = s5;
794
+ }
795
+ else {
796
+ peg$currPos = s4;
797
+ s4 = peg$FAILED;
798
+ }
799
+ }
800
+ else {
801
+ peg$currPos = s4;
802
+ s4 = peg$FAILED;
803
+ }
804
+ while (s4 !== peg$FAILED) {
805
+ s3.push(s4);
806
+ s4 = peg$currPos;
807
+ s5 = peg$currPos;
808
+ peg$silentFails++;
809
+ s6 = peg$parseEOL();
810
+ peg$silentFails--;
811
+ if (s6 === peg$FAILED) {
812
+ s5 = undefined;
813
+ }
814
+ else {
815
+ peg$currPos = s5;
816
+ s5 = peg$FAILED;
817
+ }
818
+ if (s5 !== peg$FAILED) {
819
+ if (input.length > peg$currPos) {
820
+ s6 = input.charAt(peg$currPos);
821
+ peg$currPos++;
822
+ }
823
+ else {
824
+ s6 = peg$FAILED;
825
+ if (peg$silentFails === 0) {
826
+ peg$fail(peg$e1);
827
+ }
828
+ }
829
+ if (s6 !== peg$FAILED) {
830
+ s5 = [s5, s6];
831
+ s4 = s5;
832
+ }
833
+ else {
834
+ peg$currPos = s4;
835
+ s4 = peg$FAILED;
836
+ }
837
+ }
838
+ else {
839
+ peg$currPos = s4;
840
+ s4 = peg$FAILED;
841
+ }
842
+ }
843
+ s4 = peg$parse__();
844
+ s5 = peg$parseEOL();
845
+ if (s5 === peg$FAILED) {
846
+ s5 = peg$parseEOF();
847
+ }
848
+ if (s5 !== peg$FAILED) {
849
+ s2 = [s2, s3, s4, s5];
850
+ s1 = s2;
851
+ }
852
+ else {
853
+ peg$currPos = s1;
854
+ s1 = peg$FAILED;
855
+ }
856
+ }
857
+ else {
858
+ peg$currPos = s1;
859
+ s1 = peg$FAILED;
860
+ }
861
+ if (s1 !== peg$FAILED) {
862
+ s0 = input.substring(s0, peg$currPos);
863
+ }
864
+ else {
865
+ s0 = s1;
866
+ }
867
+ return s0;
868
+ }
869
+ function peg$parsemulti_comment() {
870
+ var s0, s1, s2, s3, s4, s5, s6;
871
+ s0 = peg$currPos;
872
+ s1 = peg$currPos;
873
+ if (input.substr(peg$currPos, 2) === peg$c6) {
874
+ s2 = peg$c6;
875
+ peg$currPos += 2;
876
+ }
877
+ else {
878
+ s2 = peg$FAILED;
879
+ if (peg$silentFails === 0) {
880
+ peg$fail(peg$e9);
881
+ }
882
+ }
883
+ if (s2 !== peg$FAILED) {
884
+ s3 = [];
885
+ s4 = peg$currPos;
886
+ s5 = peg$currPos;
887
+ peg$silentFails++;
888
+ if (input.substr(peg$currPos, 2) === peg$c7) {
889
+ s6 = peg$c7;
890
+ peg$currPos += 2;
891
+ }
892
+ else {
893
+ s6 = peg$FAILED;
894
+ if (peg$silentFails === 0) {
895
+ peg$fail(peg$e10);
896
+ }
897
+ }
898
+ peg$silentFails--;
899
+ if (s6 === peg$FAILED) {
900
+ s5 = undefined;
901
+ }
902
+ else {
903
+ peg$currPos = s5;
904
+ s5 = peg$FAILED;
905
+ }
906
+ if (s5 !== peg$FAILED) {
907
+ if (input.length > peg$currPos) {
908
+ s6 = input.charAt(peg$currPos);
909
+ peg$currPos++;
910
+ }
911
+ else {
912
+ s6 = peg$FAILED;
913
+ if (peg$silentFails === 0) {
914
+ peg$fail(peg$e1);
915
+ }
916
+ }
917
+ if (s6 !== peg$FAILED) {
918
+ s5 = [s5, s6];
919
+ s4 = s5;
920
+ }
921
+ else {
922
+ peg$currPos = s4;
923
+ s4 = peg$FAILED;
924
+ }
925
+ }
926
+ else {
927
+ peg$currPos = s4;
928
+ s4 = peg$FAILED;
929
+ }
930
+ while (s4 !== peg$FAILED) {
931
+ s3.push(s4);
932
+ s4 = peg$currPos;
933
+ s5 = peg$currPos;
934
+ peg$silentFails++;
935
+ if (input.substr(peg$currPos, 2) === peg$c7) {
936
+ s6 = peg$c7;
937
+ peg$currPos += 2;
938
+ }
939
+ else {
940
+ s6 = peg$FAILED;
941
+ if (peg$silentFails === 0) {
942
+ peg$fail(peg$e10);
943
+ }
944
+ }
945
+ peg$silentFails--;
946
+ if (s6 === peg$FAILED) {
947
+ s5 = undefined;
948
+ }
949
+ else {
950
+ peg$currPos = s5;
951
+ s5 = peg$FAILED;
952
+ }
953
+ if (s5 !== peg$FAILED) {
954
+ if (input.length > peg$currPos) {
955
+ s6 = input.charAt(peg$currPos);
956
+ peg$currPos++;
957
+ }
958
+ else {
959
+ s6 = peg$FAILED;
960
+ if (peg$silentFails === 0) {
961
+ peg$fail(peg$e1);
962
+ }
963
+ }
964
+ if (s6 !== peg$FAILED) {
965
+ s5 = [s5, s6];
966
+ s4 = s5;
967
+ }
968
+ else {
969
+ peg$currPos = s4;
970
+ s4 = peg$FAILED;
971
+ }
972
+ }
973
+ else {
974
+ peg$currPos = s4;
975
+ s4 = peg$FAILED;
976
+ }
977
+ }
978
+ if (input.substr(peg$currPos, 2) === peg$c7) {
979
+ s4 = peg$c7;
980
+ peg$currPos += 2;
981
+ }
982
+ else {
983
+ s4 = peg$FAILED;
984
+ if (peg$silentFails === 0) {
985
+ peg$fail(peg$e10);
986
+ }
987
+ }
988
+ if (s4 !== peg$FAILED) {
989
+ s2 = [s2, s3, s4];
990
+ s1 = s2;
991
+ }
992
+ else {
993
+ peg$currPos = s1;
994
+ s1 = peg$FAILED;
995
+ }
996
+ }
997
+ else {
998
+ peg$currPos = s1;
999
+ s1 = peg$FAILED;
1000
+ }
1001
+ if (s1 !== peg$FAILED) {
1002
+ s0 = input.substring(s0, peg$currPos);
1003
+ }
1004
+ else {
1005
+ s0 = s1;
1006
+ }
1007
+ return s0;
1008
+ }
1009
+ function peg$parse__() {
1010
+ var s0, s1;
1011
+ s0 = [];
1012
+ s1 = peg$parse_();
1013
+ while (s1 !== peg$FAILED) {
1014
+ s0.push(s1);
1015
+ s1 = peg$parse_();
1016
+ }
1017
+ return s0;
1018
+ }
1019
+ function peg$parse_() {
1020
+ var s0;
1021
+ if (peg$r0.test(input.charAt(peg$currPos))) {
1022
+ s0 = input.charAt(peg$currPos);
1023
+ peg$currPos++;
1024
+ }
1025
+ else {
1026
+ s0 = peg$FAILED;
1027
+ if (peg$silentFails === 0) {
1028
+ peg$fail(peg$e11);
1029
+ }
1030
+ }
1031
+ return s0;
1032
+ }
1033
+ function peg$parseEOL() {
1034
+ var s0, s1;
1035
+ peg$silentFails++;
1036
+ if (peg$r1.test(input.charAt(peg$currPos))) {
1037
+ s0 = input.charAt(peg$currPos);
1038
+ peg$currPos++;
1039
+ }
1040
+ else {
1041
+ s0 = peg$FAILED;
1042
+ if (peg$silentFails === 0) {
1043
+ peg$fail(peg$e13);
1044
+ }
1045
+ }
1046
+ peg$silentFails--;
1047
+ if (s0 === peg$FAILED) {
1048
+ s1 = peg$FAILED;
1049
+ if (peg$silentFails === 0) {
1050
+ peg$fail(peg$e12);
1051
+ }
1052
+ }
1053
+ return s0;
1054
+ }
1055
+ function peg$parseEOF() {
1056
+ var s0, s1;
1057
+ s0 = peg$currPos;
1058
+ peg$silentFails++;
1059
+ if (input.length > peg$currPos) {
1060
+ s1 = input.charAt(peg$currPos);
1061
+ peg$currPos++;
1062
+ }
1063
+ else {
1064
+ s1 = peg$FAILED;
1065
+ if (peg$silentFails === 0) {
1066
+ peg$fail(peg$e1);
1067
+ }
1068
+ }
1069
+ peg$silentFails--;
1070
+ if (s1 === peg$FAILED) {
1071
+ s0 = undefined;
1072
+ }
1073
+ else {
1074
+ peg$currPos = s0;
1075
+ s0 = peg$FAILED;
1076
+ }
1077
+ return s0;
1078
+ }
1079
+ peg$result = peg$startRuleFunction();
1080
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1081
+ return peg$result;
1082
+ }
1083
+ else {
1084
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1085
+ peg$fail(peg$endExpectation());
1086
+ }
1087
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
1088
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1089
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
1090
+ }
1091
+ }
1092
+ module.exports = {
1093
+ SyntaxError: peg$SyntaxError,
1094
+ parse: peg$parse
1095
+ };
1096
+ //# sourceMappingURL=malloySQLSQL.js.map