@malloydata/malloy-filter 0.0.350 → 0.0.352

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