@spectric/ui 0.0.21 → 0.0.22

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 (45) hide show
  1. package/dist/components/dialog/dialog.d.ts +1 -0
  2. package/dist/components/pagination/pagination.d.ts +1 -1
  3. package/dist/components/query_bar/QueryBar.d.ts +30 -10
  4. package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
  5. package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
  6. package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
  7. package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
  8. package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
  9. package/dist/components/symbols.d.ts +6 -0
  10. package/dist/components/table/cell.d.ts +1 -1
  11. package/dist/components/table/table.d.ts +5 -1
  12. package/dist/custom-elements.json +5 -5
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.es.js +4382 -2795
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +349 -248
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/style.css +1 -1
  19. package/package.json +6 -1
  20. package/src/components/dialog/dialog.css.ts +29 -29
  21. package/src/components/dialog/dialog.ts +3 -1
  22. package/src/components/input.ts +49 -39
  23. package/src/components/pagination/pagination.ts +167 -113
  24. package/src/components/query_bar/QueryBar.ts +438 -187
  25. package/src/components/query_bar/dateTimePopup.ts +54 -0
  26. package/src/components/query_bar/geojsonPopup.ts +44 -0
  27. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  28. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  29. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  30. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  31. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  32. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  33. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  34. package/src/components/symbols.ts +6 -0
  35. package/src/components/table/__tests__/table.spec.ts +2 -2
  36. package/src/components/table/cell.ts +7 -3
  37. package/src/components/table/header.ts +3 -2
  38. package/src/components/table/table.css +4 -2
  39. package/src/components/table/table.ts +61 -5
  40. package/src/components/table/virtualBody.ts +8 -3
  41. package/src/components/tooltip/popover.ts +263 -225
  42. package/src/stories/Dialog.stories.ts +59 -0
  43. package/src/stories/QueryBar.stories.ts +46 -37
  44. package/src/stories/fixtures/data.ts +195 -36
  45. package/src/stories/table.stories.ts +70 -22
@@ -1,559 +1,707 @@
1
1
  /*
2
- * SPDX-License-Identifier: Apache-2.0
3
- *
4
- * The OpenSearch Contributors require contributions made to
5
- * this file be licensed under the Apache-2.0 license or a
6
- * compatible open source license.
7
- *
8
- * Any modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
- */
2
+ Spectric Labs */
11
3
 
12
4
  export const {
13
- SyntaxError,
14
5
  parse
15
- } = (function () {
6
+ } = // @generated by Peggy 5.0.6.
7
+ //
8
+ // https://peggyjs.org/
9
+ (function() {
16
10
  "use strict";
17
-
18
- /*
19
- * Generated by PEG.js 0.9.0.
20
- *
21
- * http://pegjs.org/
22
- */
23
-
24
- function peg$subclass(child, parent) {
25
- function ctor() { this.constructor = child; }
26
- ctor.prototype = parent.prototype;
27
- child.prototype = new ctor();
28
- }
29
-
30
- function peg$SyntaxError(message, expected, found, location) {
31
- this.message = message;
11
+ class peg$SyntaxError extends SyntaxError {
12
+ constructor(message, expected, found, location) {
13
+ super(message);
32
14
  this.expected = expected;
33
15
  this.found = found;
34
16
  this.location = location;
35
17
  this.name = "SyntaxError";
18
+ }
36
19
 
37
- if (typeof Error.captureStackTrace === "function") {
38
- Error.captureStackTrace(this, peg$SyntaxError);
20
+ format(sources) {
21
+ let str = "Error: " + this.message;
22
+ if (this.location) {
23
+ let src = null;
24
+ const st = sources.find(s => s.source === this.location.source);
25
+ if (st) {
26
+ src = st.text.split(/\r\n|\n|\r/g);
27
+ }
28
+ const s = this.location.start;
29
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
30
+ ? this.location.source.offset(s)
31
+ : s;
32
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
33
+ if (src) {
34
+ const e = this.location.end;
35
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
36
+ const line = src[s.line - 1];
37
+ const last = s.line === e.line ? e.column : line.length + 1;
38
+ const hatLen = (last - s.column) || 1;
39
+ str += "\n --> " + loc + "\n"
40
+ + filler + " |\n"
41
+ + offset_s.line + " | " + line + "\n"
42
+ + filler + " | " + "".padEnd(s.column - 1, " ")
43
+ + "".padEnd(hatLen, "^");
44
+ } else {
45
+ str += "\n at " + loc;
46
+ }
39
47
  }
48
+ return str;
40
49
  }
41
50
 
42
- peg$subclass(peg$SyntaxError, Error);
43
-
44
- function peg$parse(input) {
45
- var options = arguments.length > 1 ? arguments[1] : {},
46
- parser = this,
47
-
48
- peg$FAILED = {},
51
+ static buildMessage(expected, found) {
52
+ function hex(ch) {
53
+ return ch.codePointAt(0).toString(16).toUpperCase();
54
+ }
55
+
56
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
57
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
58
+ : null;
59
+ function unicodeEscape(s) {
60
+ if (nonPrintable) {
61
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
62
+ }
63
+ return s;
64
+ }
65
+
66
+ function literalEscape(s) {
67
+ return unicodeEscape(s
68
+ .replace(/\\/g, "\\\\")
69
+ .replace(/"/g, "\\\"")
70
+ .replace(/\0/g, "\\0")
71
+ .replace(/\t/g, "\\t")
72
+ .replace(/\n/g, "\\n")
73
+ .replace(/\r/g, "\\r")
74
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
75
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
76
+ }
77
+
78
+ function classEscape(s) {
79
+ return unicodeEscape(s
80
+ .replace(/\\/g, "\\\\")
81
+ .replace(/\]/g, "\\]")
82
+ .replace(/\^/g, "\\^")
83
+ .replace(/-/g, "\\-")
84
+ .replace(/\0/g, "\\0")
85
+ .replace(/\t/g, "\\t")
86
+ .replace(/\n/g, "\\n")
87
+ .replace(/\r/g, "\\r")
88
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
89
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
90
+ }
91
+
92
+ const DESCRIBE_EXPECTATION_FNS = {
93
+ literal(expectation) {
94
+ return "\"" + literalEscape(expectation.text) + "\"";
95
+ },
49
96
 
50
- peg$startRuleFunctions = { start: peg$parsestart, Literal: peg$parseLiteral },
51
- peg$startRuleFunction = peg$parsestart,
97
+ class(expectation) {
98
+ const escapedParts = expectation.parts.map(
99
+ part => (Array.isArray(part)
100
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
101
+ : classEscape(part))
102
+ );
52
103
 
53
- peg$c0 = function (query, trailing) {
54
- if (trailing.type === 'cursor') {
55
- return {
56
- ...trailing,
57
- suggestionTypes: ['conjunction']
58
- };
59
- }
60
- if (query !== null) return query;
61
- return nodeTypes.function.buildNode('is', '*', '*');
62
- },
63
- peg$c1 = function () { return errorOnLuceneSyntax; },
64
- peg$c2 = function (left, right) {
65
- const cursor = [left, right].find(node => node.type === 'cursor');
66
- if (cursor) return cursor;
67
- return buildFunctionNode('or', [left, right]);
68
- },
69
- peg$c3 = function (left, right) {
70
- const cursor = [left, right].find(node => node.type === 'cursor');
71
- if (cursor) return cursor;
72
- return buildFunctionNode('and', [left, right]);
73
- },
74
- peg$c4 = function (query) {
75
- if (query.type === 'cursor') return query;
76
- return buildFunctionNode('not', [query]);
77
- },
78
- peg$c5 = "(",
79
- peg$c6 = { type: "literal", value: "(", description: "\"(\"" },
80
- peg$c7 = ")",
81
- peg$c8 = { type: "literal", value: ")", description: "\")\"" },
82
- peg$c9 = function (query, trailing) {
83
- if (trailing.type === 'cursor') {
84
- return {
85
- ...trailing,
86
- suggestionTypes: ['conjunction']
87
- };
88
- }
89
- return query;
104
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
90
105
  },
91
- peg$c10 = ":",
92
- peg$c11 = { type: "literal", value: ":", description: "\":\"" },
93
- peg$c12 = "{",
94
- peg$c13 = { type: "literal", value: "{", description: "\"{\"" },
95
- peg$c14 = "}",
96
- peg$c15 = { type: "literal", value: "}", description: "\"}\"" },
97
- peg$c16 = function (field, query, trailing) {
98
- if (query.type === 'cursor') {
99
- return {
100
- ...query,
101
- nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value,
102
- }
103
- };
104
106
 
105
- if (trailing.type === 'cursor') {
106
- return {
107
- ...trailing,
108
- suggestionTypes: ['conjunction']
109
- };
110
- }
111
- return buildFunctionNode('nested', [field, query]);
112
- },
113
- peg$c17 = { type: "other", description: "fieldName" },
114
- peg$c18 = function (field, operator, value) {
115
- if (value.type === 'cursor') {
116
- return {
117
- ...value,
118
- suggestionTypes: ['conjunction']
119
- };
120
- }
121
- const range = buildNamedArgNode(operator, value);
122
- return buildFunctionNode('range', [field, range]);
123
- },
124
- peg$c19 = function (field, partial) {
125
- if (partial.type === 'cursor') {
126
- return {
127
- ...partial,
128
- fieldName: field.value,
129
- suggestionTypes: ['value', 'conjunction']
130
- };
131
- }
132
- return partial(field);
133
- },
134
- peg$c20 = function (partial) {
135
- if (partial.type === 'cursor') {
136
- const fieldName = `${partial.prefix}${partial.suffix}`.trim();
137
- return {
138
- ...partial,
139
- fieldName,
140
- suggestionTypes: ['field', 'operator', 'conjunction']
141
- };
142
- }
143
- const field = buildLiteralNode(null);
144
- return partial(field);
145
- },
146
- peg$c21 = function (partial, trailing) {
147
- if (trailing.type === 'cursor') {
148
- return {
149
- ...trailing,
150
- suggestionTypes: ['conjunction']
151
- };
152
- }
153
- return partial;
154
- },
155
- peg$c22 = function (partialLeft, partialRight) {
156
- const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
157
- if (cursor) {
158
- return {
159
- ...cursor,
160
- suggestionTypes: ['value']
161
- };
162
- }
163
- return (field) => buildFunctionNode('or', [partialLeft(field), partialRight(field)]);
164
- },
165
- peg$c23 = function (partialLeft, partialRight) {
166
- const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
167
- if (cursor) {
168
- return {
169
- ...cursor,
170
- suggestionTypes: ['value']
171
- };
172
- }
173
- return (field) => buildFunctionNode('and', [partialLeft(field), partialRight(field)]);
174
- },
175
- peg$c24 = function (partial) {
176
- if (partial.type === 'cursor') {
177
- return {
178
- ...list,
179
- suggestionTypes: ['value']
180
- };
181
- }
182
- return (field) => buildFunctionNode('not', [partial(field)]);
183
- },
184
- peg$c25 = { type: "other", description: "value" },
185
- peg$c26 = function (value) {
186
- if (value.type === 'cursor') return value;
187
- const isPhrase = buildLiteralNode(true);
188
- return (field) => buildFunctionNode('is', [field, value, isPhrase]);
107
+ any() {
108
+ return "any character";
189
109
  },
190
- peg$c27 = function (value) {
191
- if (value.type === 'cursor') return value;
192
-
193
- if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) {
194
- error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.');
195
- }
196
110
 
197
- const isPhrase = buildLiteralNode(false);
198
- return (field) => buildFunctionNode('is', [field, value, isPhrase]);
199
- },
200
- peg$c28 = { type: "other", description: "OR" },
201
- peg$c29 = "or",
202
- peg$c30 = { type: "literal", value: "or", description: "\"or\"" },
203
- peg$c31 = { type: "other", description: "AND" },
204
- peg$c32 = "and",
205
- peg$c33 = { type: "literal", value: "and", description: "\"and\"" },
206
- peg$c34 = { type: "other", description: "NOT" },
207
- peg$c35 = "not",
208
- peg$c36 = { type: "literal", value: "not", description: "\"not\"" },
209
- peg$c37 = { type: "other", description: "literal" },
210
- peg$c38 = "\"",
211
- peg$c39 = { type: "literal", value: "\"", description: "\"\\\"\"" },
212
- peg$c40 = function (prefix, cursor, suffix) {
213
- const { start, end } = location();
214
- return {
215
- type: 'cursor',
216
- start: start.offset,
217
- end: end.offset - cursor.length,
218
- prefix: prefix.join(''),
219
- suffix: suffix.join(''),
220
- text: text().replace(cursor, '')
221
- };
222
- },
223
- peg$c41 = function (chars) {
224
- return buildLiteralNode(chars.join(''));
225
- },
226
- peg$c42 = "\\",
227
- peg$c43 = { type: "literal", value: "\\", description: "\"\\\\\"" },
228
- peg$c44 = /^[\\"]/,
229
- peg$c45 = { type: "class", value: "[\\\\\"]", description: "[\\\\\"]" },
230
- peg$c46 = function (char) { return char; },
231
- peg$c47 = /^[^"]/,
232
- peg$c48 = { type: "class", value: "[^\"]", description: "[^\"]" },
233
- peg$c49 = function (chars) {
234
- const sequence = chars.join('').trim();
235
- if (sequence === 'null') return buildLiteralNode(null);
236
- if (sequence === 'true') return buildLiteralNode(true);
237
- if (sequence === 'false') return buildLiteralNode(false);
238
- if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence);
239
- const isNumberPattern = /^(-?[1-9]+\d*([.]\d+)?)$|^(-?0[.]\d*[1-9]+)$|^0$|^0.0$|^[.]\d{1,}$/;
240
- return buildLiteralNode(
241
- isNumberPattern.test(sequence)
242
- ? isFinite(sequence) && (sequence > Number.MAX_SAFE_INTEGER || sequence < Number.MIN_SAFE_INTEGER)
243
- ? BigInt(sequence)
244
- : Number(sequence)
245
- : sequence
246
- );
247
- },
248
- peg$c50 = { type: "any", description: "any character" },
249
- peg$c51 = "*",
250
- peg$c52 = { type: "literal", value: "*", description: "\"*\"" },
251
- peg$c53 = function () { return wildcardSymbol; },
252
- peg$c54 = "\\t",
253
- peg$c55 = { type: "literal", value: "\\t", description: "\"\\\\t\"" },
254
- peg$c56 = function () { return '\t'; },
255
- peg$c57 = "\\r",
256
- peg$c58 = { type: "literal", value: "\\r", description: "\"\\\\r\"" },
257
- peg$c59 = function () { return '\r'; },
258
- peg$c60 = "\\n",
259
- peg$c61 = { type: "literal", value: "\\n", description: "\"\\\\n\"" },
260
- peg$c62 = function () { return '\n'; },
261
- peg$c63 = function (keyword) { return keyword; },
262
- peg$c64 = /^[\\():<>"*{}]/,
263
- peg$c65 = { type: "class", value: "[\\\\():<>\"*{}]", description: "[\\\\():<>\"*{}]" },
264
- peg$c66 = "<=",
265
- peg$c67 = { type: "literal", value: "<=", description: "\"<=\"" },
266
- peg$c68 = function () { return 'lte'; },
267
- peg$c69 = ">=",
268
- peg$c70 = { type: "literal", value: ">=", description: "\">=\"" },
269
- peg$c71 = function () { return 'gte'; },
270
- peg$c72 = "<",
271
- peg$c73 = { type: "literal", value: "<", description: "\"<\"" },
272
- peg$c74 = function () { return 'lt'; },
273
- peg$c75 = ">",
274
- peg$c76 = { type: "literal", value: ">", description: "\">\"" },
275
- peg$c77 = function () { return 'gt'; },
276
- peg$c78 = { type: "other", description: "whitespace" },
277
- peg$c79 = /^[ \t\r\n]/,
278
- peg$c80 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" },
279
- peg$c81 = function () { return parseCursor; },
280
- peg$c82 = "@kuery-cursor@",
281
- peg$c83 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" },
282
- peg$c84 = function () { return cursorSymbol; },
283
- peg$c85 = "||",
284
- peg$c86 = { type: "literal", value: "||", description: "\"||\"" },
285
- peg$c87 = function () {
286
- error('LuceneOr');
287
- },
288
- peg$c88 = "&&",
289
- peg$c89 = { type: "literal", value: "&&", description: "\"&&\"" },
290
- peg$c90 = function () {
291
- error('LuceneAnd');
292
- },
293
- peg$c91 = "+",
294
- peg$c92 = { type: "literal", value: "+", description: "\"+\"" },
295
- peg$c93 = "-",
296
- peg$c94 = { type: "literal", value: "-", description: "\"-\"" },
297
- peg$c95 = function () {
298
- error('LuceneNot');
299
- },
300
- peg$c96 = "!",
301
- peg$c97 = { type: "literal", value: "!", description: "\"!\"" },
302
- peg$c98 = "_exists_",
303
- peg$c99 = { type: "literal", value: "_exists_", description: "\"_exists_\"" },
304
- peg$c100 = function () {
305
- error('LuceneExists');
306
- },
307
- peg$c101 = function () {
308
- error('LuceneRange');
309
- },
310
- peg$c102 = "?",
311
- peg$c103 = { type: "literal", value: "?", description: "\"?\"" },
312
- peg$c104 = function () {
313
- error('LuceneWildcard');
314
- },
315
- peg$c105 = "/",
316
- peg$c106 = { type: "literal", value: "/", description: "\"/\"" },
317
- peg$c107 = /^[^\/]/,
318
- peg$c108 = { type: "class", value: "[^/]", description: "[^/]" },
319
- peg$c109 = function () {
320
- error('LuceneRegex');
111
+ end() {
112
+ return "end of input";
321
113
  },
322
- peg$c110 = "~",
323
- peg$c111 = { type: "literal", value: "~", description: "\"~\"" },
324
- peg$c112 = /^[0-9]/,
325
- peg$c113 = { type: "class", value: "[0-9]", description: "[0-9]" },
326
- peg$c114 = function () {
327
- error('LuceneFuzzy');
328
- },
329
- peg$c115 = function () {
330
- error('LuceneProximity');
331
- },
332
- peg$c116 = "^",
333
- peg$c117 = { type: "literal", value: "^", description: "\"^\"" },
334
- peg$c118 = function () {
335
- error('LuceneBoost');
114
+
115
+ other(expectation) {
116
+ return expectation.description;
336
117
  },
337
- peg$c119 = function () { return char; },
338
- peg$c120 = "=",
339
- peg$c121 = { type: "literal", value: "=", description: "\"=\"" },
340
- peg$c122 = "[",
341
- peg$c123 = { type: "literal", value: "[", description: "\"[\"" },
342
- peg$c124 = "]",
343
- peg$c125 = { type: "literal", value: "]", description: "\"]\"" },
344
- peg$c126 = "TO",
345
- peg$c127 = { type: "literal", value: "TO", description: "\"TO\"" },
118
+ };
346
119
 
347
- peg$currPos = 0,
348
- peg$savedPos = 0,
349
- peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
350
- peg$maxFailPos = 0,
351
- peg$maxFailExpected = [],
352
- peg$silentFails = 0,
120
+ function describeExpectation(expectation) {
121
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
122
+ }
353
123
 
354
- peg$result;
124
+ function describeExpected(expected) {
125
+ const descriptions = expected.map(describeExpectation);
126
+ descriptions.sort();
355
127
 
356
- if ("startRule" in options) {
357
- if (!(options.startRule in peg$startRuleFunctions)) {
358
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
128
+ if (descriptions.length > 0) {
129
+ let j = 1;
130
+ for (let i = 1; i < descriptions.length; i++) {
131
+ if (descriptions[i - 1] !== descriptions[i]) {
132
+ descriptions[j] = descriptions[i];
133
+ j++;
134
+ }
135
+ }
136
+ descriptions.length = j;
359
137
  }
360
138
 
361
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
139
+ switch (descriptions.length) {
140
+ case 1:
141
+ return descriptions[0];
142
+
143
+ case 2:
144
+ return descriptions[0] + " or " + descriptions[1];
145
+
146
+ default:
147
+ return descriptions.slice(0, -1).join(", ")
148
+ + ", or "
149
+ + descriptions[descriptions.length - 1];
150
+ }
362
151
  }
363
152
 
364
- function text() {
365
- return input.substring(peg$savedPos, peg$currPos);
153
+ function describeFound(found) {
154
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
366
155
  }
367
156
 
368
- function location() {
369
- return peg$computeLocation(peg$savedPos, peg$currPos);
157
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
158
+ }
159
+ }
160
+
161
+ function peg$parse(input, options) {
162
+ options = options !== undefined ? options : {};
163
+
164
+ const peg$FAILED = {};
165
+ const peg$source = options.grammarSource;
166
+
167
+ const peg$startRuleFunctions = {
168
+ start: peg$parsestart,
169
+ Literal: peg$parseLiteral,
170
+ };
171
+ let peg$startRuleFunction = peg$parsestart;
172
+
173
+ const peg$c0 = "(";
174
+ const peg$c1 = ")";
175
+ const peg$c2 = ":";
176
+ const peg$c3 = "{";
177
+ const peg$c4 = "}";
178
+ const peg$c5 = "or";
179
+ const peg$c6 = "and";
180
+ const peg$c7 = "not";
181
+ const peg$c8 = ".";
182
+ const peg$c9 = "\"";
183
+ const peg$c10 = "\\";
184
+ const peg$c11 = "*";
185
+ const peg$c12 = "\\t";
186
+ const peg$c13 = "\\r";
187
+ const peg$c14 = "\\n";
188
+ const peg$c15 = "<@";
189
+ const peg$c16 = "<=";
190
+ const peg$c17 = ">=";
191
+ const peg$c18 = "<";
192
+ const peg$c19 = ">";
193
+ const peg$c20 = "\xA9kuery-cursor\xA9";
194
+
195
+ const peg$r0 = /^[0-9]/;
196
+ const peg$r1 = /^[\\"]/;
197
+ const peg$r2 = /^[^"]/;
198
+ const peg$r3 = /^[\\():<>"*{}]/;
199
+ const peg$r4 = /^[ \t\r\n]/;
200
+
201
+ const peg$e0 = peg$literalExpectation("(", false);
202
+ const peg$e1 = peg$literalExpectation(")", false);
203
+ const peg$e2 = peg$literalExpectation(":", false);
204
+ const peg$e3 = peg$literalExpectation("{", false);
205
+ const peg$e4 = peg$literalExpectation("}", false);
206
+ const peg$e5 = peg$otherExpectation("fieldName");
207
+ const peg$e6 = peg$otherExpectation("value");
208
+ const peg$e7 = peg$otherExpectation("OR");
209
+ const peg$e8 = peg$literalExpectation("or", true);
210
+ const peg$e9 = peg$otherExpectation("AND");
211
+ const peg$e10 = peg$literalExpectation("and", true);
212
+ const peg$e11 = peg$otherExpectation("NOT");
213
+ const peg$e12 = peg$literalExpectation("not", true);
214
+ const peg$e13 = peg$otherExpectation("literal");
215
+ const peg$e14 = peg$literalExpectation(".", false);
216
+ const peg$e15 = peg$classExpectation([["0", "9"]], false, false, false);
217
+ const peg$e16 = peg$literalExpectation("\"", false);
218
+ const peg$e17 = peg$literalExpectation("\\", false);
219
+ const peg$e18 = peg$classExpectation(["\\", "\""], false, false, false);
220
+ const peg$e19 = peg$classExpectation(["\""], true, false, false);
221
+ const peg$e20 = peg$anyExpectation();
222
+ const peg$e21 = peg$literalExpectation("*", false);
223
+ const peg$e22 = peg$literalExpectation("\\t", false);
224
+ const peg$e23 = peg$literalExpectation("\\r", false);
225
+ const peg$e24 = peg$literalExpectation("\\n", false);
226
+ const peg$e25 = peg$classExpectation(["\\", "(", ")", ":", "<", ">", "\"", "*", "{", "}"], false, false, false);
227
+ const peg$e26 = peg$literalExpectation("<@", false);
228
+ const peg$e27 = peg$literalExpectation("<=", false);
229
+ const peg$e28 = peg$literalExpectation(">=", false);
230
+ const peg$e29 = peg$literalExpectation("<", false);
231
+ const peg$e30 = peg$literalExpectation(">", false);
232
+ const peg$e31 = peg$otherExpectation("whitespace");
233
+ const peg$e32 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
234
+ const peg$e33 = peg$literalExpectation("\xA9kuery-cursor\xA9", false);
235
+
236
+ function peg$f0(query, trailing) {
237
+ if (trailing.type === 'cursor') {
238
+ return {
239
+ ...trailing,
240
+ suggestionTypes: ['conjunction'],
241
+ rule:"start"
242
+ };
370
243
  }
244
+ if (query !== null) return query;
245
+ return nodeTypes.function.buildNode('is', '*', '*');
246
+ }
247
+ function peg$f1(left, right) {
248
+ const cursor = [left, right].find(node => node.type === 'cursor');
249
+ if (cursor) return cursor;
250
+ return buildFunctionNode('or', [left, right]);
251
+ }
252
+ function peg$f2(left, right) {
253
+ const cursor = [left, right].find(node => node.type === 'cursor');
254
+ if (cursor) return cursor;
255
+ return buildFunctionNode('and', [left, right]);
256
+ }
257
+ function peg$f3(query) {
258
+ if (query.type === 'cursor') return query;
259
+ return buildFunctionNode('not', [query]);
260
+ }
261
+ function peg$f4(query, trailing) {
262
+ if (trailing.type === 'cursor') {
263
+ return {
264
+ ...trailing,
265
+ suggestionTypes: ['conjunction'],
266
+ rule:"SubQuery"
267
+ };
268
+ }
269
+ return query;
270
+ }
271
+ function peg$f5(field, query, trailing) {
272
+ if (query.type === 'cursor') {
273
+ return {
274
+ ...query,
275
+ nestedPath: query.nestedPath ? `${field.value}.${query.nestedPath}` : field.value,
276
+ }
277
+ };
371
278
 
372
- function expected(description) {
373
- throw peg$buildException(
374
- null,
375
- [{ type: "other", description: description }],
376
- input.substring(peg$savedPos, peg$currPos),
377
- peg$computeLocation(peg$savedPos, peg$currPos)
378
- );
279
+ if (trailing.type === 'cursor') {
280
+ return {
281
+ ...trailing,
282
+ suggestionTypes: ['conjunction']
283
+ };
284
+ }
285
+ return buildFunctionNode('nested', [field, query]);
286
+ }
287
+ function peg$f6(field, operator, value) {
288
+ if (value.type === 'cursor') {
289
+ return {
290
+ ...value,
291
+ fieldName: field.value,
292
+ suggestionTypes: ['geo_value','conjunction'],
293
+ rule:"FieldGeoSpatialExpression"
294
+ };
295
+ }
296
+ return {
297
+ type: 'function',
298
+ function: 'geospatial',
299
+ arguments: [field,operator, value],
300
+ }
301
+
302
+ }
303
+ function peg$f7(field, operator, partial) {
304
+ if (partial.type === 'cursor') {
305
+ return {
306
+ ...partial,
307
+ fieldName: field.value,
308
+ suggestionTypes: ['geo_value', 'conjunction'],
309
+ rule:"FieldMultiGeoSpatialExpression"
310
+ };
311
+ }
312
+ const range = buildNamedArgNode(operator, partial(field))
313
+ const listItems = partial(field)
314
+ if(listItems.function == "is"){
315
+ //One Item in the list
316
+ return buildFunctionNode('geospatial', [field,operator, listItems.arguments[1]]);
317
+ }
318
+ return {...listItems,arguments:listItems.arguments.map(a=> buildFunctionNode('geospatial', {
319
+ type: 'function',
320
+ function: 'geospatial',
321
+ arguments: [field,operator, a.arguments[1]],
322
+ }))}
323
+ }
324
+ function peg$f8(field, operator, value) {
325
+ if (value.type === 'cursor') {
326
+ return {
327
+ ...value,
328
+ fieldName: field.value,
329
+ suggestionTypes: ['value','conjunction'],
330
+ rule:"FieldRangeExpression"
331
+ };
332
+ }
333
+ const range = buildNamedArgNode(operator, value);
334
+ return buildFunctionNode('range', [field, range]);
335
+ }
336
+ function peg$f9(field, partial) {
337
+ if (partial.type === 'cursor') {
338
+ if(partial.prefix.includes(wildcardSymbol)){
339
+ return {
340
+ ...partial,
341
+ fieldName: field.value,
342
+ suggestionTypes: ['conjunction'],
343
+ rule:"FieldValueExpression"
344
+ }
345
+ }
346
+ return {
347
+ ...partial,
348
+ fieldName: field.value,
349
+ suggestionTypes: ['value', 'conjunction'],
350
+ rule:"FieldValueExpression"
351
+ };
379
352
  }
353
+ return partial(field);
354
+ }
355
+ function peg$f10(partial) {
356
+ if (partial.type === 'cursor') {
357
+ const fieldName = `${partial.prefix}${partial.suffix}`.trim();
358
+ return {
359
+ ...partial,
360
+ fieldName,
361
+ suggestionTypes: ['field', 'operator', 'conjunction'],
362
+ rule:"ValueExpression"
363
+ };
364
+ }
365
+ const field = buildLiteralNode(null);
366
+ return partial(field);
367
+ }
368
+ function peg$f11(partial, trailing) {
369
+ if (trailing.type === 'cursor') {
370
+ return {
371
+ ...trailing,
372
+ suggestionTypes: ['conjunction'],
373
+ rule:"ListOfValues"
374
+ };
375
+ }
376
+ return partial;
377
+ }
378
+ function peg$f12(partialLeft, partialRight) {
379
+ const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
380
+ if (cursor) {
381
+ return {
382
+ ...cursor,
383
+ suggestionTypes: ['value'],
384
+ rule:"OrListOfValues"
385
+ };
386
+ }
387
+ return (field) => buildFunctionNode('or', [partialLeft(field), partialRight(field)]);
388
+ }
389
+ function peg$f13(partialLeft, partialRight) {
390
+ const cursor = [partialLeft, partialRight].find(node => node.type === 'cursor');
391
+ if (cursor) {
392
+ return {
393
+ ...cursor,
394
+ suggestionTypes: ['value'],
395
+ rule:"AndListOfValues"
396
+ };
397
+ }
398
+ return (field) => buildFunctionNode('and', [partialLeft(field), partialRight(field)]);
399
+ }
400
+ function peg$f14(partial) {
401
+ if (partial.type === 'cursor') {
402
+ return {
403
+ ...list,
404
+ suggestionTypes: ['value'],
405
+ rule:"NotListOfValues"
406
+ };
407
+ }
408
+ return (field) => buildFunctionNode('not', [partial(field)]);
409
+ }
410
+ function peg$f15(value) {
411
+ if (value.type === 'cursor') return value;
412
+ const isPhrase = buildLiteralNode(true);
413
+ return (field) => buildFunctionNode('is', [field, value, isPhrase]);
414
+ }
415
+ function peg$f16(value) {
416
+ if (value.type === 'cursor') return value;
380
417
 
381
- function error(message) {
382
- throw peg$buildException(
383
- message,
384
- null,
385
- input.substring(peg$savedPos, peg$currPos),
386
- peg$computeLocation(peg$savedPos, peg$currPos)
387
- );
418
+ if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) {
419
+ error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.');
388
420
  }
389
421
 
390
- function peg$computePosDetails(pos) {
391
- var details = peg$posDetailsCache[pos],
392
- p, ch;
422
+ const isPhrase = buildLiteralNode(false);
423
+ return (field) => buildFunctionNode('is', [field, value, isPhrase]);
424
+ }
425
+ function peg$f17() { return parseFloat(text()); }
426
+ function peg$f18() { return parseInt(text(), 10); }
427
+ function peg$f19(prefix, cursor, suffix) {
428
+ const { start, end } = location();
429
+ return {
430
+ type: 'cursor',
431
+ start: start.offset,
432
+ end: end.offset - cursor.length,
433
+ prefix: prefix.join(''),
434
+ suffix: suffix.join(''),
435
+ text: text().replace(cursor, ''),
436
+ rule:"QuotedString"
437
+ };
438
+ }
439
+ function peg$f20(chars) {
440
+ return buildLiteralNode(chars.join(''));
441
+ }
442
+ function peg$f21(char) { return char; }
443
+ function peg$f22(char) { return char; }
444
+ function peg$f23(prefix, cursor, suffix) {
445
+ const { start, end } = location();
446
+ return {
447
+ type: 'cursor',
448
+ start: start.offset,
449
+ end: end.offset - cursor.length,
450
+ prefix: prefix.join(''),
451
+ suffix: suffix.join(''),
452
+ text: text().replace(cursor, ''),
453
+ rule:"UnquotedLiteral"
454
+ };
455
+ }
456
+ function peg$f24(chars) {
457
+ const sequence = chars.join('').trim();
458
+ if (sequence === 'null') return buildLiteralNode(null);
459
+ if (sequence === 'true') return buildLiteralNode(true);
460
+ if (sequence === 'false') return buildLiteralNode(false);
461
+ if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence);
462
+ const isNumberPattern = /^(-?[1-9]+\d*([.]\d+)?)$|^(-?0[.]\d*[1-9]+)$|^0$|^0.0$|^[.]\d{1,}$/;
463
+ return buildLiteralNode(
464
+ isNumberPattern.test(sequence)
465
+ ? isFinite(sequence) && (sequence > Number.MAX_SAFE_INTEGER || sequence < Number.MIN_SAFE_INTEGER)
466
+ ? BigInt(sequence)
467
+ : Number(sequence)
468
+ : sequence
469
+ );
470
+ }
471
+ function peg$f25(char) { return char; }
472
+ function peg$f26() { return wildcardSymbol; }
473
+ function peg$f27(prefix, cursor, suffix) {
474
+ const { start, end } = location();
475
+ return {
476
+ type: 'cursor',
477
+ start: start.offset,
478
+ end: end.offset - cursor.length,
479
+ prefix: prefix.join(''),
480
+ suffix: suffix.join(''),
481
+ text: text().replace(cursor, ''),
482
+ rule:"OptionalSpace"
483
+ };
484
+ }
485
+ function peg$f28() { return '\t'; }
486
+ function peg$f29() { return '\r'; }
487
+ function peg$f30() { return '\n'; }
488
+ function peg$f31(char) { return char; }
489
+ function peg$f32(keyword) { return keyword; }
490
+ function peg$f33() { return 'within'; }
491
+ function peg$f34() { return 'lte'; }
492
+ function peg$f35() { return 'gte'; }
493
+ function peg$f36() { return 'lt'; }
494
+ function peg$f37() { return 'gt'; }
495
+ function peg$f38() { return parseCursor; }
496
+ function peg$f39() { return cursorSymbol; }
497
+ let peg$currPos = options.peg$currPos | 0;
498
+ let peg$savedPos = peg$currPos;
499
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
500
+ let peg$maxFailPos = peg$currPos;
501
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
502
+ let peg$silentFails = options.peg$silentFails | 0;
503
+
504
+ let peg$result;
505
+
506
+ if (options.startRule) {
507
+ if (!(options.startRule in peg$startRuleFunctions)) {
508
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
509
+ }
510
+
511
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
512
+ }
393
513
 
394
- if (details) {
395
- return details;
396
- } else {
397
- p = pos - 1;
398
- while (!peg$posDetailsCache[p]) {
399
- p--;
400
- }
514
+ function text() {
515
+ return input.substring(peg$savedPos, peg$currPos);
516
+ }
401
517
 
402
- details = peg$posDetailsCache[p];
403
- details = {
404
- line: details.line,
405
- column: details.column,
406
- seenCR: details.seenCR
407
- };
408
-
409
- while (p < pos) {
410
- ch = input.charAt(p);
411
- if (ch === "\n") {
412
- if (!details.seenCR) { details.line++; }
413
- details.column = 1;
414
- details.seenCR = false;
415
- } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
416
- details.line++;
417
- details.column = 1;
418
- details.seenCR = true;
419
- } else {
420
- details.column++;
421
- details.seenCR = false;
422
- }
518
+ function offset() {
519
+ return peg$savedPos;
520
+ }
423
521
 
424
- p++;
425
- }
522
+ function range() {
523
+ return {
524
+ source: peg$source,
525
+ start: peg$savedPos,
526
+ end: peg$currPos,
527
+ };
528
+ }
426
529
 
427
- peg$posDetailsCache[pos] = details;
428
- return details;
429
- }
430
- }
530
+ function location() {
531
+ return peg$computeLocation(peg$savedPos, peg$currPos);
532
+ }
431
533
 
432
- function peg$computeLocation(startPos, endPos) {
433
- var startPosDetails = peg$computePosDetails(startPos),
434
- endPosDetails = peg$computePosDetails(endPos);
534
+ function expected(description, location) {
535
+ location = location !== undefined
536
+ ? location
537
+ : peg$computeLocation(peg$savedPos, peg$currPos);
435
538
 
436
- return {
437
- start: {
438
- offset: startPos,
439
- line: startPosDetails.line,
440
- column: startPosDetails.column
441
- },
442
- end: {
443
- offset: endPos,
444
- line: endPosDetails.line,
445
- column: endPosDetails.column
446
- }
447
- };
448
- }
539
+ throw peg$buildStructuredError(
540
+ [peg$otherExpectation(description)],
541
+ input.substring(peg$savedPos, peg$currPos),
542
+ location
543
+ );
544
+ }
449
545
 
450
- function peg$fail(expected) {
451
- if (peg$currPos < peg$maxFailPos) { return; }
546
+ function error(message, location) {
547
+ location = location !== undefined
548
+ ? location
549
+ : peg$computeLocation(peg$savedPos, peg$currPos);
452
550
 
453
- if (peg$currPos > peg$maxFailPos) {
454
- peg$maxFailPos = peg$currPos;
455
- peg$maxFailExpected = [];
456
- }
551
+ throw peg$buildSimpleError(message, location);
552
+ }
457
553
 
458
- peg$maxFailExpected.push(expected);
554
+ function peg$getUnicode(pos = peg$currPos) {
555
+ const cp = input.codePointAt(pos);
556
+ if (cp === undefined) {
557
+ return "";
459
558
  }
559
+ return String.fromCodePoint(cp);
560
+ }
460
561
 
461
- function peg$buildException(message, expected, found, location) {
462
- function cleanupExpected(expected) {
463
- var i = 1;
562
+ function peg$literalExpectation(text, ignoreCase) {
563
+ return { type: "literal", text, ignoreCase };
564
+ }
464
565
 
465
- expected.sort(function (a, b) {
466
- if (a.description < b.description) {
467
- return -1;
468
- } else if (a.description > b.description) {
469
- return 1;
470
- } else {
471
- return 0;
472
- }
473
- });
566
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
567
+ return { type: "class", parts, inverted, ignoreCase, unicode };
568
+ }
474
569
 
475
- while (i < expected.length) {
476
- if (expected[i - 1] === expected[i]) {
477
- expected.splice(i, 1);
478
- } else {
479
- i++;
480
- }
481
- }
570
+ function peg$anyExpectation() {
571
+ return { type: "any" };
572
+ }
573
+
574
+ function peg$endExpectation() {
575
+ return { type: "end" };
576
+ }
577
+
578
+ function peg$otherExpectation(description) {
579
+ return { type: "other", description };
580
+ }
581
+
582
+ function peg$computePosDetails(pos) {
583
+ let details = peg$posDetailsCache[pos];
584
+ let p;
585
+
586
+ if (details) {
587
+ return details;
588
+ } else {
589
+ if (pos >= peg$posDetailsCache.length) {
590
+ p = peg$posDetailsCache.length - 1;
591
+ } else {
592
+ p = pos;
593
+ while (!peg$posDetailsCache[--p]) {}
482
594
  }
483
595
 
484
- function buildMessage(expected, found) {
485
- function stringEscape(s) {
486
- function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
487
-
488
- return s
489
- .replace(/\\/g, '\\\\')
490
- .replace(/"/g, '\\"')
491
- .replace(/\x08/g, '\\b')
492
- .replace(/\t/g, '\\t')
493
- .replace(/\n/g, '\\n')
494
- .replace(/\f/g, '\\f')
495
- .replace(/\r/g, '\\r')
496
- .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) { return '\\x0' + hex(ch); })
497
- .replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) { return '\\x' + hex(ch); })
498
- .replace(/[\u0100-\u0FFF]/g, function (ch) { return '\\u0' + hex(ch); })
499
- .replace(/[\u1000-\uFFFF]/g, function (ch) { return '\\u' + hex(ch); });
596
+ details = peg$posDetailsCache[p];
597
+ details = {
598
+ line: details.line,
599
+ column: details.column,
600
+ };
601
+
602
+ while (p < pos) {
603
+ if (input.charCodeAt(p) === 10) {
604
+ details.line++;
605
+ details.column = 1;
606
+ } else {
607
+ details.column++;
500
608
  }
501
609
 
502
- var expectedDescs = new Array(expected.length),
503
- expectedDesc, foundDesc, i;
610
+ p++;
611
+ }
504
612
 
505
- for (i = 0; i < expected.length; i++) {
506
- expectedDescs[i] = expected[i].description;
507
- }
613
+ peg$posDetailsCache[pos] = details;
508
614
 
509
- expectedDesc = expected.length > 1
510
- ? expectedDescs.slice(0, -1).join(", ")
511
- + " or "
512
- + expectedDescs[expected.length - 1]
513
- : expectedDescs[0];
615
+ return details;
616
+ }
617
+ }
514
618
 
515
- foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
619
+ function peg$computeLocation(startPos, endPos, offset) {
620
+ const startPosDetails = peg$computePosDetails(startPos);
621
+ const endPosDetails = peg$computePosDetails(endPos);
516
622
 
517
- return "Expected " + expectedDesc + " but " + foundDesc + " found.";
518
- }
623
+ const res = {
624
+ source: peg$source,
625
+ start: {
626
+ offset: startPos,
627
+ line: startPosDetails.line,
628
+ column: startPosDetails.column,
629
+ },
630
+ end: {
631
+ offset: endPos,
632
+ line: endPosDetails.line,
633
+ column: endPosDetails.column,
634
+ },
635
+ };
636
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
637
+ res.start = peg$source.offset(res.start);
638
+ res.end = peg$source.offset(res.end);
639
+ }
640
+ return res;
641
+ }
519
642
 
520
- if (expected !== null) {
521
- cleanupExpected(expected);
522
- }
643
+ function peg$fail(expected) {
644
+ if (peg$currPos < peg$maxFailPos) { return; }
523
645
 
524
- return new peg$SyntaxError(
525
- message !== null ? message : buildMessage(expected, found),
526
- expected,
527
- found,
528
- location
529
- );
646
+ if (peg$currPos > peg$maxFailPos) {
647
+ peg$maxFailPos = peg$currPos;
648
+ peg$maxFailExpected = [];
530
649
  }
531
650
 
532
- function peg$parsestart() {
533
- var s0, s1, s2, s3;
651
+ peg$maxFailExpected.push(expected);
652
+ }
534
653
 
535
- s0 = peg$currPos;
536
- s1 = [];
654
+ function peg$buildSimpleError(message, location) {
655
+ return new peg$SyntaxError(message, null, null, location);
656
+ }
657
+
658
+ function peg$buildStructuredError(expected, found, location) {
659
+ return new peg$SyntaxError(
660
+ peg$SyntaxError.buildMessage(expected, found),
661
+ expected,
662
+ found,
663
+ location
664
+ );
665
+ }
666
+
667
+ function peg$parsestart() {
668
+ let s0, s1, s2, s3;
669
+
670
+ s0 = peg$currPos;
671
+ s1 = [];
672
+ s2 = peg$parseSpace();
673
+ while (s2 !== peg$FAILED) {
674
+ s1.push(s2);
537
675
  s2 = peg$parseSpace();
538
- while (s2 !== peg$FAILED) {
539
- s1.push(s2);
540
- s2 = peg$parseSpace();
541
- }
542
- if (s1 !== peg$FAILED) {
543
- s2 = peg$parseOrQuery();
544
- if (s2 === peg$FAILED) {
545
- s2 = null;
546
- }
547
- if (s2 !== peg$FAILED) {
548
- s3 = peg$parseOptionalSpace();
549
- if (s3 !== peg$FAILED) {
550
- peg$savedPos = s0;
551
- s1 = peg$c0(s2, s3);
552
- s0 = s1;
553
- } else {
554
- peg$currPos = s0;
555
- s0 = peg$FAILED;
556
- }
676
+ }
677
+ s2 = peg$parseOrQuery();
678
+ if (s2 === peg$FAILED) {
679
+ s2 = null;
680
+ }
681
+ s3 = peg$parseOptionalSpace();
682
+ if (s3 !== peg$FAILED) {
683
+ peg$savedPos = s0;
684
+ s0 = peg$f0(s2, s3);
685
+ } else {
686
+ peg$currPos = s0;
687
+ s0 = peg$FAILED;
688
+ }
689
+
690
+ return s0;
691
+ }
692
+
693
+ function peg$parseOrQuery() {
694
+ let s0, s1, s2, s3;
695
+
696
+ s0 = peg$currPos;
697
+ s1 = peg$parseAndQuery();
698
+ if (s1 !== peg$FAILED) {
699
+ s2 = peg$parseOr();
700
+ if (s2 !== peg$FAILED) {
701
+ s3 = peg$parseOrQuery();
702
+ if (s3 !== peg$FAILED) {
703
+ peg$savedPos = s0;
704
+ s0 = peg$f1(s1, s3);
557
705
  } else {
558
706
  peg$currPos = s0;
559
707
  s0 = peg$FAILED;
@@ -562,26 +710,29 @@ export const {
562
710
  peg$currPos = s0;
563
711
  s0 = peg$FAILED;
564
712
  }
565
-
566
- return s0;
713
+ } else {
714
+ peg$currPos = s0;
715
+ s0 = peg$FAILED;
716
+ }
717
+ if (s0 === peg$FAILED) {
718
+ s0 = peg$parseAndQuery();
567
719
  }
568
720
 
569
- function peg$parseOrQuery() {
570
- var s0, s1, s2, s3;
721
+ return s0;
722
+ }
571
723
 
572
- s0 = peg$currPos;
573
- peg$savedPos = peg$currPos;
574
- s1 = peg$c1();
575
- if (s1) {
576
- s1 = void 0;
577
- } else {
578
- s1 = peg$FAILED;
579
- }
580
- if (s1 !== peg$FAILED) {
581
- s2 = peg$parseLuceneQuery();
582
- if (s2 !== peg$FAILED) {
583
- s1 = [s1, s2];
584
- s0 = s1;
724
+ function peg$parseAndQuery() {
725
+ let s0, s1, s2, s3;
726
+
727
+ s0 = peg$currPos;
728
+ s1 = peg$parseNotQuery();
729
+ if (s1 !== peg$FAILED) {
730
+ s2 = peg$parseAnd();
731
+ if (s2 !== peg$FAILED) {
732
+ s3 = peg$parseAndQuery();
733
+ if (s3 !== peg$FAILED) {
734
+ peg$savedPos = s0;
735
+ s0 = peg$f2(s1, s3);
585
736
  } else {
586
737
  peg$currPos = s0;
587
738
  s0 = peg$FAILED;
@@ -590,50 +741,74 @@ export const {
590
741
  peg$currPos = s0;
591
742
  s0 = peg$FAILED;
592
743
  }
593
- if (s0 === peg$FAILED) {
594
- s0 = peg$currPos;
595
- s1 = peg$parseAndQuery();
596
- if (s1 !== peg$FAILED) {
597
- s2 = peg$parseOr();
598
- if (s2 !== peg$FAILED) {
599
- s3 = peg$parseOrQuery();
600
- if (s3 !== peg$FAILED) {
601
- peg$savedPos = s0;
602
- s1 = peg$c2(s1, s3);
603
- s0 = s1;
604
- } else {
605
- peg$currPos = s0;
606
- s0 = peg$FAILED;
607
- }
608
- } else {
609
- peg$currPos = s0;
610
- s0 = peg$FAILED;
611
- }
612
- } else {
613
- peg$currPos = s0;
614
- s0 = peg$FAILED;
615
- }
616
- if (s0 === peg$FAILED) {
617
- s0 = peg$parseAndQuery();
618
- }
619
- }
620
-
621
- return s0;
622
- }
623
-
624
- function peg$parseAndQuery() {
625
- var s0, s1, s2, s3;
626
-
627
- s0 = peg$currPos;
628
- s1 = peg$parseNotQuery();
629
- if (s1 !== peg$FAILED) {
630
- s2 = peg$parseAnd();
631
- if (s2 !== peg$FAILED) {
632
- s3 = peg$parseAndQuery();
633
- if (s3 !== peg$FAILED) {
634
- peg$savedPos = s0;
635
- s1 = peg$c3(s1, s3);
636
- s0 = s1;
744
+ } else {
745
+ peg$currPos = s0;
746
+ s0 = peg$FAILED;
747
+ }
748
+ if (s0 === peg$FAILED) {
749
+ s0 = peg$parseNotQuery();
750
+ }
751
+
752
+ return s0;
753
+ }
754
+
755
+ function peg$parseNotQuery() {
756
+ let s0, s1, s2;
757
+
758
+ s0 = peg$currPos;
759
+ s1 = peg$parseNot();
760
+ if (s1 !== peg$FAILED) {
761
+ s2 = peg$parseSubQuery();
762
+ if (s2 !== peg$FAILED) {
763
+ peg$savedPos = s0;
764
+ s0 = peg$f3(s2);
765
+ } else {
766
+ peg$currPos = s0;
767
+ s0 = peg$FAILED;
768
+ }
769
+ } else {
770
+ peg$currPos = s0;
771
+ s0 = peg$FAILED;
772
+ }
773
+ if (s0 === peg$FAILED) {
774
+ s0 = peg$parseSubQuery();
775
+ }
776
+
777
+ return s0;
778
+ }
779
+
780
+ function peg$parseSubQuery() {
781
+ let s0, s1, s2, s3, s4, s5;
782
+
783
+ s0 = peg$currPos;
784
+ if (input.charCodeAt(peg$currPos) === 40) {
785
+ s1 = peg$c0;
786
+ peg$currPos++;
787
+ } else {
788
+ s1 = peg$FAILED;
789
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
790
+ }
791
+ if (s1 !== peg$FAILED) {
792
+ s2 = [];
793
+ s3 = peg$parseSpace();
794
+ while (s3 !== peg$FAILED) {
795
+ s2.push(s3);
796
+ s3 = peg$parseSpace();
797
+ }
798
+ s3 = peg$parseOrQuery();
799
+ if (s3 !== peg$FAILED) {
800
+ s4 = peg$parseOptionalSpace();
801
+ if (s4 !== peg$FAILED) {
802
+ if (input.charCodeAt(peg$currPos) === 41) {
803
+ s5 = peg$c1;
804
+ peg$currPos++;
805
+ } else {
806
+ s5 = peg$FAILED;
807
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
808
+ }
809
+ if (s5 !== peg$FAILED) {
810
+ peg$savedPos = s0;
811
+ s0 = peg$f4(s3, s4);
637
812
  } else {
638
813
  peg$currPos = s0;
639
814
  s0 = peg$FAILED;
@@ -646,73 +821,71 @@ export const {
646
821
  peg$currPos = s0;
647
822
  s0 = peg$FAILED;
648
823
  }
649
- if (s0 === peg$FAILED) {
650
- s0 = peg$parseNotQuery();
651
- }
652
-
653
- return s0;
824
+ } else {
825
+ peg$currPos = s0;
826
+ s0 = peg$FAILED;
654
827
  }
655
-
656
- function peg$parseNotQuery() {
657
- var s0, s1, s2;
658
-
659
- s0 = peg$currPos;
660
- s1 = peg$parseNot();
661
- if (s1 !== peg$FAILED) {
662
- s2 = peg$parseSubQuery();
663
- if (s2 !== peg$FAILED) {
664
- peg$savedPos = s0;
665
- s1 = peg$c4(s2);
666
- s0 = s1;
667
- } else {
668
- peg$currPos = s0;
669
- s0 = peg$FAILED;
670
- }
671
- } else {
672
- peg$currPos = s0;
673
- s0 = peg$FAILED;
674
- }
675
- if (s0 === peg$FAILED) {
676
- s0 = peg$parseSubQuery();
677
- }
678
-
679
- return s0;
828
+ if (s0 === peg$FAILED) {
829
+ s0 = peg$parseNestedQuery();
680
830
  }
681
831
 
682
- function peg$parseSubQuery() {
683
- var s0, s1, s2, s3, s4, s5;
832
+ return s0;
833
+ }
684
834
 
685
- s0 = peg$currPos;
686
- if (input.charCodeAt(peg$currPos) === 40) {
687
- s1 = peg$c5;
835
+ function peg$parseNestedQuery() {
836
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
837
+
838
+ s0 = peg$currPos;
839
+ s1 = peg$parseField();
840
+ if (s1 !== peg$FAILED) {
841
+ s2 = [];
842
+ s3 = peg$parseSpace();
843
+ while (s3 !== peg$FAILED) {
844
+ s2.push(s3);
845
+ s3 = peg$parseSpace();
846
+ }
847
+ if (input.charCodeAt(peg$currPos) === 58) {
848
+ s3 = peg$c2;
688
849
  peg$currPos++;
689
850
  } else {
690
- s1 = peg$FAILED;
691
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
851
+ s3 = peg$FAILED;
852
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
692
853
  }
693
- if (s1 !== peg$FAILED) {
694
- s2 = [];
695
- s3 = peg$parseSpace();
696
- while (s3 !== peg$FAILED) {
697
- s2.push(s3);
698
- s3 = peg$parseSpace();
854
+ if (s3 !== peg$FAILED) {
855
+ s4 = [];
856
+ s5 = peg$parseSpace();
857
+ while (s5 !== peg$FAILED) {
858
+ s4.push(s5);
859
+ s5 = peg$parseSpace();
699
860
  }
700
- if (s2 !== peg$FAILED) {
701
- s3 = peg$parseOrQuery();
702
- if (s3 !== peg$FAILED) {
703
- s4 = peg$parseOptionalSpace();
704
- if (s4 !== peg$FAILED) {
705
- if (input.charCodeAt(peg$currPos) === 41) {
706
- s5 = peg$c7;
861
+ if (input.charCodeAt(peg$currPos) === 123) {
862
+ s5 = peg$c3;
863
+ peg$currPos++;
864
+ } else {
865
+ s5 = peg$FAILED;
866
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
867
+ }
868
+ if (s5 !== peg$FAILED) {
869
+ s6 = [];
870
+ s7 = peg$parseSpace();
871
+ while (s7 !== peg$FAILED) {
872
+ s6.push(s7);
873
+ s7 = peg$parseSpace();
874
+ }
875
+ s7 = peg$parseOrQuery();
876
+ if (s7 !== peg$FAILED) {
877
+ s8 = peg$parseOptionalSpace();
878
+ if (s8 !== peg$FAILED) {
879
+ if (input.charCodeAt(peg$currPos) === 125) {
880
+ s9 = peg$c4;
707
881
  peg$currPos++;
708
882
  } else {
709
- s5 = peg$FAILED;
710
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
883
+ s9 = peg$FAILED;
884
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
711
885
  }
712
- if (s5 !== peg$FAILED) {
886
+ if (s9 !== peg$FAILED) {
713
887
  peg$savedPos = s0;
714
- s1 = peg$c9(s3, s4);
715
- s0 = s1;
888
+ s0 = peg$f5(s1, s7, s8);
716
889
  } else {
717
890
  peg$currPos = s0;
718
891
  s0 = peg$FAILED;
@@ -733,342 +906,75 @@ export const {
733
906
  peg$currPos = s0;
734
907
  s0 = peg$FAILED;
735
908
  }
736
- if (s0 === peg$FAILED) {
737
- s0 = peg$parseNestedQuery();
738
- }
739
-
740
- return s0;
909
+ } else {
910
+ peg$currPos = s0;
911
+ s0 = peg$FAILED;
741
912
  }
742
-
743
- function peg$parseNestedQuery() {
744
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
745
-
746
- s0 = peg$currPos;
747
- s1 = peg$parseField();
748
- if (s1 !== peg$FAILED) {
749
- s2 = [];
750
- s3 = peg$parseSpace();
751
- while (s3 !== peg$FAILED) {
752
- s2.push(s3);
753
- s3 = peg$parseSpace();
754
- }
755
- if (s2 !== peg$FAILED) {
756
- if (input.charCodeAt(peg$currPos) === 58) {
757
- s3 = peg$c10;
758
- peg$currPos++;
759
- } else {
760
- s3 = peg$FAILED;
761
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
762
- }
763
- if (s3 !== peg$FAILED) {
764
- s4 = [];
765
- s5 = peg$parseSpace();
766
- while (s5 !== peg$FAILED) {
767
- s4.push(s5);
768
- s5 = peg$parseSpace();
769
- }
770
- if (s4 !== peg$FAILED) {
771
- if (input.charCodeAt(peg$currPos) === 123) {
772
- s5 = peg$c12;
773
- peg$currPos++;
774
- } else {
775
- s5 = peg$FAILED;
776
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
777
- }
778
- if (s5 !== peg$FAILED) {
779
- s6 = [];
780
- s7 = peg$parseSpace();
781
- while (s7 !== peg$FAILED) {
782
- s6.push(s7);
783
- s7 = peg$parseSpace();
784
- }
785
- if (s6 !== peg$FAILED) {
786
- s7 = peg$parseOrQuery();
787
- if (s7 !== peg$FAILED) {
788
- s8 = peg$parseOptionalSpace();
789
- if (s8 !== peg$FAILED) {
790
- if (input.charCodeAt(peg$currPos) === 125) {
791
- s9 = peg$c14;
792
- peg$currPos++;
793
- } else {
794
- s9 = peg$FAILED;
795
- if (peg$silentFails === 0) { peg$fail(peg$c15); }
796
- }
797
- if (s9 !== peg$FAILED) {
798
- peg$savedPos = s0;
799
- s1 = peg$c16(s1, s7, s8);
800
- s0 = s1;
801
- } else {
802
- peg$currPos = s0;
803
- s0 = peg$FAILED;
804
- }
805
- } else {
806
- peg$currPos = s0;
807
- s0 = peg$FAILED;
808
- }
809
- } else {
810
- peg$currPos = s0;
811
- s0 = peg$FAILED;
812
- }
813
- } else {
814
- peg$currPos = s0;
815
- s0 = peg$FAILED;
816
- }
817
- } else {
818
- peg$currPos = s0;
819
- s0 = peg$FAILED;
820
- }
821
- } else {
822
- peg$currPos = s0;
823
- s0 = peg$FAILED;
824
- }
825
- } else {
826
- peg$currPos = s0;
827
- s0 = peg$FAILED;
828
- }
829
- } else {
830
- peg$currPos = s0;
831
- s0 = peg$FAILED;
832
- }
833
- } else {
834
- peg$currPos = s0;
835
- s0 = peg$FAILED;
836
- }
837
- if (s0 === peg$FAILED) {
838
- s0 = peg$parseExpression();
839
- }
840
-
841
- return s0;
913
+ if (s0 === peg$FAILED) {
914
+ s0 = peg$parseExpression();
842
915
  }
843
916
 
844
- function peg$parseExpression() {
845
- var s0;
846
-
847
- s0 = peg$parseFieldRangeExpression();
848
- if (s0 === peg$FAILED) {
849
- s0 = peg$parseFieldValueExpression();
850
- if (s0 === peg$FAILED) {
851
- s0 = peg$parseValueExpression();
852
- }
853
- }
854
-
855
- return s0;
856
- }
917
+ return s0;
918
+ }
857
919
 
858
- function peg$parseField() {
859
- var s0, s1;
920
+ function peg$parseExpression() {
921
+ let s0;
860
922
 
861
- peg$silentFails++;
862
- s0 = peg$parseLiteral();
863
- peg$silentFails--;
923
+ s0 = peg$parseFieldGeoSpatialExpression();
924
+ if (s0 === peg$FAILED) {
925
+ s0 = peg$parseFieldMultiGeoSpatialExpression();
864
926
  if (s0 === peg$FAILED) {
865
- s1 = peg$FAILED;
866
- if (peg$silentFails === 0) { peg$fail(peg$c17); }
867
- }
868
-
869
- return s0;
870
- }
871
-
872
- function peg$parseFieldRangeExpression() {
873
- var s0, s1, s2, s3, s4, s5;
874
-
875
- s0 = peg$currPos;
876
- s1 = peg$parseField();
877
- if (s1 !== peg$FAILED) {
878
- s2 = [];
879
- s3 = peg$parseSpace();
880
- while (s3 !== peg$FAILED) {
881
- s2.push(s3);
882
- s3 = peg$parseSpace();
883
- }
884
- if (s2 !== peg$FAILED) {
885
- s3 = peg$parseRangeOperator();
886
- if (s3 !== peg$FAILED) {
887
- s4 = [];
888
- s5 = peg$parseSpace();
889
- while (s5 !== peg$FAILED) {
890
- s4.push(s5);
891
- s5 = peg$parseSpace();
892
- }
893
- if (s4 !== peg$FAILED) {
894
- s5 = peg$parseLiteral();
895
- if (s5 !== peg$FAILED) {
896
- peg$savedPos = s0;
897
- s1 = peg$c18(s1, s3, s5);
898
- s0 = s1;
899
- } else {
900
- peg$currPos = s0;
901
- s0 = peg$FAILED;
902
- }
903
- } else {
904
- peg$currPos = s0;
905
- s0 = peg$FAILED;
906
- }
907
- } else {
908
- peg$currPos = s0;
909
- s0 = peg$FAILED;
927
+ s0 = peg$parseFieldRangeExpression();
928
+ if (s0 === peg$FAILED) {
929
+ s0 = peg$parseFieldValueExpression();
930
+ if (s0 === peg$FAILED) {
931
+ s0 = peg$parseValueExpression();
910
932
  }
911
- } else {
912
- peg$currPos = s0;
913
- s0 = peg$FAILED;
914
933
  }
915
- } else {
916
- peg$currPos = s0;
917
- s0 = peg$FAILED;
918
934
  }
919
-
920
- return s0;
921
935
  }
922
936
 
923
- function peg$parseFieldValueExpression() {
924
- var s0, s1, s2, s3, s4, s5;
937
+ return s0;
938
+ }
925
939
 
926
- s0 = peg$currPos;
927
- s1 = peg$parseField();
928
- if (s1 !== peg$FAILED) {
929
- s2 = [];
930
- s3 = peg$parseSpace();
931
- while (s3 !== peg$FAILED) {
932
- s2.push(s3);
933
- s3 = peg$parseSpace();
934
- }
935
- if (s2 !== peg$FAILED) {
936
- if (input.charCodeAt(peg$currPos) === 58) {
937
- s3 = peg$c10;
938
- peg$currPos++;
939
- } else {
940
- s3 = peg$FAILED;
941
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
942
- }
943
- if (s3 !== peg$FAILED) {
944
- s4 = [];
945
- s5 = peg$parseSpace();
946
- while (s5 !== peg$FAILED) {
947
- s4.push(s5);
948
- s5 = peg$parseSpace();
949
- }
950
- if (s4 !== peg$FAILED) {
951
- s5 = peg$parseListOfValues();
952
- if (s5 !== peg$FAILED) {
953
- peg$savedPos = s0;
954
- s1 = peg$c19(s1, s5);
955
- s0 = s1;
956
- } else {
957
- peg$currPos = s0;
958
- s0 = peg$FAILED;
959
- }
960
- } else {
961
- peg$currPos = s0;
962
- s0 = peg$FAILED;
963
- }
964
- } else {
965
- peg$currPos = s0;
966
- s0 = peg$FAILED;
967
- }
968
- } else {
969
- peg$currPos = s0;
970
- s0 = peg$FAILED;
971
- }
972
- } else {
973
- peg$currPos = s0;
974
- s0 = peg$FAILED;
975
- }
940
+ function peg$parseField() {
941
+ let s0, s1;
976
942
 
977
- return s0;
943
+ peg$silentFails++;
944
+ s0 = peg$parseLiteral();
945
+ peg$silentFails--;
946
+ if (s0 === peg$FAILED) {
947
+ s1 = peg$FAILED;
948
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
978
949
  }
979
950
 
980
- function peg$parseValueExpression() {
981
- var s0, s1;
982
-
983
- s0 = peg$currPos;
984
- s1 = peg$parseValue();
985
- if (s1 !== peg$FAILED) {
986
- peg$savedPos = s0;
987
- s1 = peg$c20(s1);
988
- }
989
- s0 = s1;
990
-
991
- return s0;
992
- }
951
+ return s0;
952
+ }
993
953
 
994
- function peg$parseListOfValues() {
995
- var s0, s1, s2, s3, s4, s5;
954
+ function peg$parseFieldGeoSpatialExpression() {
955
+ let s0, s1, s2, s3, s4, s5;
996
956
 
997
- s0 = peg$currPos;
998
- if (input.charCodeAt(peg$currPos) === 40) {
999
- s1 = peg$c5;
1000
- peg$currPos++;
1001
- } else {
1002
- s1 = peg$FAILED;
1003
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
1004
- }
1005
- if (s1 !== peg$FAILED) {
1006
- s2 = [];
957
+ s0 = peg$currPos;
958
+ s1 = peg$parseField();
959
+ if (s1 !== peg$FAILED) {
960
+ s2 = [];
961
+ s3 = peg$parseSpace();
962
+ while (s3 !== peg$FAILED) {
963
+ s2.push(s3);
1007
964
  s3 = peg$parseSpace();
1008
- while (s3 !== peg$FAILED) {
1009
- s2.push(s3);
1010
- s3 = peg$parseSpace();
1011
- }
1012
- if (s2 !== peg$FAILED) {
1013
- s3 = peg$parseOrListOfValues();
1014
- if (s3 !== peg$FAILED) {
1015
- s4 = peg$parseOptionalSpace();
1016
- if (s4 !== peg$FAILED) {
1017
- if (input.charCodeAt(peg$currPos) === 41) {
1018
- s5 = peg$c7;
1019
- peg$currPos++;
1020
- } else {
1021
- s5 = peg$FAILED;
1022
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
1023
- }
1024
- if (s5 !== peg$FAILED) {
1025
- peg$savedPos = s0;
1026
- s1 = peg$c21(s3, s4);
1027
- s0 = s1;
1028
- } else {
1029
- peg$currPos = s0;
1030
- s0 = peg$FAILED;
1031
- }
1032
- } else {
1033
- peg$currPos = s0;
1034
- s0 = peg$FAILED;
1035
- }
1036
- } else {
1037
- peg$currPos = s0;
1038
- s0 = peg$FAILED;
1039
- }
1040
- } else {
1041
- peg$currPos = s0;
1042
- s0 = peg$FAILED;
1043
- }
1044
- } else {
1045
- peg$currPos = s0;
1046
- s0 = peg$FAILED;
1047
- }
1048
- if (s0 === peg$FAILED) {
1049
- s0 = peg$parseValue();
1050
965
  }
1051
-
1052
- return s0;
1053
- }
1054
-
1055
- function peg$parseOrListOfValues() {
1056
- var s0, s1, s2, s3;
1057
-
1058
- s0 = peg$currPos;
1059
- s1 = peg$parseAndListOfValues();
1060
- if (s1 !== peg$FAILED) {
1061
- s2 = peg$parseOr();
1062
- if (s2 !== peg$FAILED) {
1063
- s3 = peg$parseOrListOfValues();
1064
- if (s3 !== peg$FAILED) {
1065
- peg$savedPos = s0;
1066
- s1 = peg$c22(s1, s3);
1067
- s0 = s1;
1068
- } else {
1069
- peg$currPos = s0;
1070
- s0 = peg$FAILED;
1071
- }
966
+ s3 = peg$parseGeoSpatialOperator();
967
+ if (s3 !== peg$FAILED) {
968
+ s4 = [];
969
+ s5 = peg$parseSpace();
970
+ while (s5 !== peg$FAILED) {
971
+ s4.push(s5);
972
+ s5 = peg$parseSpace();
973
+ }
974
+ s5 = peg$parseLiteral();
975
+ if (s5 !== peg$FAILED) {
976
+ peg$savedPos = s0;
977
+ s0 = peg$f6(s1, s3, s5);
1072
978
  } else {
1073
979
  peg$currPos = s0;
1074
980
  s0 = peg$FAILED;
@@ -1077,992 +983,78 @@ export const {
1077
983
  peg$currPos = s0;
1078
984
  s0 = peg$FAILED;
1079
985
  }
1080
- if (s0 === peg$FAILED) {
1081
- s0 = peg$parseAndListOfValues();
1082
- }
1083
-
1084
- return s0;
1085
- }
1086
-
1087
- function peg$parseAndListOfValues() {
1088
- var s0, s1, s2, s3;
1089
-
1090
- s0 = peg$currPos;
1091
- s1 = peg$parseNotListOfValues();
1092
- if (s1 !== peg$FAILED) {
1093
- s2 = peg$parseAnd();
1094
- if (s2 !== peg$FAILED) {
1095
- s3 = peg$parseAndListOfValues();
1096
- if (s3 !== peg$FAILED) {
1097
- peg$savedPos = s0;
1098
- s1 = peg$c23(s1, s3);
1099
- s0 = s1;
1100
- } else {
1101
- peg$currPos = s0;
1102
- s0 = peg$FAILED;
1103
- }
1104
- } else {
1105
- peg$currPos = s0;
1106
- s0 = peg$FAILED;
1107
- }
1108
- } else {
1109
- peg$currPos = s0;
1110
- s0 = peg$FAILED;
1111
- }
1112
- if (s0 === peg$FAILED) {
1113
- s0 = peg$parseNotListOfValues();
1114
- }
1115
-
1116
- return s0;
1117
- }
1118
-
1119
- function peg$parseNotListOfValues() {
1120
- var s0, s1, s2;
1121
-
1122
- s0 = peg$currPos;
1123
- s1 = peg$parseNot();
1124
- if (s1 !== peg$FAILED) {
1125
- s2 = peg$parseListOfValues();
1126
- if (s2 !== peg$FAILED) {
1127
- peg$savedPos = s0;
1128
- s1 = peg$c24(s2);
1129
- s0 = s1;
1130
- } else {
1131
- peg$currPos = s0;
1132
- s0 = peg$FAILED;
1133
- }
1134
- } else {
1135
- peg$currPos = s0;
1136
- s0 = peg$FAILED;
1137
- }
1138
- if (s0 === peg$FAILED) {
1139
- s0 = peg$parseListOfValues();
1140
- }
1141
-
1142
- return s0;
1143
- }
1144
-
1145
- function peg$parseValue() {
1146
- var s0, s1;
1147
-
1148
- peg$silentFails++;
1149
- s0 = peg$currPos;
1150
- s1 = peg$parseQuotedString();
1151
- if (s1 !== peg$FAILED) {
1152
- peg$savedPos = s0;
1153
- s1 = peg$c26(s1);
1154
- }
1155
- s0 = s1;
1156
- if (s0 === peg$FAILED) {
1157
- s0 = peg$currPos;
1158
- s1 = peg$parseUnquotedLiteral();
1159
- if (s1 !== peg$FAILED) {
1160
- peg$savedPos = s0;
1161
- s1 = peg$c27(s1);
1162
- }
1163
- s0 = s1;
1164
- }
1165
- peg$silentFails--;
1166
- if (s0 === peg$FAILED) {
1167
- s1 = peg$FAILED;
1168
- if (peg$silentFails === 0) { peg$fail(peg$c25); }
1169
- }
1170
-
1171
- return s0;
1172
- }
1173
-
1174
- function peg$parseOr() {
1175
- var s0, s1, s2, s3, s4;
1176
-
1177
- peg$silentFails++;
1178
- s0 = peg$currPos;
1179
- s1 = [];
1180
- s2 = peg$parseSpace();
1181
- if (s2 !== peg$FAILED) {
1182
- while (s2 !== peg$FAILED) {
1183
- s1.push(s2);
1184
- s2 = peg$parseSpace();
1185
- }
1186
- } else {
1187
- s1 = peg$FAILED;
1188
- }
1189
- if (s1 !== peg$FAILED) {
1190
- if (input.substr(peg$currPos, 2).toLowerCase() === peg$c29) {
1191
- s2 = input.substr(peg$currPos, 2);
1192
- peg$currPos += 2;
1193
- } else {
1194
- s2 = peg$FAILED;
1195
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
1196
- }
1197
- if (s2 !== peg$FAILED) {
1198
- s3 = [];
1199
- s4 = peg$parseSpace();
1200
- if (s4 !== peg$FAILED) {
1201
- while (s4 !== peg$FAILED) {
1202
- s3.push(s4);
1203
- s4 = peg$parseSpace();
1204
- }
1205
- } else {
1206
- s3 = peg$FAILED;
1207
- }
1208
- if (s3 !== peg$FAILED) {
1209
- s1 = [s1, s2, s3];
1210
- s0 = s1;
1211
- } else {
1212
- peg$currPos = s0;
1213
- s0 = peg$FAILED;
1214
- }
1215
- } else {
1216
- peg$currPos = s0;
1217
- s0 = peg$FAILED;
1218
- }
1219
- } else {
1220
- peg$currPos = s0;
1221
- s0 = peg$FAILED;
1222
- }
1223
- if (s0 === peg$FAILED) {
1224
- s0 = peg$currPos;
1225
- peg$savedPos = peg$currPos;
1226
- s1 = peg$c1();
1227
- if (s1) {
1228
- s1 = void 0;
1229
- } else {
1230
- s1 = peg$FAILED;
1231
- }
1232
- if (s1 !== peg$FAILED) {
1233
- s2 = peg$parseLuceneOr();
1234
- if (s2 !== peg$FAILED) {
1235
- s1 = [s1, s2];
1236
- s0 = s1;
1237
- } else {
1238
- peg$currPos = s0;
1239
- s0 = peg$FAILED;
1240
- }
1241
- } else {
1242
- peg$currPos = s0;
1243
- s0 = peg$FAILED;
1244
- }
1245
- }
1246
- peg$silentFails--;
1247
- if (s0 === peg$FAILED) {
1248
- s1 = peg$FAILED;
1249
- if (peg$silentFails === 0) { peg$fail(peg$c28); }
1250
- }
1251
-
1252
- return s0;
1253
- }
1254
-
1255
- function peg$parseAnd() {
1256
- var s0, s1, s2, s3, s4;
1257
-
1258
- peg$silentFails++;
1259
- s0 = peg$currPos;
1260
- s1 = [];
1261
- s2 = peg$parseSpace();
1262
- if (s2 !== peg$FAILED) {
1263
- while (s2 !== peg$FAILED) {
1264
- s1.push(s2);
1265
- s2 = peg$parseSpace();
1266
- }
1267
- } else {
1268
- s1 = peg$FAILED;
1269
- }
1270
- if (s1 !== peg$FAILED) {
1271
- if (input.substr(peg$currPos, 3).toLowerCase() === peg$c32) {
1272
- s2 = input.substr(peg$currPos, 3);
1273
- peg$currPos += 3;
1274
- } else {
1275
- s2 = peg$FAILED;
1276
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
1277
- }
1278
- if (s2 !== peg$FAILED) {
1279
- s3 = [];
1280
- s4 = peg$parseSpace();
1281
- if (s4 !== peg$FAILED) {
1282
- while (s4 !== peg$FAILED) {
1283
- s3.push(s4);
1284
- s4 = peg$parseSpace();
1285
- }
1286
- } else {
1287
- s3 = peg$FAILED;
1288
- }
1289
- if (s3 !== peg$FAILED) {
1290
- s1 = [s1, s2, s3];
1291
- s0 = s1;
1292
- } else {
1293
- peg$currPos = s0;
1294
- s0 = peg$FAILED;
1295
- }
1296
- } else {
1297
- peg$currPos = s0;
1298
- s0 = peg$FAILED;
1299
- }
1300
- } else {
1301
- peg$currPos = s0;
1302
- s0 = peg$FAILED;
1303
- }
1304
- if (s0 === peg$FAILED) {
1305
- s0 = peg$currPos;
1306
- peg$savedPos = peg$currPos;
1307
- s1 = peg$c1();
1308
- if (s1) {
1309
- s1 = void 0;
1310
- } else {
1311
- s1 = peg$FAILED;
1312
- }
1313
- if (s1 !== peg$FAILED) {
1314
- s2 = peg$parseLuceneAnd();
1315
- if (s2 !== peg$FAILED) {
1316
- s1 = [s1, s2];
1317
- s0 = s1;
1318
- } else {
1319
- peg$currPos = s0;
1320
- s0 = peg$FAILED;
1321
- }
1322
- } else {
1323
- peg$currPos = s0;
1324
- s0 = peg$FAILED;
1325
- }
1326
- }
1327
- peg$silentFails--;
1328
- if (s0 === peg$FAILED) {
1329
- s1 = peg$FAILED;
1330
- if (peg$silentFails === 0) { peg$fail(peg$c31); }
1331
- }
1332
-
1333
- return s0;
1334
- }
1335
-
1336
- function peg$parseNot() {
1337
- var s0, s1, s2, s3;
1338
-
1339
- peg$silentFails++;
1340
- s0 = peg$currPos;
1341
- if (input.substr(peg$currPos, 3).toLowerCase() === peg$c35) {
1342
- s1 = input.substr(peg$currPos, 3);
1343
- peg$currPos += 3;
1344
- } else {
1345
- s1 = peg$FAILED;
1346
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
1347
- }
1348
- if (s1 !== peg$FAILED) {
1349
- s2 = [];
1350
- s3 = peg$parseSpace();
1351
- if (s3 !== peg$FAILED) {
1352
- while (s3 !== peg$FAILED) {
1353
- s2.push(s3);
1354
- s3 = peg$parseSpace();
1355
- }
1356
- } else {
1357
- s2 = peg$FAILED;
1358
- }
1359
- if (s2 !== peg$FAILED) {
1360
- s1 = [s1, s2];
1361
- s0 = s1;
1362
- } else {
1363
- peg$currPos = s0;
1364
- s0 = peg$FAILED;
1365
- }
1366
- } else {
1367
- peg$currPos = s0;
1368
- s0 = peg$FAILED;
1369
- }
1370
- if (s0 === peg$FAILED) {
1371
- s0 = peg$currPos;
1372
- peg$savedPos = peg$currPos;
1373
- s1 = peg$c1();
1374
- if (s1) {
1375
- s1 = void 0;
1376
- } else {
1377
- s1 = peg$FAILED;
1378
- }
1379
- if (s1 !== peg$FAILED) {
1380
- s2 = peg$parseLuceneNot();
1381
- if (s2 !== peg$FAILED) {
1382
- s1 = [s1, s2];
1383
- s0 = s1;
1384
- } else {
1385
- peg$currPos = s0;
1386
- s0 = peg$FAILED;
1387
- }
1388
- } else {
1389
- peg$currPos = s0;
1390
- s0 = peg$FAILED;
1391
- }
1392
- }
1393
- peg$silentFails--;
1394
- if (s0 === peg$FAILED) {
1395
- s1 = peg$FAILED;
1396
- if (peg$silentFails === 0) { peg$fail(peg$c34); }
1397
- }
1398
-
1399
- return s0;
1400
- }
1401
-
1402
- function peg$parseLiteral() {
1403
- var s0, s1;
1404
-
1405
- peg$silentFails++;
1406
- s0 = peg$parseQuotedString();
1407
- if (s0 === peg$FAILED) {
1408
- s0 = peg$parseUnquotedLiteral();
1409
- }
1410
- peg$silentFails--;
1411
- if (s0 === peg$FAILED) {
1412
- s1 = peg$FAILED;
1413
- if (peg$silentFails === 0) { peg$fail(peg$c37); }
1414
- }
1415
-
1416
- return s0;
1417
- }
1418
-
1419
- function peg$parseQuotedString() {
1420
- var s0, s1, s2, s3, s4, s5;
1421
-
1422
- s0 = peg$currPos;
1423
- if (input.charCodeAt(peg$currPos) === 34) {
1424
- s1 = peg$c38;
1425
- peg$currPos++;
1426
- } else {
1427
- s1 = peg$FAILED;
1428
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
1429
- }
1430
- if (s1 !== peg$FAILED) {
1431
- s2 = [];
1432
- s3 = peg$parseQuotedCharacter();
1433
- while (s3 !== peg$FAILED) {
1434
- s2.push(s3);
1435
- s3 = peg$parseQuotedCharacter();
1436
- }
1437
- if (s2 !== peg$FAILED) {
1438
- s3 = peg$parseCursor();
1439
- if (s3 !== peg$FAILED) {
1440
- s4 = [];
1441
- s5 = peg$parseQuotedCharacter();
1442
- while (s5 !== peg$FAILED) {
1443
- s4.push(s5);
1444
- s5 = peg$parseQuotedCharacter();
1445
- }
1446
- if (s4 !== peg$FAILED) {
1447
- if (input.charCodeAt(peg$currPos) === 34) {
1448
- s5 = peg$c38;
1449
- peg$currPos++;
1450
- } else {
1451
- s5 = peg$FAILED;
1452
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
1453
- }
1454
- if (s5 !== peg$FAILED) {
1455
- peg$savedPos = s0;
1456
- s1 = peg$c40(s2, s3, s4);
1457
- s0 = s1;
1458
- } else {
1459
- peg$currPos = s0;
1460
- s0 = peg$FAILED;
1461
- }
1462
- } else {
1463
- peg$currPos = s0;
1464
- s0 = peg$FAILED;
1465
- }
1466
- } else {
1467
- peg$currPos = s0;
1468
- s0 = peg$FAILED;
1469
- }
1470
- } else {
1471
- peg$currPos = s0;
1472
- s0 = peg$FAILED;
1473
- }
1474
- } else {
1475
- peg$currPos = s0;
1476
- s0 = peg$FAILED;
1477
- }
1478
- if (s0 === peg$FAILED) {
1479
- s0 = peg$currPos;
1480
- if (input.charCodeAt(peg$currPos) === 34) {
1481
- s1 = peg$c38;
1482
- peg$currPos++;
1483
- } else {
1484
- s1 = peg$FAILED;
1485
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
1486
- }
1487
- if (s1 !== peg$FAILED) {
1488
- s2 = [];
1489
- s3 = peg$parseQuotedCharacter();
1490
- while (s3 !== peg$FAILED) {
1491
- s2.push(s3);
1492
- s3 = peg$parseQuotedCharacter();
1493
- }
1494
- if (s2 !== peg$FAILED) {
1495
- if (input.charCodeAt(peg$currPos) === 34) {
1496
- s3 = peg$c38;
1497
- peg$currPos++;
1498
- } else {
1499
- s3 = peg$FAILED;
1500
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
1501
- }
1502
- if (s3 !== peg$FAILED) {
1503
- peg$savedPos = s0;
1504
- s1 = peg$c41(s2);
1505
- s0 = s1;
1506
- } else {
1507
- peg$currPos = s0;
1508
- s0 = peg$FAILED;
1509
- }
1510
- } else {
1511
- peg$currPos = s0;
1512
- s0 = peg$FAILED;
1513
- }
1514
- } else {
1515
- peg$currPos = s0;
1516
- s0 = peg$FAILED;
1517
- }
1518
- }
1519
-
1520
- return s0;
1521
- }
1522
-
1523
- function peg$parseQuotedCharacter() {
1524
- var s0, s1, s2;
1525
-
1526
- s0 = peg$parseEscapedWhitespace();
1527
- if (s0 === peg$FAILED) {
1528
- s0 = peg$currPos;
1529
- if (input.charCodeAt(peg$currPos) === 92) {
1530
- s1 = peg$c42;
1531
- peg$currPos++;
1532
- } else {
1533
- s1 = peg$FAILED;
1534
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1535
- }
1536
- if (s1 !== peg$FAILED) {
1537
- if (peg$c44.test(input.charAt(peg$currPos))) {
1538
- s2 = input.charAt(peg$currPos);
1539
- peg$currPos++;
1540
- } else {
1541
- s2 = peg$FAILED;
1542
- if (peg$silentFails === 0) { peg$fail(peg$c45); }
1543
- }
1544
- if (s2 !== peg$FAILED) {
1545
- peg$savedPos = s0;
1546
- s1 = peg$c46(s2);
1547
- s0 = s1;
1548
- } else {
1549
- peg$currPos = s0;
1550
- s0 = peg$FAILED;
1551
- }
1552
- } else {
1553
- peg$currPos = s0;
1554
- s0 = peg$FAILED;
1555
- }
1556
- if (s0 === peg$FAILED) {
1557
- s0 = peg$currPos;
1558
- s1 = peg$currPos;
1559
- peg$silentFails++;
1560
- s2 = peg$parseCursor();
1561
- peg$silentFails--;
1562
- if (s2 === peg$FAILED) {
1563
- s1 = void 0;
1564
- } else {
1565
- peg$currPos = s1;
1566
- s1 = peg$FAILED;
1567
- }
1568
- if (s1 !== peg$FAILED) {
1569
- if (peg$c47.test(input.charAt(peg$currPos))) {
1570
- s2 = input.charAt(peg$currPos);
1571
- peg$currPos++;
1572
- } else {
1573
- s2 = peg$FAILED;
1574
- if (peg$silentFails === 0) { peg$fail(peg$c48); }
1575
- }
1576
- if (s2 !== peg$FAILED) {
1577
- peg$savedPos = s0;
1578
- s1 = peg$c46(s2);
1579
- s0 = s1;
1580
- } else {
1581
- peg$currPos = s0;
1582
- s0 = peg$FAILED;
1583
- }
1584
- } else {
1585
- peg$currPos = s0;
1586
- s0 = peg$FAILED;
1587
- }
1588
- }
1589
- }
1590
-
1591
- return s0;
1592
- }
1593
-
1594
- function peg$parseUnquotedLiteral() {
1595
- var s0, s1, s2, s3, s4;
1596
-
1597
- s0 = peg$currPos;
1598
- s1 = [];
1599
- s2 = peg$parseUnquotedCharacter();
1600
- while (s2 !== peg$FAILED) {
1601
- s1.push(s2);
1602
- s2 = peg$parseUnquotedCharacter();
1603
- }
1604
- if (s1 !== peg$FAILED) {
1605
- s2 = peg$parseCursor();
1606
- if (s2 !== peg$FAILED) {
1607
- s3 = [];
1608
- s4 = peg$parseUnquotedCharacter();
1609
- while (s4 !== peg$FAILED) {
1610
- s3.push(s4);
1611
- s4 = peg$parseUnquotedCharacter();
1612
- }
1613
- if (s3 !== peg$FAILED) {
1614
- peg$savedPos = s0;
1615
- s1 = peg$c40(s1, s2, s3);
1616
- s0 = s1;
1617
- } else {
1618
- peg$currPos = s0;
1619
- s0 = peg$FAILED;
1620
- }
1621
- } else {
1622
- peg$currPos = s0;
1623
- s0 = peg$FAILED;
1624
- }
1625
- } else {
1626
- peg$currPos = s0;
1627
- s0 = peg$FAILED;
1628
- }
1629
- if (s0 === peg$FAILED) {
1630
- s0 = peg$currPos;
1631
- s1 = [];
1632
- s2 = peg$parseUnquotedCharacter();
1633
- if (s2 !== peg$FAILED) {
1634
- while (s2 !== peg$FAILED) {
1635
- s1.push(s2);
1636
- s2 = peg$parseUnquotedCharacter();
1637
- }
1638
- } else {
1639
- s1 = peg$FAILED;
1640
- }
1641
- if (s1 !== peg$FAILED) {
1642
- peg$savedPos = s0;
1643
- s1 = peg$c49(s1);
1644
- }
1645
- s0 = s1;
1646
- }
1647
-
1648
- return s0;
1649
- }
1650
-
1651
- function peg$parseUnquotedCharacter() {
1652
- var s0, s1, s2, s3, s4;
1653
-
1654
- s0 = peg$parseEscapedWhitespace();
1655
- if (s0 === peg$FAILED) {
1656
- s0 = peg$parseEscapedSpecialCharacter();
1657
- if (s0 === peg$FAILED) {
1658
- s0 = peg$parseEscapedKeyword();
1659
- if (s0 === peg$FAILED) {
1660
- s0 = peg$parseWildcard();
1661
- if (s0 === peg$FAILED) {
1662
- s0 = peg$currPos;
1663
- s1 = peg$currPos;
1664
- peg$silentFails++;
1665
- s2 = peg$parseSpecialCharacter();
1666
- peg$silentFails--;
1667
- if (s2 === peg$FAILED) {
1668
- s1 = void 0;
1669
- } else {
1670
- peg$currPos = s1;
1671
- s1 = peg$FAILED;
1672
- }
1673
- if (s1 !== peg$FAILED) {
1674
- s2 = peg$currPos;
1675
- peg$silentFails++;
1676
- s3 = peg$parseKeyword();
1677
- peg$silentFails--;
1678
- if (s3 === peg$FAILED) {
1679
- s2 = void 0;
1680
- } else {
1681
- peg$currPos = s2;
1682
- s2 = peg$FAILED;
1683
- }
1684
- if (s2 !== peg$FAILED) {
1685
- s3 = peg$currPos;
1686
- peg$silentFails++;
1687
- s4 = peg$parseCursor();
1688
- peg$silentFails--;
1689
- if (s4 === peg$FAILED) {
1690
- s3 = void 0;
1691
- } else {
1692
- peg$currPos = s3;
1693
- s3 = peg$FAILED;
1694
- }
1695
- if (s3 !== peg$FAILED) {
1696
- if (input.length > peg$currPos) {
1697
- s4 = input.charAt(peg$currPos);
1698
- peg$currPos++;
1699
- } else {
1700
- s4 = peg$FAILED;
1701
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1702
- }
1703
- if (s4 !== peg$FAILED) {
1704
- peg$savedPos = s0;
1705
- s1 = peg$c46(s4);
1706
- s0 = s1;
1707
- } else {
1708
- peg$currPos = s0;
1709
- s0 = peg$FAILED;
1710
- }
1711
- } else {
1712
- peg$currPos = s0;
1713
- s0 = peg$FAILED;
1714
- }
1715
- } else {
1716
- peg$currPos = s0;
1717
- s0 = peg$FAILED;
1718
- }
1719
- } else {
1720
- peg$currPos = s0;
1721
- s0 = peg$FAILED;
1722
- }
1723
- }
1724
- }
1725
- }
1726
- }
1727
-
1728
- return s0;
1729
- }
1730
-
1731
- function peg$parseWildcard() {
1732
- var s0, s1;
1733
-
1734
- s0 = peg$currPos;
1735
- if (input.charCodeAt(peg$currPos) === 42) {
1736
- s1 = peg$c51;
1737
- peg$currPos++;
1738
- } else {
1739
- s1 = peg$FAILED;
1740
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
1741
- }
1742
- if (s1 !== peg$FAILED) {
1743
- peg$savedPos = s0;
1744
- s1 = peg$c53();
1745
- }
1746
- s0 = s1;
1747
-
1748
- return s0;
1749
- }
1750
-
1751
- function peg$parseOptionalSpace() {
1752
- var s0, s1, s2, s3, s4;
1753
-
1754
- s0 = peg$currPos;
1755
- s1 = [];
1756
- s2 = peg$parseSpace();
1757
- while (s2 !== peg$FAILED) {
1758
- s1.push(s2);
1759
- s2 = peg$parseSpace();
1760
- }
1761
- if (s1 !== peg$FAILED) {
1762
- s2 = peg$parseCursor();
1763
- if (s2 !== peg$FAILED) {
1764
- s3 = [];
1765
- s4 = peg$parseSpace();
1766
- while (s4 !== peg$FAILED) {
1767
- s3.push(s4);
1768
- s4 = peg$parseSpace();
1769
- }
1770
- if (s3 !== peg$FAILED) {
1771
- peg$savedPos = s0;
1772
- s1 = peg$c40(s1, s2, s3);
1773
- s0 = s1;
1774
- } else {
1775
- peg$currPos = s0;
1776
- s0 = peg$FAILED;
1777
- }
1778
- } else {
1779
- peg$currPos = s0;
1780
- s0 = peg$FAILED;
1781
- }
1782
- } else {
1783
- peg$currPos = s0;
1784
- s0 = peg$FAILED;
1785
- }
1786
- if (s0 === peg$FAILED) {
1787
- s0 = [];
1788
- s1 = peg$parseSpace();
1789
- while (s1 !== peg$FAILED) {
1790
- s0.push(s1);
1791
- s1 = peg$parseSpace();
1792
- }
1793
- }
1794
-
1795
- return s0;
1796
- }
1797
-
1798
- function peg$parseEscapedWhitespace() {
1799
- var s0, s1;
1800
-
1801
- s0 = peg$currPos;
1802
- if (input.substr(peg$currPos, 2) === peg$c54) {
1803
- s1 = peg$c54;
1804
- peg$currPos += 2;
1805
- } else {
1806
- s1 = peg$FAILED;
1807
- if (peg$silentFails === 0) { peg$fail(peg$c55); }
1808
- }
1809
- if (s1 !== peg$FAILED) {
1810
- peg$savedPos = s0;
1811
- s1 = peg$c56();
1812
- }
1813
- s0 = s1;
1814
- if (s0 === peg$FAILED) {
1815
- s0 = peg$currPos;
1816
- if (input.substr(peg$currPos, 2) === peg$c57) {
1817
- s1 = peg$c57;
1818
- peg$currPos += 2;
1819
- } else {
1820
- s1 = peg$FAILED;
1821
- if (peg$silentFails === 0) { peg$fail(peg$c58); }
1822
- }
1823
- if (s1 !== peg$FAILED) {
1824
- peg$savedPos = s0;
1825
- s1 = peg$c59();
1826
- }
1827
- s0 = s1;
1828
- if (s0 === peg$FAILED) {
1829
- s0 = peg$currPos;
1830
- if (input.substr(peg$currPos, 2) === peg$c60) {
1831
- s1 = peg$c60;
1832
- peg$currPos += 2;
1833
- } else {
1834
- s1 = peg$FAILED;
1835
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
1836
- }
1837
- if (s1 !== peg$FAILED) {
1838
- peg$savedPos = s0;
1839
- s1 = peg$c62();
1840
- }
1841
- s0 = s1;
1842
- }
1843
- }
1844
-
1845
- return s0;
1846
- }
1847
-
1848
- function peg$parseEscapedSpecialCharacter() {
1849
- var s0, s1, s2;
1850
-
1851
- s0 = peg$currPos;
1852
- if (input.charCodeAt(peg$currPos) === 92) {
1853
- s1 = peg$c42;
1854
- peg$currPos++;
1855
- } else {
1856
- s1 = peg$FAILED;
1857
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1858
- }
1859
- if (s1 !== peg$FAILED) {
1860
- s2 = peg$parseSpecialCharacter();
1861
- if (s2 !== peg$FAILED) {
1862
- peg$savedPos = s0;
1863
- s1 = peg$c46(s2);
1864
- s0 = s1;
1865
- } else {
1866
- peg$currPos = s0;
1867
- s0 = peg$FAILED;
1868
- }
1869
- } else {
1870
- peg$currPos = s0;
1871
- s0 = peg$FAILED;
1872
- }
1873
-
1874
- return s0;
1875
- }
1876
-
1877
- function peg$parseEscapedKeyword() {
1878
- var s0, s1, s2;
1879
-
1880
- s0 = peg$currPos;
1881
- if (input.charCodeAt(peg$currPos) === 92) {
1882
- s1 = peg$c42;
1883
- peg$currPos++;
1884
- } else {
1885
- s1 = peg$FAILED;
1886
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1887
- }
1888
- if (s1 !== peg$FAILED) {
1889
- if (input.substr(peg$currPos, 2).toLowerCase() === peg$c29) {
1890
- s2 = input.substr(peg$currPos, 2);
1891
- peg$currPos += 2;
1892
- } else {
1893
- s2 = peg$FAILED;
1894
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
1895
- }
1896
- if (s2 === peg$FAILED) {
1897
- if (input.substr(peg$currPos, 3).toLowerCase() === peg$c32) {
1898
- s2 = input.substr(peg$currPos, 3);
1899
- peg$currPos += 3;
1900
- } else {
1901
- s2 = peg$FAILED;
1902
- if (peg$silentFails === 0) { peg$fail(peg$c33); }
1903
- }
1904
- if (s2 === peg$FAILED) {
1905
- if (input.substr(peg$currPos, 3).toLowerCase() === peg$c35) {
1906
- s2 = input.substr(peg$currPos, 3);
1907
- peg$currPos += 3;
1908
- } else {
1909
- s2 = peg$FAILED;
1910
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
1911
- }
1912
- }
1913
- }
1914
- if (s2 !== peg$FAILED) {
1915
- peg$savedPos = s0;
1916
- s1 = peg$c63(s2);
1917
- s0 = s1;
1918
- } else {
1919
- peg$currPos = s0;
1920
- s0 = peg$FAILED;
1921
- }
1922
- } else {
1923
- peg$currPos = s0;
1924
- s0 = peg$FAILED;
1925
- }
1926
-
1927
- return s0;
1928
- }
1929
-
1930
- function peg$parseKeyword() {
1931
- var s0;
1932
-
1933
- s0 = peg$parseOr();
1934
- if (s0 === peg$FAILED) {
1935
- s0 = peg$parseAnd();
1936
- if (s0 === peg$FAILED) {
1937
- s0 = peg$parseNot();
1938
- }
1939
- }
1940
-
1941
- return s0;
1942
- }
1943
-
1944
- function peg$parseSpecialCharacter() {
1945
- var s0;
1946
-
1947
- if (peg$c64.test(input.charAt(peg$currPos))) {
1948
- s0 = input.charAt(peg$currPos);
1949
- peg$currPos++;
1950
- } else {
1951
- s0 = peg$FAILED;
1952
- if (peg$silentFails === 0) { peg$fail(peg$c65); }
1953
- }
1954
-
1955
- return s0;
1956
- }
1957
-
1958
- function peg$parseRangeOperator() {
1959
- var s0, s1;
1960
-
1961
- s0 = peg$currPos;
1962
- if (input.substr(peg$currPos, 2) === peg$c66) {
1963
- s1 = peg$c66;
1964
- peg$currPos += 2;
1965
- } else {
1966
- s1 = peg$FAILED;
1967
- if (peg$silentFails === 0) { peg$fail(peg$c67); }
1968
- }
1969
- if (s1 !== peg$FAILED) {
1970
- peg$savedPos = s0;
1971
- s1 = peg$c68();
1972
- }
1973
- s0 = s1;
1974
- if (s0 === peg$FAILED) {
1975
- s0 = peg$currPos;
1976
- if (input.substr(peg$currPos, 2) === peg$c69) {
1977
- s1 = peg$c69;
1978
- peg$currPos += 2;
1979
- } else {
1980
- s1 = peg$FAILED;
1981
- if (peg$silentFails === 0) { peg$fail(peg$c70); }
1982
- }
1983
- if (s1 !== peg$FAILED) {
1984
- peg$savedPos = s0;
1985
- s1 = peg$c71();
1986
- }
1987
- s0 = s1;
1988
- if (s0 === peg$FAILED) {
1989
- s0 = peg$currPos;
1990
- if (input.charCodeAt(peg$currPos) === 60) {
1991
- s1 = peg$c72;
1992
- peg$currPos++;
1993
- } else {
1994
- s1 = peg$FAILED;
1995
- if (peg$silentFails === 0) { peg$fail(peg$c73); }
1996
- }
1997
- if (s1 !== peg$FAILED) {
1998
- peg$savedPos = s0;
1999
- s1 = peg$c74();
2000
- }
2001
- s0 = s1;
2002
- if (s0 === peg$FAILED) {
2003
- s0 = peg$currPos;
2004
- if (input.charCodeAt(peg$currPos) === 62) {
2005
- s1 = peg$c75;
2006
- peg$currPos++;
2007
- } else {
2008
- s1 = peg$FAILED;
2009
- if (peg$silentFails === 0) { peg$fail(peg$c76); }
2010
- }
2011
- if (s1 !== peg$FAILED) {
2012
- peg$savedPos = s0;
2013
- s1 = peg$c77();
2014
- }
2015
- s0 = s1;
2016
- }
2017
- }
2018
- }
2019
-
2020
- return s0;
986
+ } else {
987
+ peg$currPos = s0;
988
+ s0 = peg$FAILED;
2021
989
  }
2022
990
 
2023
- function peg$parseSpace() {
2024
- var s0, s1;
991
+ return s0;
992
+ }
2025
993
 
2026
- peg$silentFails++;
2027
- if (peg$c79.test(input.charAt(peg$currPos))) {
2028
- s0 = input.charAt(peg$currPos);
2029
- peg$currPos++;
994
+ function peg$parseFieldMultiGeoSpatialExpression() {
995
+ let s0, s1, s2, s3, s4, s5;
996
+
997
+ s0 = peg$currPos;
998
+ s1 = peg$parseField();
999
+ if (s1 !== peg$FAILED) {
1000
+ s2 = [];
1001
+ s3 = peg$parseSpace();
1002
+ while (s3 !== peg$FAILED) {
1003
+ s2.push(s3);
1004
+ s3 = peg$parseSpace();
1005
+ }
1006
+ s3 = peg$parseGeoSpatialOperator();
1007
+ if (s3 !== peg$FAILED) {
1008
+ s4 = [];
1009
+ s5 = peg$parseSpace();
1010
+ while (s5 !== peg$FAILED) {
1011
+ s4.push(s5);
1012
+ s5 = peg$parseSpace();
1013
+ }
1014
+ s5 = peg$parseListOfValues();
1015
+ if (s5 !== peg$FAILED) {
1016
+ peg$savedPos = s0;
1017
+ s0 = peg$f7(s1, s3, s5);
1018
+ } else {
1019
+ peg$currPos = s0;
1020
+ s0 = peg$FAILED;
1021
+ }
2030
1022
  } else {
1023
+ peg$currPos = s0;
2031
1024
  s0 = peg$FAILED;
2032
- if (peg$silentFails === 0) { peg$fail(peg$c80); }
2033
- }
2034
- peg$silentFails--;
2035
- if (s0 === peg$FAILED) {
2036
- s1 = peg$FAILED;
2037
- if (peg$silentFails === 0) { peg$fail(peg$c78); }
2038
1025
  }
2039
-
2040
- return s0;
1026
+ } else {
1027
+ peg$currPos = s0;
1028
+ s0 = peg$FAILED;
2041
1029
  }
2042
1030
 
2043
- function peg$parseCursor() {
2044
- var s0, s1, s2;
1031
+ return s0;
1032
+ }
1033
+
1034
+ function peg$parseFieldRangeExpression() {
1035
+ let s0, s1, s2, s3, s4, s5;
2045
1036
 
2046
- s0 = peg$currPos;
2047
- peg$savedPos = peg$currPos;
2048
- s1 = peg$c81();
2049
- if (s1) {
2050
- s1 = void 0;
2051
- } else {
2052
- s1 = peg$FAILED;
1037
+ s0 = peg$currPos;
1038
+ s1 = peg$parseField();
1039
+ if (s1 !== peg$FAILED) {
1040
+ s2 = [];
1041
+ s3 = peg$parseSpace();
1042
+ while (s3 !== peg$FAILED) {
1043
+ s2.push(s3);
1044
+ s3 = peg$parseSpace();
2053
1045
  }
2054
- if (s1 !== peg$FAILED) {
2055
- if (input.substr(peg$currPos, 14) === peg$c82) {
2056
- s2 = peg$c82;
2057
- peg$currPos += 14;
2058
- } else {
2059
- s2 = peg$FAILED;
2060
- if (peg$silentFails === 0) { peg$fail(peg$c83); }
1046
+ s3 = peg$parseRangeOperator();
1047
+ if (s3 !== peg$FAILED) {
1048
+ s4 = [];
1049
+ s5 = peg$parseSpace();
1050
+ while (s5 !== peg$FAILED) {
1051
+ s4.push(s5);
1052
+ s5 = peg$parseSpace();
2061
1053
  }
2062
- if (s2 !== peg$FAILED) {
1054
+ s5 = peg$parseNumberOrQuotedString();
1055
+ if (s5 !== peg$FAILED) {
2063
1056
  peg$savedPos = s0;
2064
- s1 = peg$c84();
2065
- s0 = s1;
1057
+ s0 = peg$f8(s1, s3, s5);
2066
1058
  } else {
2067
1059
  peg$currPos = s0;
2068
1060
  s0 = peg$FAILED;
@@ -2071,43 +1063,44 @@ export const {
2071
1063
  peg$currPos = s0;
2072
1064
  s0 = peg$FAILED;
2073
1065
  }
2074
-
2075
- return s0;
1066
+ } else {
1067
+ peg$currPos = s0;
1068
+ s0 = peg$FAILED;
2076
1069
  }
2077
1070
 
2078
- function peg$parseLuceneOr() {
2079
- var s0, s1, s2, s3, s4;
1071
+ return s0;
1072
+ }
2080
1073
 
2081
- s0 = peg$currPos;
2082
- s1 = [];
2083
- s2 = peg$parseSpace();
2084
- while (s2 !== peg$FAILED) {
2085
- s1.push(s2);
2086
- s2 = peg$parseSpace();
1074
+ function peg$parseFieldValueExpression() {
1075
+ let s0, s1, s2, s3, s4, s5;
1076
+
1077
+ s0 = peg$currPos;
1078
+ s1 = peg$parseField();
1079
+ if (s1 !== peg$FAILED) {
1080
+ s2 = [];
1081
+ s3 = peg$parseSpace();
1082
+ while (s3 !== peg$FAILED) {
1083
+ s2.push(s3);
1084
+ s3 = peg$parseSpace();
2087
1085
  }
2088
- if (s1 !== peg$FAILED) {
2089
- if (input.substr(peg$currPos, 2) === peg$c85) {
2090
- s2 = peg$c85;
2091
- peg$currPos += 2;
2092
- } else {
2093
- s2 = peg$FAILED;
2094
- if (peg$silentFails === 0) { peg$fail(peg$c86); }
2095
- }
2096
- if (s2 !== peg$FAILED) {
2097
- s3 = [];
2098
- s4 = peg$parseSpace();
2099
- while (s4 !== peg$FAILED) {
2100
- s3.push(s4);
2101
- s4 = peg$parseSpace();
2102
- }
2103
- if (s3 !== peg$FAILED) {
2104
- peg$savedPos = s0;
2105
- s1 = peg$c87();
2106
- s0 = s1;
2107
- } else {
2108
- peg$currPos = s0;
2109
- s0 = peg$FAILED;
2110
- }
1086
+ if (input.charCodeAt(peg$currPos) === 58) {
1087
+ s3 = peg$c2;
1088
+ peg$currPos++;
1089
+ } else {
1090
+ s3 = peg$FAILED;
1091
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
1092
+ }
1093
+ if (s3 !== peg$FAILED) {
1094
+ s4 = [];
1095
+ s5 = peg$parseSpace();
1096
+ while (s5 !== peg$FAILED) {
1097
+ s4.push(s5);
1098
+ s5 = peg$parseSpace();
1099
+ }
1100
+ s5 = peg$parseListOfValues();
1101
+ if (s5 !== peg$FAILED) {
1102
+ peg$savedPos = s0;
1103
+ s0 = peg$f9(s1, s5);
2111
1104
  } else {
2112
1105
  peg$currPos = s0;
2113
1106
  s0 = peg$FAILED;
@@ -2116,39 +1109,60 @@ export const {
2116
1109
  peg$currPos = s0;
2117
1110
  s0 = peg$FAILED;
2118
1111
  }
1112
+ } else {
1113
+ peg$currPos = s0;
1114
+ s0 = peg$FAILED;
1115
+ }
1116
+
1117
+ return s0;
1118
+ }
1119
+
1120
+ function peg$parseValueExpression() {
1121
+ let s0, s1;
2119
1122
 
2120
- return s0;
1123
+ s0 = peg$currPos;
1124
+ s1 = peg$parseValue();
1125
+ if (s1 !== peg$FAILED) {
1126
+ peg$savedPos = s0;
1127
+ s1 = peg$f10(s1);
2121
1128
  }
1129
+ s0 = s1;
2122
1130
 
2123
- function peg$parseLuceneAnd() {
2124
- var s0, s1, s2, s3, s4;
1131
+ return s0;
1132
+ }
2125
1133
 
2126
- s0 = peg$currPos;
2127
- s1 = [];
2128
- s2 = peg$parseSpace();
2129
- while (s2 !== peg$FAILED) {
2130
- s1.push(s2);
2131
- s2 = peg$parseSpace();
1134
+ function peg$parseListOfValues() {
1135
+ let s0, s1, s2, s3, s4, s5;
1136
+
1137
+ s0 = peg$currPos;
1138
+ if (input.charCodeAt(peg$currPos) === 40) {
1139
+ s1 = peg$c0;
1140
+ peg$currPos++;
1141
+ } else {
1142
+ s1 = peg$FAILED;
1143
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
1144
+ }
1145
+ if (s1 !== peg$FAILED) {
1146
+ s2 = [];
1147
+ s3 = peg$parseSpace();
1148
+ while (s3 !== peg$FAILED) {
1149
+ s2.push(s3);
1150
+ s3 = peg$parseSpace();
2132
1151
  }
2133
- if (s1 !== peg$FAILED) {
2134
- if (input.substr(peg$currPos, 2) === peg$c88) {
2135
- s2 = peg$c88;
2136
- peg$currPos += 2;
2137
- } else {
2138
- s2 = peg$FAILED;
2139
- if (peg$silentFails === 0) { peg$fail(peg$c89); }
2140
- }
2141
- if (s2 !== peg$FAILED) {
2142
- s3 = [];
2143
- s4 = peg$parseSpace();
2144
- while (s4 !== peg$FAILED) {
2145
- s3.push(s4);
2146
- s4 = peg$parseSpace();
1152
+ s3 = peg$parseOrListOfValues();
1153
+ if (s3 !== peg$FAILED) {
1154
+ s4 = peg$parseOptionalSpace();
1155
+ if (s4 !== peg$FAILED) {
1156
+ if (input.charCodeAt(peg$currPos) === 41) {
1157
+ s5 = peg$c1;
1158
+ peg$currPos++;
1159
+ } else {
1160
+ s5 = peg$FAILED;
1161
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
2147
1162
  }
2148
- if (s3 !== peg$FAILED) {
1163
+ if (s5 !== peg$FAILED) {
2149
1164
  peg$savedPos = s0;
2150
- s1 = peg$c90();
2151
- s0 = s1;
1165
+ s0 = peg$f11(s3, s4);
2152
1166
  } else {
2153
1167
  peg$currPos = s0;
2154
1168
  s0 = peg$FAILED;
@@ -2161,118 +1175,170 @@ export const {
2161
1175
  peg$currPos = s0;
2162
1176
  s0 = peg$FAILED;
2163
1177
  }
2164
- if (s0 === peg$FAILED) {
2165
- s0 = peg$currPos;
2166
- if (input.charCodeAt(peg$currPos) === 43) {
2167
- s1 = peg$c91;
2168
- peg$currPos++;
1178
+ } else {
1179
+ peg$currPos = s0;
1180
+ s0 = peg$FAILED;
1181
+ }
1182
+ if (s0 === peg$FAILED) {
1183
+ s0 = peg$parseValue();
1184
+ }
1185
+
1186
+ return s0;
1187
+ }
1188
+
1189
+ function peg$parseOrListOfValues() {
1190
+ let s0, s1, s2, s3;
1191
+
1192
+ s0 = peg$currPos;
1193
+ s1 = peg$parseAndListOfValues();
1194
+ if (s1 !== peg$FAILED) {
1195
+ s2 = peg$parseOr();
1196
+ if (s2 !== peg$FAILED) {
1197
+ s3 = peg$parseOrListOfValues();
1198
+ if (s3 !== peg$FAILED) {
1199
+ peg$savedPos = s0;
1200
+ s0 = peg$f12(s1, s3);
2169
1201
  } else {
2170
- s1 = peg$FAILED;
2171
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
1202
+ peg$currPos = s0;
1203
+ s0 = peg$FAILED;
2172
1204
  }
2173
- if (s1 !== peg$FAILED) {
1205
+ } else {
1206
+ peg$currPos = s0;
1207
+ s0 = peg$FAILED;
1208
+ }
1209
+ } else {
1210
+ peg$currPos = s0;
1211
+ s0 = peg$FAILED;
1212
+ }
1213
+ if (s0 === peg$FAILED) {
1214
+ s0 = peg$parseAndListOfValues();
1215
+ }
1216
+
1217
+ return s0;
1218
+ }
1219
+
1220
+ function peg$parseAndListOfValues() {
1221
+ let s0, s1, s2, s3;
1222
+
1223
+ s0 = peg$currPos;
1224
+ s1 = peg$parseNotListOfValues();
1225
+ if (s1 !== peg$FAILED) {
1226
+ s2 = peg$parseAnd();
1227
+ if (s2 !== peg$FAILED) {
1228
+ s3 = peg$parseAndListOfValues();
1229
+ if (s3 !== peg$FAILED) {
2174
1230
  peg$savedPos = s0;
2175
- s1 = peg$c90();
1231
+ s0 = peg$f13(s1, s3);
1232
+ } else {
1233
+ peg$currPos = s0;
1234
+ s0 = peg$FAILED;
2176
1235
  }
2177
- s0 = s1;
1236
+ } else {
1237
+ peg$currPos = s0;
1238
+ s0 = peg$FAILED;
2178
1239
  }
2179
-
2180
- return s0;
1240
+ } else {
1241
+ peg$currPos = s0;
1242
+ s0 = peg$FAILED;
1243
+ }
1244
+ if (s0 === peg$FAILED) {
1245
+ s0 = peg$parseNotListOfValues();
2181
1246
  }
2182
1247
 
2183
- function peg$parseLuceneNot() {
2184
- var s0, s1;
1248
+ return s0;
1249
+ }
2185
1250
 
2186
- s0 = peg$currPos;
2187
- if (input.charCodeAt(peg$currPos) === 45) {
2188
- s1 = peg$c93;
2189
- peg$currPos++;
1251
+ function peg$parseNotListOfValues() {
1252
+ let s0, s1, s2;
1253
+
1254
+ s0 = peg$currPos;
1255
+ s1 = peg$parseNot();
1256
+ if (s1 !== peg$FAILED) {
1257
+ s2 = peg$parseListOfValues();
1258
+ if (s2 !== peg$FAILED) {
1259
+ peg$savedPos = s0;
1260
+ s0 = peg$f14(s2);
2190
1261
  } else {
2191
- s1 = peg$FAILED;
2192
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
1262
+ peg$currPos = s0;
1263
+ s0 = peg$FAILED;
2193
1264
  }
1265
+ } else {
1266
+ peg$currPos = s0;
1267
+ s0 = peg$FAILED;
1268
+ }
1269
+ if (s0 === peg$FAILED) {
1270
+ s0 = peg$parseListOfValues();
1271
+ }
1272
+
1273
+ return s0;
1274
+ }
1275
+
1276
+ function peg$parseValue() {
1277
+ let s0, s1;
1278
+
1279
+ peg$silentFails++;
1280
+ s0 = peg$currPos;
1281
+ s1 = peg$parseQuotedString();
1282
+ if (s1 !== peg$FAILED) {
1283
+ peg$savedPos = s0;
1284
+ s1 = peg$f15(s1);
1285
+ }
1286
+ s0 = s1;
1287
+ if (s0 === peg$FAILED) {
1288
+ s0 = peg$currPos;
1289
+ s1 = peg$parseUnquotedLiteral();
2194
1290
  if (s1 !== peg$FAILED) {
2195
1291
  peg$savedPos = s0;
2196
- s1 = peg$c95();
1292
+ s1 = peg$f16(s1);
2197
1293
  }
2198
1294
  s0 = s1;
2199
- if (s0 === peg$FAILED) {
2200
- s0 = peg$currPos;
2201
- if (input.charCodeAt(peg$currPos) === 33) {
2202
- s1 = peg$c96;
2203
- peg$currPos++;
2204
- } else {
2205
- s1 = peg$FAILED;
2206
- if (peg$silentFails === 0) { peg$fail(peg$c97); }
2207
- }
2208
- if (s1 !== peg$FAILED) {
2209
- peg$savedPos = s0;
2210
- s1 = peg$c95();
2211
- }
2212
- s0 = s1;
2213
- }
2214
-
2215
- return s0;
1295
+ }
1296
+ peg$silentFails--;
1297
+ if (s0 === peg$FAILED) {
1298
+ s1 = peg$FAILED;
1299
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
2216
1300
  }
2217
1301
 
2218
- function peg$parseLuceneQuery() {
2219
- var s0;
1302
+ return s0;
1303
+ }
2220
1304
 
2221
- s0 = peg$parseLuceneFieldQuery();
2222
- if (s0 === peg$FAILED) {
2223
- s0 = peg$parseLuceneValue();
2224
- if (s0 === peg$FAILED) {
2225
- s0 = peg$parseLuceneExists();
2226
- }
2227
- }
1305
+ function peg$parseOr() {
1306
+ let s0, s1, s2, s3, s4;
2228
1307
 
2229
- return s0;
1308
+ peg$silentFails++;
1309
+ s0 = peg$currPos;
1310
+ s1 = [];
1311
+ s2 = peg$parseSpace();
1312
+ if (s2 !== peg$FAILED) {
1313
+ while (s2 !== peg$FAILED) {
1314
+ s1.push(s2);
1315
+ s2 = peg$parseSpace();
1316
+ }
1317
+ } else {
1318
+ s1 = peg$FAILED;
2230
1319
  }
2231
-
2232
- function peg$parseLuceneFieldQuery() {
2233
- var s0, s1, s2, s3, s4, s5;
2234
-
2235
- s0 = peg$currPos;
2236
- s1 = peg$parseLuceneLiteral();
2237
- if (s1 !== peg$FAILED) {
2238
- s2 = [];
2239
- s3 = peg$parseSpace();
2240
- while (s3 !== peg$FAILED) {
2241
- s2.push(s3);
2242
- s3 = peg$parseSpace();
2243
- }
2244
- if (s2 !== peg$FAILED) {
2245
- if (input.charCodeAt(peg$currPos) === 58) {
2246
- s3 = peg$c10;
2247
- peg$currPos++;
2248
- } else {
2249
- s3 = peg$FAILED;
2250
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
2251
- }
2252
- if (s3 !== peg$FAILED) {
2253
- s4 = [];
2254
- s5 = peg$parseSpace();
2255
- while (s5 !== peg$FAILED) {
2256
- s4.push(s5);
2257
- s5 = peg$parseSpace();
2258
- }
2259
- if (s4 !== peg$FAILED) {
2260
- s5 = peg$parseLuceneValue();
2261
- if (s5 !== peg$FAILED) {
2262
- s1 = [s1, s2, s3, s4, s5];
2263
- s0 = s1;
2264
- } else {
2265
- peg$currPos = s0;
2266
- s0 = peg$FAILED;
2267
- }
2268
- } else {
2269
- peg$currPos = s0;
2270
- s0 = peg$FAILED;
2271
- }
2272
- } else {
2273
- peg$currPos = s0;
2274
- s0 = peg$FAILED;
1320
+ if (s1 !== peg$FAILED) {
1321
+ s2 = input.substr(peg$currPos, 2);
1322
+ if (s2.toLowerCase() === peg$c5) {
1323
+ peg$currPos += (2);
1324
+ } else {
1325
+ s2 = peg$FAILED;
1326
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
1327
+ }
1328
+ if (s2 !== peg$FAILED) {
1329
+ s3 = [];
1330
+ s4 = peg$parseSpace();
1331
+ if (s4 !== peg$FAILED) {
1332
+ while (s4 !== peg$FAILED) {
1333
+ s3.push(s4);
1334
+ s4 = peg$parseSpace();
2275
1335
  }
1336
+ } else {
1337
+ s3 = peg$FAILED;
1338
+ }
1339
+ if (s3 !== peg$FAILED) {
1340
+ s1 = [s1, s2, s3];
1341
+ s0 = s1;
2276
1342
  } else {
2277
1343
  peg$currPos = s0;
2278
1344
  s0 = peg$FAILED;
@@ -2281,84 +1347,56 @@ export const {
2281
1347
  peg$currPos = s0;
2282
1348
  s0 = peg$FAILED;
2283
1349
  }
2284
-
2285
- return s0;
1350
+ } else {
1351
+ peg$currPos = s0;
1352
+ s0 = peg$FAILED;
1353
+ }
1354
+ peg$silentFails--;
1355
+ if (s0 === peg$FAILED) {
1356
+ s1 = peg$FAILED;
1357
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
2286
1358
  }
2287
1359
 
2288
- function peg$parseLuceneValue() {
2289
- var s0;
1360
+ return s0;
1361
+ }
2290
1362
 
2291
- s0 = peg$parseLuceneRange();
2292
- if (s0 === peg$FAILED) {
2293
- s0 = peg$parseLuceneWildcard();
2294
- if (s0 === peg$FAILED) {
2295
- s0 = peg$parseLuceneRegex();
2296
- if (s0 === peg$FAILED) {
2297
- s0 = peg$parseLuceneFuzzy();
2298
- if (s0 === peg$FAILED) {
2299
- s0 = peg$parseLuceneProximity();
2300
- if (s0 === peg$FAILED) {
2301
- s0 = peg$parseLuceneBoost();
2302
- }
2303
- }
2304
- }
2305
- }
2306
- }
1363
+ function peg$parseAnd() {
1364
+ let s0, s1, s2, s3, s4;
2307
1365
 
2308
- return s0;
1366
+ peg$silentFails++;
1367
+ s0 = peg$currPos;
1368
+ s1 = [];
1369
+ s2 = peg$parseSpace();
1370
+ if (s2 !== peg$FAILED) {
1371
+ while (s2 !== peg$FAILED) {
1372
+ s1.push(s2);
1373
+ s2 = peg$parseSpace();
1374
+ }
1375
+ } else {
1376
+ s1 = peg$FAILED;
2309
1377
  }
2310
-
2311
- function peg$parseLuceneExists() {
2312
- var s0, s1, s2, s3, s4, s5;
2313
-
2314
- s0 = peg$currPos;
2315
- if (input.substr(peg$currPos, 8) === peg$c98) {
2316
- s1 = peg$c98;
2317
- peg$currPos += 8;
1378
+ if (s1 !== peg$FAILED) {
1379
+ s2 = input.substr(peg$currPos, 3);
1380
+ if (s2.toLowerCase() === peg$c6) {
1381
+ peg$currPos += (3);
2318
1382
  } else {
2319
- s1 = peg$FAILED;
2320
- if (peg$silentFails === 0) { peg$fail(peg$c99); }
1383
+ s2 = peg$FAILED;
1384
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
2321
1385
  }
2322
- if (s1 !== peg$FAILED) {
2323
- s2 = [];
2324
- s3 = peg$parseSpace();
2325
- while (s3 !== peg$FAILED) {
2326
- s2.push(s3);
2327
- s3 = peg$parseSpace();
2328
- }
2329
- if (s2 !== peg$FAILED) {
2330
- if (input.charCodeAt(peg$currPos) === 58) {
2331
- s3 = peg$c10;
2332
- peg$currPos++;
2333
- } else {
2334
- s3 = peg$FAILED;
2335
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
2336
- }
2337
- if (s3 !== peg$FAILED) {
2338
- s4 = [];
2339
- s5 = peg$parseSpace();
2340
- while (s5 !== peg$FAILED) {
2341
- s4.push(s5);
2342
- s5 = peg$parseSpace();
2343
- }
2344
- if (s4 !== peg$FAILED) {
2345
- s5 = peg$parseLuceneLiteral();
2346
- if (s5 !== peg$FAILED) {
2347
- peg$savedPos = s0;
2348
- s1 = peg$c100();
2349
- s0 = s1;
2350
- } else {
2351
- peg$currPos = s0;
2352
- s0 = peg$FAILED;
2353
- }
2354
- } else {
2355
- peg$currPos = s0;
2356
- s0 = peg$FAILED;
2357
- }
2358
- } else {
2359
- peg$currPos = s0;
2360
- s0 = peg$FAILED;
1386
+ if (s2 !== peg$FAILED) {
1387
+ s3 = [];
1388
+ s4 = peg$parseSpace();
1389
+ if (s4 !== peg$FAILED) {
1390
+ while (s4 !== peg$FAILED) {
1391
+ s3.push(s4);
1392
+ s4 = peg$parseSpace();
2361
1393
  }
1394
+ } else {
1395
+ s3 = peg$FAILED;
1396
+ }
1397
+ if (s3 !== peg$FAILED) {
1398
+ s1 = [s1, s2, s3];
1399
+ s0 = s1;
2362
1400
  } else {
2363
1401
  peg$currPos = s0;
2364
1402
  s0 = peg$FAILED;
@@ -2367,142 +1405,216 @@ export const {
2367
1405
  peg$currPos = s0;
2368
1406
  s0 = peg$FAILED;
2369
1407
  }
2370
-
2371
- return s0;
1408
+ } else {
1409
+ peg$currPos = s0;
1410
+ s0 = peg$FAILED;
1411
+ }
1412
+ peg$silentFails--;
1413
+ if (s0 === peg$FAILED) {
1414
+ s1 = peg$FAILED;
1415
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
2372
1416
  }
2373
1417
 
2374
- function peg$parseLuceneRange() {
2375
- var s0, s1, s2, s3, s4, s5, s6;
1418
+ return s0;
1419
+ }
2376
1420
 
2377
- s0 = peg$currPos;
2378
- s1 = peg$parseRangeOperator();
2379
- if (s1 !== peg$FAILED) {
2380
- s2 = [];
2381
- s3 = peg$parseSpace();
1421
+ function peg$parseNot() {
1422
+ let s0, s1, s2, s3;
1423
+
1424
+ peg$silentFails++;
1425
+ s0 = peg$currPos;
1426
+ s1 = input.substr(peg$currPos, 3);
1427
+ if (s1.toLowerCase() === peg$c7) {
1428
+ peg$currPos += (3);
1429
+ } else {
1430
+ s1 = peg$FAILED;
1431
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1432
+ }
1433
+ if (s1 !== peg$FAILED) {
1434
+ s2 = [];
1435
+ s3 = peg$parseSpace();
1436
+ if (s3 !== peg$FAILED) {
2382
1437
  while (s3 !== peg$FAILED) {
2383
1438
  s2.push(s3);
2384
1439
  s3 = peg$parseSpace();
2385
1440
  }
2386
- if (s2 !== peg$FAILED) {
2387
- s3 = peg$parseLuceneLiteral();
2388
- if (s3 !== peg$FAILED) {
2389
- peg$savedPos = s0;
2390
- s1 = peg$c101();
2391
- s0 = s1;
2392
- } else {
2393
- peg$currPos = s0;
2394
- s0 = peg$FAILED;
2395
- }
2396
- } else {
2397
- peg$currPos = s0;
2398
- s0 = peg$FAILED;
2399
- }
1441
+ } else {
1442
+ s2 = peg$FAILED;
1443
+ }
1444
+ if (s2 !== peg$FAILED) {
1445
+ s1 = [s1, s2];
1446
+ s0 = s1;
2400
1447
  } else {
2401
1448
  peg$currPos = s0;
2402
1449
  s0 = peg$FAILED;
2403
1450
  }
2404
- if (s0 === peg$FAILED) {
2405
- s0 = peg$currPos;
2406
- s1 = peg$parseLuceneRangeStart();
2407
- if (s1 !== peg$FAILED) {
2408
- s2 = [];
2409
- s3 = peg$parseSpace();
2410
- while (s3 !== peg$FAILED) {
2411
- s2.push(s3);
2412
- s3 = peg$parseSpace();
2413
- }
2414
- if (s2 !== peg$FAILED) {
2415
- s3 = peg$parseLuceneLiteral();
2416
- if (s3 !== peg$FAILED) {
2417
- s4 = peg$parseLuceneTo();
2418
- if (s4 !== peg$FAILED) {
2419
- s5 = peg$parseLuceneLiteral();
2420
- if (s5 !== peg$FAILED) {
2421
- s6 = peg$parseLuceneRangeEnd();
2422
- if (s6 !== peg$FAILED) {
2423
- peg$savedPos = s0;
2424
- s1 = peg$c101();
2425
- s0 = s1;
2426
- } else {
2427
- peg$currPos = s0;
2428
- s0 = peg$FAILED;
2429
- }
2430
- } else {
2431
- peg$currPos = s0;
2432
- s0 = peg$FAILED;
2433
- }
2434
- } else {
2435
- peg$currPos = s0;
2436
- s0 = peg$FAILED;
2437
- }
1451
+ } else {
1452
+ peg$currPos = s0;
1453
+ s0 = peg$FAILED;
1454
+ }
1455
+ peg$silentFails--;
1456
+ if (s0 === peg$FAILED) {
1457
+ s1 = peg$FAILED;
1458
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1459
+ }
1460
+
1461
+ return s0;
1462
+ }
1463
+
1464
+ function peg$parseLiteral() {
1465
+ let s0, s1;
1466
+
1467
+ peg$silentFails++;
1468
+ s0 = peg$parseQuotedString();
1469
+ if (s0 === peg$FAILED) {
1470
+ s0 = peg$parseUnquotedLiteral();
1471
+ }
1472
+ peg$silentFails--;
1473
+ if (s0 === peg$FAILED) {
1474
+ s1 = peg$FAILED;
1475
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1476
+ }
1477
+
1478
+ return s0;
1479
+ }
1480
+
1481
+ function peg$parseNumber() {
1482
+ let s0;
1483
+
1484
+ s0 = peg$parseFloat();
1485
+ if (s0 === peg$FAILED) {
1486
+ s0 = peg$parseInteger();
1487
+ }
1488
+
1489
+ return s0;
1490
+ }
1491
+
1492
+ function peg$parseFloat() {
1493
+ let s0, s1, s2, s3, s4;
1494
+
1495
+ s0 = peg$currPos;
1496
+ s1 = peg$parseInteger();
1497
+ if (s1 !== peg$FAILED) {
1498
+ if (input.charCodeAt(peg$currPos) === 46) {
1499
+ s2 = peg$c8;
1500
+ peg$currPos++;
1501
+ } else {
1502
+ s2 = peg$FAILED;
1503
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1504
+ }
1505
+ if (s2 !== peg$FAILED) {
1506
+ s3 = [];
1507
+ s4 = input.charAt(peg$currPos);
1508
+ if (peg$r0.test(s4)) {
1509
+ peg$currPos++;
1510
+ } else {
1511
+ s4 = peg$FAILED;
1512
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1513
+ }
1514
+ if (s4 !== peg$FAILED) {
1515
+ while (s4 !== peg$FAILED) {
1516
+ s3.push(s4);
1517
+ s4 = input.charAt(peg$currPos);
1518
+ if (peg$r0.test(s4)) {
1519
+ peg$currPos++;
2438
1520
  } else {
2439
- peg$currPos = s0;
2440
- s0 = peg$FAILED;
1521
+ s4 = peg$FAILED;
1522
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
2441
1523
  }
2442
- } else {
2443
- peg$currPos = s0;
2444
- s0 = peg$FAILED;
2445
1524
  }
1525
+ } else {
1526
+ s3 = peg$FAILED;
1527
+ }
1528
+ if (s3 !== peg$FAILED) {
1529
+ peg$savedPos = s0;
1530
+ s0 = peg$f17();
2446
1531
  } else {
2447
1532
  peg$currPos = s0;
2448
1533
  s0 = peg$FAILED;
2449
1534
  }
1535
+ } else {
1536
+ peg$currPos = s0;
1537
+ s0 = peg$FAILED;
2450
1538
  }
2451
-
2452
- return s0;
1539
+ } else {
1540
+ peg$currPos = s0;
1541
+ s0 = peg$FAILED;
2453
1542
  }
2454
1543
 
2455
- function peg$parseLuceneWildcard() {
2456
- var s0, s1, s2, s3, s4;
1544
+ return s0;
1545
+ }
2457
1546
 
2458
- s0 = peg$currPos;
2459
- s1 = [];
2460
- s2 = peg$parseLuceneUnquotedCharacter();
2461
- if (s2 === peg$FAILED) {
2462
- if (input.charCodeAt(peg$currPos) === 42) {
2463
- s2 = peg$c51;
1547
+ function peg$parseInteger() {
1548
+ let s0, s1, s2;
1549
+
1550
+ s0 = peg$currPos;
1551
+ s1 = [];
1552
+ s2 = input.charAt(peg$currPos);
1553
+ if (peg$r0.test(s2)) {
1554
+ peg$currPos++;
1555
+ } else {
1556
+ s2 = peg$FAILED;
1557
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1558
+ }
1559
+ if (s2 !== peg$FAILED) {
1560
+ while (s2 !== peg$FAILED) {
1561
+ s1.push(s2);
1562
+ s2 = input.charAt(peg$currPos);
1563
+ if (peg$r0.test(s2)) {
2464
1564
  peg$currPos++;
2465
1565
  } else {
2466
1566
  s2 = peg$FAILED;
2467
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
1567
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
2468
1568
  }
2469
1569
  }
2470
- while (s2 !== peg$FAILED) {
2471
- s1.push(s2);
2472
- s2 = peg$parseLuceneUnquotedCharacter();
2473
- if (s2 === peg$FAILED) {
2474
- if (input.charCodeAt(peg$currPos) === 42) {
2475
- s2 = peg$c51;
2476
- peg$currPos++;
2477
- } else {
2478
- s2 = peg$FAILED;
2479
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
2480
- }
2481
- }
1570
+ } else {
1571
+ s1 = peg$FAILED;
1572
+ }
1573
+ if (s1 !== peg$FAILED) {
1574
+ peg$savedPos = s0;
1575
+ s1 = peg$f18();
1576
+ }
1577
+ s0 = s1;
1578
+
1579
+ return s0;
1580
+ }
1581
+
1582
+ function peg$parseQuotedString() {
1583
+ let s0, s1, s2, s3, s4, s5;
1584
+
1585
+ s0 = peg$currPos;
1586
+ if (input.charCodeAt(peg$currPos) === 34) {
1587
+ s1 = peg$c9;
1588
+ peg$currPos++;
1589
+ } else {
1590
+ s1 = peg$FAILED;
1591
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1592
+ }
1593
+ if (s1 !== peg$FAILED) {
1594
+ s2 = [];
1595
+ s3 = peg$parseQuotedCharacter();
1596
+ while (s3 !== peg$FAILED) {
1597
+ s2.push(s3);
1598
+ s3 = peg$parseQuotedCharacter();
2482
1599
  }
2483
- if (s1 !== peg$FAILED) {
2484
- if (input.charCodeAt(peg$currPos) === 63) {
2485
- s2 = peg$c102;
1600
+ s3 = peg$parseCursor();
1601
+ if (s3 !== peg$FAILED) {
1602
+ s4 = [];
1603
+ s5 = peg$parseQuotedCharacter();
1604
+ while (s5 !== peg$FAILED) {
1605
+ s4.push(s5);
1606
+ s5 = peg$parseQuotedCharacter();
1607
+ }
1608
+ if (input.charCodeAt(peg$currPos) === 34) {
1609
+ s5 = peg$c9;
2486
1610
  peg$currPos++;
2487
1611
  } else {
2488
- s2 = peg$FAILED;
2489
- if (peg$silentFails === 0) { peg$fail(peg$c103); }
1612
+ s5 = peg$FAILED;
1613
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
2490
1614
  }
2491
- if (s2 !== peg$FAILED) {
2492
- s3 = [];
2493
- s4 = peg$parseLuceneWildcard();
2494
- while (s4 !== peg$FAILED) {
2495
- s3.push(s4);
2496
- s4 = peg$parseLuceneWildcard();
2497
- }
2498
- if (s3 !== peg$FAILED) {
2499
- peg$savedPos = s0;
2500
- s1 = peg$c104();
2501
- s0 = s1;
2502
- } else {
2503
- peg$currPos = s0;
2504
- s0 = peg$FAILED;
2505
- }
1615
+ if (s5 !== peg$FAILED) {
1616
+ peg$savedPos = s0;
1617
+ s0 = peg$f19(s2, s3, s4);
2506
1618
  } else {
2507
1619
  peg$currPos = s0;
2508
1620
  s0 = peg$FAILED;
@@ -2511,56 +1623,36 @@ export const {
2511
1623
  peg$currPos = s0;
2512
1624
  s0 = peg$FAILED;
2513
1625
  }
2514
-
2515
- return s0;
1626
+ } else {
1627
+ peg$currPos = s0;
1628
+ s0 = peg$FAILED;
2516
1629
  }
2517
-
2518
- function peg$parseLuceneRegex() {
2519
- var s0, s1, s2, s3;
2520
-
1630
+ if (s0 === peg$FAILED) {
2521
1631
  s0 = peg$currPos;
2522
- if (input.charCodeAt(peg$currPos) === 47) {
2523
- s1 = peg$c105;
1632
+ if (input.charCodeAt(peg$currPos) === 34) {
1633
+ s1 = peg$c9;
2524
1634
  peg$currPos++;
2525
1635
  } else {
2526
1636
  s1 = peg$FAILED;
2527
- if (peg$silentFails === 0) { peg$fail(peg$c106); }
1637
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
2528
1638
  }
2529
1639
  if (s1 !== peg$FAILED) {
2530
1640
  s2 = [];
2531
- if (peg$c107.test(input.charAt(peg$currPos))) {
2532
- s3 = input.charAt(peg$currPos);
1641
+ s3 = peg$parseQuotedCharacter();
1642
+ while (s3 !== peg$FAILED) {
1643
+ s2.push(s3);
1644
+ s3 = peg$parseQuotedCharacter();
1645
+ }
1646
+ if (input.charCodeAt(peg$currPos) === 34) {
1647
+ s3 = peg$c9;
2533
1648
  peg$currPos++;
2534
1649
  } else {
2535
1650
  s3 = peg$FAILED;
2536
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
2537
- }
2538
- while (s3 !== peg$FAILED) {
2539
- s2.push(s3);
2540
- if (peg$c107.test(input.charAt(peg$currPos))) {
2541
- s3 = input.charAt(peg$currPos);
2542
- peg$currPos++;
2543
- } else {
2544
- s3 = peg$FAILED;
2545
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
2546
- }
1651
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
2547
1652
  }
2548
- if (s2 !== peg$FAILED) {
2549
- if (input.charCodeAt(peg$currPos) === 47) {
2550
- s3 = peg$c105;
2551
- peg$currPos++;
2552
- } else {
2553
- s3 = peg$FAILED;
2554
- if (peg$silentFails === 0) { peg$fail(peg$c106); }
2555
- }
2556
- if (s3 !== peg$FAILED) {
2557
- peg$savedPos = s0;
2558
- s1 = peg$c109();
2559
- s0 = s1;
2560
- } else {
2561
- peg$currPos = s0;
2562
- s0 = peg$FAILED;
2563
- }
1653
+ if (s3 !== peg$FAILED) {
1654
+ peg$savedPos = s0;
1655
+ s0 = peg$f20(s2);
2564
1656
  } else {
2565
1657
  peg$currPos = s0;
2566
1658
  s0 = peg$FAILED;
@@ -2569,102 +1661,49 @@ export const {
2569
1661
  peg$currPos = s0;
2570
1662
  s0 = peg$FAILED;
2571
1663
  }
2572
-
2573
- return s0;
2574
1664
  }
2575
1665
 
2576
- function peg$parseLuceneFuzzy() {
2577
- var s0, s1, s2, s3, s4;
1666
+ return s0;
1667
+ }
2578
1668
 
2579
- s0 = peg$currPos;
2580
- s1 = peg$parseLuceneUnquotedLiteral();
2581
- if (s1 !== peg$FAILED) {
2582
- if (input.charCodeAt(peg$currPos) === 126) {
2583
- s2 = peg$c110;
2584
- peg$currPos++;
2585
- } else {
2586
- s2 = peg$FAILED;
2587
- if (peg$silentFails === 0) { peg$fail(peg$c111); }
2588
- }
2589
- if (s2 !== peg$FAILED) {
2590
- s3 = [];
2591
- if (peg$c112.test(input.charAt(peg$currPos))) {
2592
- s4 = input.charAt(peg$currPos);
2593
- peg$currPos++;
2594
- } else {
2595
- s4 = peg$FAILED;
2596
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2597
- }
2598
- while (s4 !== peg$FAILED) {
2599
- s3.push(s4);
2600
- if (peg$c112.test(input.charAt(peg$currPos))) {
2601
- s4 = input.charAt(peg$currPos);
2602
- peg$currPos++;
2603
- } else {
2604
- s4 = peg$FAILED;
2605
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2606
- }
2607
- }
2608
- if (s3 !== peg$FAILED) {
2609
- peg$savedPos = s0;
2610
- s1 = peg$c114();
2611
- s0 = s1;
2612
- } else {
2613
- peg$currPos = s0;
2614
- s0 = peg$FAILED;
2615
- }
2616
- } else {
2617
- peg$currPos = s0;
2618
- s0 = peg$FAILED;
2619
- }
2620
- } else {
2621
- peg$currPos = s0;
2622
- s0 = peg$FAILED;
2623
- }
1669
+ function peg$parseNumberOrQuotedString() {
1670
+ let s0;
2624
1671
 
2625
- return s0;
1672
+ s0 = peg$parseNumber();
1673
+ if (s0 === peg$FAILED) {
1674
+ s0 = peg$parseQuotedString();
1675
+ if (s0 === peg$FAILED) {
1676
+ s0 = peg$parseOptionalSpace();
1677
+ }
2626
1678
  }
2627
1679
 
2628
- function peg$parseLuceneProximity() {
2629
- var s0, s1, s2, s3, s4;
1680
+ return s0;
1681
+ }
1682
+
1683
+ function peg$parseQuotedCharacter() {
1684
+ let s0, s1, s2;
2630
1685
 
1686
+ s0 = peg$parseEscapedWhitespace();
1687
+ if (s0 === peg$FAILED) {
2631
1688
  s0 = peg$currPos;
2632
- s1 = peg$parseQuotedString();
1689
+ if (input.charCodeAt(peg$currPos) === 92) {
1690
+ s1 = peg$c10;
1691
+ peg$currPos++;
1692
+ } else {
1693
+ s1 = peg$FAILED;
1694
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1695
+ }
2633
1696
  if (s1 !== peg$FAILED) {
2634
- if (input.charCodeAt(peg$currPos) === 126) {
2635
- s2 = peg$c110;
1697
+ s2 = input.charAt(peg$currPos);
1698
+ if (peg$r1.test(s2)) {
2636
1699
  peg$currPos++;
2637
1700
  } else {
2638
1701
  s2 = peg$FAILED;
2639
- if (peg$silentFails === 0) { peg$fail(peg$c111); }
1702
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
2640
1703
  }
2641
1704
  if (s2 !== peg$FAILED) {
2642
- s3 = [];
2643
- if (peg$c112.test(input.charAt(peg$currPos))) {
2644
- s4 = input.charAt(peg$currPos);
2645
- peg$currPos++;
2646
- } else {
2647
- s4 = peg$FAILED;
2648
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2649
- }
2650
- while (s4 !== peg$FAILED) {
2651
- s3.push(s4);
2652
- if (peg$c112.test(input.charAt(peg$currPos))) {
2653
- s4 = input.charAt(peg$currPos);
2654
- peg$currPos++;
2655
- } else {
2656
- s4 = peg$FAILED;
2657
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2658
- }
2659
- }
2660
- if (s3 !== peg$FAILED) {
2661
- peg$savedPos = s0;
2662
- s1 = peg$c115();
2663
- s0 = s1;
2664
- } else {
2665
- peg$currPos = s0;
2666
- s0 = peg$FAILED;
2667
- }
1705
+ peg$savedPos = s0;
1706
+ s0 = peg$f21(s2);
2668
1707
  } else {
2669
1708
  peg$currPos = s0;
2670
1709
  s0 = peg$FAILED;
@@ -2673,46 +1712,29 @@ export const {
2673
1712
  peg$currPos = s0;
2674
1713
  s0 = peg$FAILED;
2675
1714
  }
2676
-
2677
- return s0;
2678
- }
2679
-
2680
- function peg$parseLuceneBoost() {
2681
- var s0, s1, s2, s3, s4;
2682
-
2683
- s0 = peg$currPos;
2684
- s1 = peg$parseLuceneLiteral();
2685
- if (s1 !== peg$FAILED) {
2686
- if (input.charCodeAt(peg$currPos) === 94) {
2687
- s2 = peg$c116;
2688
- peg$currPos++;
1715
+ if (s0 === peg$FAILED) {
1716
+ s0 = peg$currPos;
1717
+ s1 = peg$currPos;
1718
+ peg$silentFails++;
1719
+ s2 = peg$parseCursor();
1720
+ peg$silentFails--;
1721
+ if (s2 === peg$FAILED) {
1722
+ s1 = undefined;
2689
1723
  } else {
2690
- s2 = peg$FAILED;
2691
- if (peg$silentFails === 0) { peg$fail(peg$c117); }
1724
+ peg$currPos = s1;
1725
+ s1 = peg$FAILED;
2692
1726
  }
2693
- if (s2 !== peg$FAILED) {
2694
- s3 = [];
2695
- if (peg$c112.test(input.charAt(peg$currPos))) {
2696
- s4 = input.charAt(peg$currPos);
1727
+ if (s1 !== peg$FAILED) {
1728
+ s2 = input.charAt(peg$currPos);
1729
+ if (peg$r2.test(s2)) {
2697
1730
  peg$currPos++;
2698
1731
  } else {
2699
- s4 = peg$FAILED;
2700
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2701
- }
2702
- while (s4 !== peg$FAILED) {
2703
- s3.push(s4);
2704
- if (peg$c112.test(input.charAt(peg$currPos))) {
2705
- s4 = input.charAt(peg$currPos);
2706
- peg$currPos++;
2707
- } else {
2708
- s4 = peg$FAILED;
2709
- if (peg$silentFails === 0) { peg$fail(peg$c113); }
2710
- }
1732
+ s2 = peg$FAILED;
1733
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
2711
1734
  }
2712
- if (s3 !== peg$FAILED) {
1735
+ if (s2 !== peg$FAILED) {
2713
1736
  peg$savedPos = s0;
2714
- s1 = peg$c118();
2715
- s0 = s1;
1737
+ s0 = peg$f22(s2);
2716
1738
  } else {
2717
1739
  peg$currPos = s0;
2718
1740
  s0 = peg$FAILED;
@@ -2721,82 +1743,121 @@ export const {
2721
1743
  peg$currPos = s0;
2722
1744
  s0 = peg$FAILED;
2723
1745
  }
2724
- } else {
2725
- peg$currPos = s0;
2726
- s0 = peg$FAILED;
2727
1746
  }
2728
-
2729
- return s0;
2730
1747
  }
2731
1748
 
2732
- function peg$parseLuceneLiteral() {
2733
- var s0;
1749
+ return s0;
1750
+ }
2734
1751
 
2735
- s0 = peg$parseQuotedString();
2736
- if (s0 === peg$FAILED) {
2737
- s0 = peg$parseLuceneUnquotedLiteral();
2738
- }
1752
+ function peg$parseUnquotedLiteral() {
1753
+ let s0, s1, s2, s3, s4;
2739
1754
 
2740
- return s0;
1755
+ s0 = peg$currPos;
1756
+ s1 = [];
1757
+ s2 = peg$parseUnquotedCharacter();
1758
+ while (s2 !== peg$FAILED) {
1759
+ s1.push(s2);
1760
+ s2 = peg$parseUnquotedCharacter();
2741
1761
  }
2742
-
2743
- function peg$parseLuceneUnquotedLiteral() {
2744
- var s0, s1;
2745
-
2746
- s0 = [];
2747
- s1 = peg$parseLuceneUnquotedCharacter();
2748
- if (s1 !== peg$FAILED) {
2749
- while (s1 !== peg$FAILED) {
2750
- s0.push(s1);
2751
- s1 = peg$parseLuceneUnquotedCharacter();
1762
+ s2 = peg$parseCursor();
1763
+ if (s2 !== peg$FAILED) {
1764
+ s3 = [];
1765
+ s4 = peg$parseUnquotedCharacter();
1766
+ while (s4 !== peg$FAILED) {
1767
+ s3.push(s4);
1768
+ s4 = peg$parseUnquotedCharacter();
1769
+ }
1770
+ peg$savedPos = s0;
1771
+ s0 = peg$f23(s1, s2, s3);
1772
+ } else {
1773
+ peg$currPos = s0;
1774
+ s0 = peg$FAILED;
1775
+ }
1776
+ if (s0 === peg$FAILED) {
1777
+ s0 = peg$currPos;
1778
+ s1 = [];
1779
+ s2 = peg$parseUnquotedCharacter();
1780
+ if (s2 !== peg$FAILED) {
1781
+ while (s2 !== peg$FAILED) {
1782
+ s1.push(s2);
1783
+ s2 = peg$parseUnquotedCharacter();
2752
1784
  }
2753
1785
  } else {
2754
- s0 = peg$FAILED;
1786
+ s1 = peg$FAILED;
2755
1787
  }
2756
-
2757
- return s0;
1788
+ if (s1 !== peg$FAILED) {
1789
+ peg$savedPos = s0;
1790
+ s1 = peg$f24(s1);
1791
+ }
1792
+ s0 = s1;
2758
1793
  }
2759
1794
 
2760
- function peg$parseLuceneUnquotedCharacter() {
2761
- var s0, s1, s2, s3;
1795
+ return s0;
1796
+ }
1797
+
1798
+ function peg$parseUnquotedCharacter() {
1799
+ let s0, s1, s2, s3, s4;
2762
1800
 
2763
- s0 = peg$parseEscapedWhitespace();
1801
+ s0 = peg$parseEscapedWhitespace();
1802
+ if (s0 === peg$FAILED) {
1803
+ s0 = peg$parseEscapedSpecialCharacter();
2764
1804
  if (s0 === peg$FAILED) {
2765
- s0 = peg$parseEscapedLuceneSpecialCharacter();
1805
+ s0 = peg$parseEscapedKeyword();
2766
1806
  if (s0 === peg$FAILED) {
2767
- s0 = peg$currPos;
2768
- s1 = peg$currPos;
2769
- peg$silentFails++;
2770
- s2 = peg$parseLuceneSpecialCharacter();
2771
- peg$silentFails--;
2772
- if (s2 === peg$FAILED) {
2773
- s1 = void 0;
2774
- } else {
2775
- peg$currPos = s1;
2776
- s1 = peg$FAILED;
2777
- }
2778
- if (s1 !== peg$FAILED) {
2779
- s2 = peg$currPos;
1807
+ s0 = peg$parseWildcard();
1808
+ if (s0 === peg$FAILED) {
1809
+ s0 = peg$currPos;
1810
+ s1 = peg$currPos;
2780
1811
  peg$silentFails++;
2781
- s3 = peg$parseLuceneKeyword();
1812
+ s2 = peg$parseSpecialCharacter();
2782
1813
  peg$silentFails--;
2783
- if (s3 === peg$FAILED) {
2784
- s2 = void 0;
1814
+ if (s2 === peg$FAILED) {
1815
+ s1 = undefined;
2785
1816
  } else {
2786
- peg$currPos = s2;
2787
- s2 = peg$FAILED;
1817
+ peg$currPos = s1;
1818
+ s1 = peg$FAILED;
2788
1819
  }
2789
- if (s2 !== peg$FAILED) {
2790
- if (input.length > peg$currPos) {
2791
- s3 = input.charAt(peg$currPos);
2792
- peg$currPos++;
1820
+ if (s1 !== peg$FAILED) {
1821
+ s2 = peg$currPos;
1822
+ peg$silentFails++;
1823
+ s3 = peg$parseKeyword();
1824
+ peg$silentFails--;
1825
+ if (s3 === peg$FAILED) {
1826
+ s2 = undefined;
2793
1827
  } else {
2794
- s3 = peg$FAILED;
2795
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1828
+ peg$currPos = s2;
1829
+ s2 = peg$FAILED;
2796
1830
  }
2797
- if (s3 !== peg$FAILED) {
2798
- s1 = [s1, s2, s3];
2799
- s0 = s1;
1831
+ if (s2 !== peg$FAILED) {
1832
+ s3 = peg$currPos;
1833
+ peg$silentFails++;
1834
+ s4 = peg$parseCursor();
1835
+ peg$silentFails--;
1836
+ if (s4 === peg$FAILED) {
1837
+ s3 = undefined;
1838
+ } else {
1839
+ peg$currPos = s3;
1840
+ s3 = peg$FAILED;
1841
+ }
1842
+ if (s3 !== peg$FAILED) {
1843
+ if (input.length > peg$currPos) {
1844
+ s4 = input.charAt(peg$currPos);
1845
+ peg$currPos++;
1846
+ } else {
1847
+ s4 = peg$FAILED;
1848
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
1849
+ }
1850
+ if (s4 !== peg$FAILED) {
1851
+ peg$savedPos = s0;
1852
+ s0 = peg$f25(s4);
1853
+ } else {
1854
+ peg$currPos = s0;
1855
+ s0 = peg$FAILED;
1856
+ }
1857
+ } else {
1858
+ peg$currPos = s0;
1859
+ s0 = peg$FAILED;
1860
+ }
2800
1861
  } else {
2801
1862
  peg$currPos = s0;
2802
1863
  s0 = peg$FAILED;
@@ -2805,382 +1866,412 @@ export const {
2805
1866
  peg$currPos = s0;
2806
1867
  s0 = peg$FAILED;
2807
1868
  }
2808
- } else {
2809
- peg$currPos = s0;
2810
- s0 = peg$FAILED;
2811
1869
  }
2812
1870
  }
2813
1871
  }
1872
+ }
1873
+
1874
+ return s0;
1875
+ }
2814
1876
 
2815
- return s0;
1877
+ function peg$parseWildcard() {
1878
+ let s0, s1;
1879
+
1880
+ s0 = peg$currPos;
1881
+ if (input.charCodeAt(peg$currPos) === 42) {
1882
+ s1 = peg$c11;
1883
+ peg$currPos++;
1884
+ } else {
1885
+ s1 = peg$FAILED;
1886
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
2816
1887
  }
1888
+ if (s1 !== peg$FAILED) {
1889
+ peg$savedPos = s0;
1890
+ s1 = peg$f26();
1891
+ }
1892
+ s0 = s1;
2817
1893
 
2818
- function peg$parseLuceneKeyword() {
2819
- var s0;
1894
+ return s0;
1895
+ }
2820
1896
 
2821
- s0 = peg$parseOr();
2822
- if (s0 === peg$FAILED) {
2823
- s0 = peg$parseAnd();
2824
- if (s0 === peg$FAILED) {
2825
- s0 = peg$parseLuceneOr();
2826
- if (s0 === peg$FAILED) {
2827
- s0 = peg$parseLuceneAnd();
2828
- if (s0 === peg$FAILED) {
2829
- s0 = peg$parseLuceneNot();
2830
- if (s0 === peg$FAILED) {
2831
- s0 = peg$parseLuceneTo();
2832
- }
2833
- }
2834
- }
2835
- }
2836
- }
1897
+ function peg$parseOptionalSpace() {
1898
+ let s0, s1, s2, s3, s4;
2837
1899
 
2838
- return s0;
1900
+ s0 = peg$currPos;
1901
+ s1 = [];
1902
+ s2 = peg$parseSpace();
1903
+ while (s2 !== peg$FAILED) {
1904
+ s1.push(s2);
1905
+ s2 = peg$parseSpace();
1906
+ }
1907
+ s2 = peg$parseCursor();
1908
+ if (s2 !== peg$FAILED) {
1909
+ s3 = [];
1910
+ s4 = peg$parseSpace();
1911
+ while (s4 !== peg$FAILED) {
1912
+ s3.push(s4);
1913
+ s4 = peg$parseSpace();
1914
+ }
1915
+ peg$savedPos = s0;
1916
+ s0 = peg$f27(s1, s2, s3);
1917
+ } else {
1918
+ peg$currPos = s0;
1919
+ s0 = peg$FAILED;
1920
+ }
1921
+ if (s0 === peg$FAILED) {
1922
+ s0 = [];
1923
+ s1 = peg$parseSpace();
1924
+ while (s1 !== peg$FAILED) {
1925
+ s0.push(s1);
1926
+ s1 = peg$parseSpace();
1927
+ }
2839
1928
  }
2840
1929
 
2841
- function peg$parseEscapedLuceneSpecialCharacter() {
2842
- var s0, s1, s2;
1930
+ return s0;
1931
+ }
1932
+
1933
+ function peg$parseEscapedWhitespace() {
1934
+ let s0, s1;
2843
1935
 
1936
+ s0 = peg$currPos;
1937
+ if (input.substr(peg$currPos, 2) === peg$c12) {
1938
+ s1 = peg$c12;
1939
+ peg$currPos += 2;
1940
+ } else {
1941
+ s1 = peg$FAILED;
1942
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
1943
+ }
1944
+ if (s1 !== peg$FAILED) {
1945
+ peg$savedPos = s0;
1946
+ s1 = peg$f28();
1947
+ }
1948
+ s0 = s1;
1949
+ if (s0 === peg$FAILED) {
2844
1950
  s0 = peg$currPos;
2845
- if (input.charCodeAt(peg$currPos) === 92) {
2846
- s1 = peg$c42;
2847
- peg$currPos++;
1951
+ if (input.substr(peg$currPos, 2) === peg$c13) {
1952
+ s1 = peg$c13;
1953
+ peg$currPos += 2;
2848
1954
  } else {
2849
1955
  s1 = peg$FAILED;
2850
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1956
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
2851
1957
  }
2852
1958
  if (s1 !== peg$FAILED) {
2853
- s2 = peg$parseLuceneSpecialCharacter();
2854
- if (s2 !== peg$FAILED) {
2855
- peg$savedPos = s0;
2856
- s1 = peg$c119();
2857
- s0 = s1;
1959
+ peg$savedPos = s0;
1960
+ s1 = peg$f29();
1961
+ }
1962
+ s0 = s1;
1963
+ if (s0 === peg$FAILED) {
1964
+ s0 = peg$currPos;
1965
+ if (input.substr(peg$currPos, 2) === peg$c14) {
1966
+ s1 = peg$c14;
1967
+ peg$currPos += 2;
2858
1968
  } else {
2859
- peg$currPos = s0;
2860
- s0 = peg$FAILED;
1969
+ s1 = peg$FAILED;
1970
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
2861
1971
  }
2862
- } else {
2863
- peg$currPos = s0;
2864
- s0 = peg$FAILED;
1972
+ if (s1 !== peg$FAILED) {
1973
+ peg$savedPos = s0;
1974
+ s1 = peg$f30();
1975
+ }
1976
+ s0 = s1;
2865
1977
  }
2866
-
2867
- return s0;
2868
1978
  }
2869
1979
 
2870
- function peg$parseLuceneSpecialCharacter() {
2871
- var s0;
1980
+ return s0;
1981
+ }
2872
1982
 
2873
- if (input.charCodeAt(peg$currPos) === 43) {
2874
- s0 = peg$c91;
2875
- peg$currPos++;
1983
+ function peg$parseEscapedSpecialCharacter() {
1984
+ let s0, s1, s2;
1985
+
1986
+ s0 = peg$currPos;
1987
+ if (input.charCodeAt(peg$currPos) === 92) {
1988
+ s1 = peg$c10;
1989
+ peg$currPos++;
1990
+ } else {
1991
+ s1 = peg$FAILED;
1992
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1993
+ }
1994
+ if (s1 !== peg$FAILED) {
1995
+ s2 = peg$parseSpecialCharacter();
1996
+ if (s2 !== peg$FAILED) {
1997
+ peg$savedPos = s0;
1998
+ s0 = peg$f31(s2);
2876
1999
  } else {
2000
+ peg$currPos = s0;
2877
2001
  s0 = peg$FAILED;
2878
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
2879
- }
2880
- if (s0 === peg$FAILED) {
2881
- if (input.charCodeAt(peg$currPos) === 45) {
2882
- s0 = peg$c93;
2883
- peg$currPos++;
2884
- } else {
2885
- s0 = peg$FAILED;
2886
- if (peg$silentFails === 0) { peg$fail(peg$c94); }
2887
- }
2888
- if (s0 === peg$FAILED) {
2889
- if (input.charCodeAt(peg$currPos) === 61) {
2890
- s0 = peg$c120;
2891
- peg$currPos++;
2892
- } else {
2893
- s0 = peg$FAILED;
2894
- if (peg$silentFails === 0) { peg$fail(peg$c121); }
2895
- }
2896
- if (s0 === peg$FAILED) {
2897
- if (input.charCodeAt(peg$currPos) === 62) {
2898
- s0 = peg$c75;
2899
- peg$currPos++;
2900
- } else {
2901
- s0 = peg$FAILED;
2902
- if (peg$silentFails === 0) { peg$fail(peg$c76); }
2903
- }
2904
- if (s0 === peg$FAILED) {
2905
- if (input.charCodeAt(peg$currPos) === 60) {
2906
- s0 = peg$c72;
2907
- peg$currPos++;
2908
- } else {
2909
- s0 = peg$FAILED;
2910
- if (peg$silentFails === 0) { peg$fail(peg$c73); }
2911
- }
2912
- if (s0 === peg$FAILED) {
2913
- if (input.charCodeAt(peg$currPos) === 33) {
2914
- s0 = peg$c96;
2915
- peg$currPos++;
2916
- } else {
2917
- s0 = peg$FAILED;
2918
- if (peg$silentFails === 0) { peg$fail(peg$c97); }
2919
- }
2920
- if (s0 === peg$FAILED) {
2921
- if (input.charCodeAt(peg$currPos) === 40) {
2922
- s0 = peg$c5;
2923
- peg$currPos++;
2924
- } else {
2925
- s0 = peg$FAILED;
2926
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
2927
- }
2928
- if (s0 === peg$FAILED) {
2929
- if (input.charCodeAt(peg$currPos) === 41) {
2930
- s0 = peg$c7;
2931
- peg$currPos++;
2932
- } else {
2933
- s0 = peg$FAILED;
2934
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
2935
- }
2936
- if (s0 === peg$FAILED) {
2937
- if (input.charCodeAt(peg$currPos) === 123) {
2938
- s0 = peg$c12;
2939
- peg$currPos++;
2940
- } else {
2941
- s0 = peg$FAILED;
2942
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
2943
- }
2944
- if (s0 === peg$FAILED) {
2945
- if (input.charCodeAt(peg$currPos) === 125) {
2946
- s0 = peg$c14;
2947
- peg$currPos++;
2948
- } else {
2949
- s0 = peg$FAILED;
2950
- if (peg$silentFails === 0) { peg$fail(peg$c15); }
2951
- }
2952
- if (s0 === peg$FAILED) {
2953
- if (input.charCodeAt(peg$currPos) === 91) {
2954
- s0 = peg$c122;
2955
- peg$currPos++;
2956
- } else {
2957
- s0 = peg$FAILED;
2958
- if (peg$silentFails === 0) { peg$fail(peg$c123); }
2959
- }
2960
- if (s0 === peg$FAILED) {
2961
- if (input.charCodeAt(peg$currPos) === 93) {
2962
- s0 = peg$c124;
2963
- peg$currPos++;
2964
- } else {
2965
- s0 = peg$FAILED;
2966
- if (peg$silentFails === 0) { peg$fail(peg$c125); }
2967
- }
2968
- if (s0 === peg$FAILED) {
2969
- if (input.charCodeAt(peg$currPos) === 94) {
2970
- s0 = peg$c116;
2971
- peg$currPos++;
2972
- } else {
2973
- s0 = peg$FAILED;
2974
- if (peg$silentFails === 0) { peg$fail(peg$c117); }
2975
- }
2976
- if (s0 === peg$FAILED) {
2977
- if (input.charCodeAt(peg$currPos) === 34) {
2978
- s0 = peg$c38;
2979
- peg$currPos++;
2980
- } else {
2981
- s0 = peg$FAILED;
2982
- if (peg$silentFails === 0) { peg$fail(peg$c39); }
2983
- }
2984
- if (s0 === peg$FAILED) {
2985
- if (input.charCodeAt(peg$currPos) === 126) {
2986
- s0 = peg$c110;
2987
- peg$currPos++;
2988
- } else {
2989
- s0 = peg$FAILED;
2990
- if (peg$silentFails === 0) { peg$fail(peg$c111); }
2991
- }
2992
- if (s0 === peg$FAILED) {
2993
- if (input.charCodeAt(peg$currPos) === 42) {
2994
- s0 = peg$c51;
2995
- peg$currPos++;
2996
- } else {
2997
- s0 = peg$FAILED;
2998
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
2999
- }
3000
- if (s0 === peg$FAILED) {
3001
- if (input.charCodeAt(peg$currPos) === 63) {
3002
- s0 = peg$c102;
3003
- peg$currPos++;
3004
- } else {
3005
- s0 = peg$FAILED;
3006
- if (peg$silentFails === 0) { peg$fail(peg$c103); }
3007
- }
3008
- if (s0 === peg$FAILED) {
3009
- if (input.charCodeAt(peg$currPos) === 58) {
3010
- s0 = peg$c10;
3011
- peg$currPos++;
3012
- } else {
3013
- s0 = peg$FAILED;
3014
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
3015
- }
3016
- if (s0 === peg$FAILED) {
3017
- if (input.charCodeAt(peg$currPos) === 92) {
3018
- s0 = peg$c42;
3019
- peg$currPos++;
3020
- } else {
3021
- s0 = peg$FAILED;
3022
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
3023
- }
3024
- if (s0 === peg$FAILED) {
3025
- if (input.charCodeAt(peg$currPos) === 47) {
3026
- s0 = peg$c105;
3027
- peg$currPos++;
3028
- } else {
3029
- s0 = peg$FAILED;
3030
- if (peg$silentFails === 0) { peg$fail(peg$c106); }
3031
- }
3032
- }
3033
- }
3034
- }
3035
- }
3036
- }
3037
- }
3038
- }
3039
- }
3040
- }
3041
- }
3042
- }
3043
- }
3044
- }
3045
- }
3046
- }
3047
- }
3048
- }
3049
- }
3050
2002
  }
3051
-
3052
- return s0;
2003
+ } else {
2004
+ peg$currPos = s0;
2005
+ s0 = peg$FAILED;
3053
2006
  }
3054
2007
 
3055
- function peg$parseLuceneTo() {
3056
- var s0, s1, s2, s3, s4;
2008
+ return s0;
2009
+ }
2010
+
2011
+ function peg$parseEscapedKeyword() {
2012
+ let s0, s1, s2;
3057
2013
 
3058
- s0 = peg$currPos;
3059
- s1 = [];
3060
- s2 = peg$parseSpace();
3061
- if (s2 !== peg$FAILED) {
3062
- while (s2 !== peg$FAILED) {
3063
- s1.push(s2);
3064
- s2 = peg$parseSpace();
3065
- }
2014
+ s0 = peg$currPos;
2015
+ if (input.charCodeAt(peg$currPos) === 92) {
2016
+ s1 = peg$c10;
2017
+ peg$currPos++;
2018
+ } else {
2019
+ s1 = peg$FAILED;
2020
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
2021
+ }
2022
+ if (s1 !== peg$FAILED) {
2023
+ s2 = input.substr(peg$currPos, 2);
2024
+ if (s2.toLowerCase() === peg$c5) {
2025
+ peg$currPos += (2);
3066
2026
  } else {
3067
- s1 = peg$FAILED;
2027
+ s2 = peg$FAILED;
2028
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
3068
2029
  }
3069
- if (s1 !== peg$FAILED) {
3070
- if (input.substr(peg$currPos, 2) === peg$c126) {
3071
- s2 = peg$c126;
3072
- peg$currPos += 2;
2030
+ if (s2 === peg$FAILED) {
2031
+ s2 = input.substr(peg$currPos, 3);
2032
+ if (s2.toLowerCase() === peg$c6) {
2033
+ peg$currPos += (3);
3073
2034
  } else {
3074
2035
  s2 = peg$FAILED;
3075
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2036
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
3076
2037
  }
3077
- if (s2 !== peg$FAILED) {
3078
- s3 = [];
3079
- s4 = peg$parseSpace();
3080
- if (s4 !== peg$FAILED) {
3081
- while (s4 !== peg$FAILED) {
3082
- s3.push(s4);
3083
- s4 = peg$parseSpace();
3084
- }
3085
- } else {
3086
- s3 = peg$FAILED;
3087
- }
3088
- if (s3 !== peg$FAILED) {
3089
- s1 = [s1, s2, s3];
3090
- s0 = s1;
2038
+ if (s2 === peg$FAILED) {
2039
+ s2 = input.substr(peg$currPos, 3);
2040
+ if (s2.toLowerCase() === peg$c7) {
2041
+ peg$currPos += (3);
3091
2042
  } else {
3092
- peg$currPos = s0;
3093
- s0 = peg$FAILED;
2043
+ s2 = peg$FAILED;
2044
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
3094
2045
  }
3095
- } else {
3096
- peg$currPos = s0;
3097
- s0 = peg$FAILED;
3098
2046
  }
2047
+ }
2048
+ if (s2 !== peg$FAILED) {
2049
+ peg$savedPos = s0;
2050
+ s0 = peg$f32(s2);
3099
2051
  } else {
3100
2052
  peg$currPos = s0;
3101
2053
  s0 = peg$FAILED;
3102
2054
  }
3103
-
3104
- return s0;
2055
+ } else {
2056
+ peg$currPos = s0;
2057
+ s0 = peg$FAILED;
3105
2058
  }
3106
2059
 
3107
- function peg$parseLuceneRangeStart() {
3108
- var s0;
2060
+ return s0;
2061
+ }
2062
+
2063
+ function peg$parseKeyword() {
2064
+ let s0;
3109
2065
 
3110
- if (input.charCodeAt(peg$currPos) === 91) {
3111
- s0 = peg$c122;
3112
- peg$currPos++;
3113
- } else {
3114
- s0 = peg$FAILED;
3115
- if (peg$silentFails === 0) { peg$fail(peg$c123); }
3116
- }
2066
+ s0 = peg$parseOr();
2067
+ if (s0 === peg$FAILED) {
2068
+ s0 = peg$parseAnd();
3117
2069
  if (s0 === peg$FAILED) {
3118
- if (input.charCodeAt(peg$currPos) === 123) {
3119
- s0 = peg$c12;
3120
- peg$currPos++;
3121
- } else {
3122
- s0 = peg$FAILED;
3123
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
3124
- }
2070
+ s0 = peg$parseNot();
3125
2071
  }
2072
+ }
2073
+
2074
+ return s0;
2075
+ }
2076
+
2077
+ function peg$parseSpecialCharacter() {
2078
+ let s0;
2079
+
2080
+ s0 = input.charAt(peg$currPos);
2081
+ if (peg$r3.test(s0)) {
2082
+ peg$currPos++;
2083
+ } else {
2084
+ s0 = peg$FAILED;
2085
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
2086
+ }
2087
+
2088
+ return s0;
2089
+ }
2090
+
2091
+ function peg$parseGeoSpatialOperator() {
2092
+ let s0, s1;
3126
2093
 
3127
- return s0;
2094
+ s0 = peg$currPos;
2095
+ if (input.substr(peg$currPos, 2) === peg$c15) {
2096
+ s1 = peg$c15;
2097
+ peg$currPos += 2;
2098
+ } else {
2099
+ s1 = peg$FAILED;
2100
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
2101
+ }
2102
+ if (s1 !== peg$FAILED) {
2103
+ peg$savedPos = s0;
2104
+ s1 = peg$f33();
3128
2105
  }
2106
+ s0 = s1;
3129
2107
 
3130
- function peg$parseLuceneRangeEnd() {
3131
- var s0;
2108
+ return s0;
2109
+ }
3132
2110
 
3133
- if (input.charCodeAt(peg$currPos) === 93) {
3134
- s0 = peg$c124;
3135
- peg$currPos++;
2111
+ function peg$parseRangeOperator() {
2112
+ let s0, s1;
2113
+
2114
+ s0 = peg$currPos;
2115
+ if (input.substr(peg$currPos, 2) === peg$c16) {
2116
+ s1 = peg$c16;
2117
+ peg$currPos += 2;
2118
+ } else {
2119
+ s1 = peg$FAILED;
2120
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2121
+ }
2122
+ if (s1 !== peg$FAILED) {
2123
+ peg$savedPos = s0;
2124
+ s1 = peg$f34();
2125
+ }
2126
+ s0 = s1;
2127
+ if (s0 === peg$FAILED) {
2128
+ s0 = peg$currPos;
2129
+ if (input.substr(peg$currPos, 2) === peg$c17) {
2130
+ s1 = peg$c17;
2131
+ peg$currPos += 2;
3136
2132
  } else {
3137
- s0 = peg$FAILED;
3138
- if (peg$silentFails === 0) { peg$fail(peg$c125); }
2133
+ s1 = peg$FAILED;
2134
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
3139
2135
  }
2136
+ if (s1 !== peg$FAILED) {
2137
+ peg$savedPos = s0;
2138
+ s1 = peg$f35();
2139
+ }
2140
+ s0 = s1;
3140
2141
  if (s0 === peg$FAILED) {
3141
- if (input.charCodeAt(peg$currPos) === 125) {
3142
- s0 = peg$c14;
2142
+ s0 = peg$currPos;
2143
+ if (input.charCodeAt(peg$currPos) === 60) {
2144
+ s1 = peg$c18;
3143
2145
  peg$currPos++;
3144
2146
  } else {
3145
- s0 = peg$FAILED;
3146
- if (peg$silentFails === 0) { peg$fail(peg$c15); }
2147
+ s1 = peg$FAILED;
2148
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2149
+ }
2150
+ if (s1 !== peg$FAILED) {
2151
+ peg$savedPos = s0;
2152
+ s1 = peg$f36();
2153
+ }
2154
+ s0 = s1;
2155
+ if (s0 === peg$FAILED) {
2156
+ s0 = peg$currPos;
2157
+ if (input.charCodeAt(peg$currPos) === 62) {
2158
+ s1 = peg$c19;
2159
+ peg$currPos++;
2160
+ } else {
2161
+ s1 = peg$FAILED;
2162
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2163
+ }
2164
+ if (s1 !== peg$FAILED) {
2165
+ peg$savedPos = s0;
2166
+ s1 = peg$f37();
2167
+ }
2168
+ s0 = s1;
3147
2169
  }
3148
2170
  }
3149
-
3150
- return s0;
3151
2171
  }
3152
2172
 
2173
+ return s0;
2174
+ }
2175
+
2176
+ function peg$parseSpace() {
2177
+ let s0, s1;
3153
2178
 
3154
- const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options;
3155
- const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes;
3156
- const buildLiteralNode = nodeTypes.literal.buildNode;
3157
- const buildWildcardNode = nodeTypes.wildcard.buildNode;
3158
- const buildNamedArgNode = nodeTypes.namedArg.buildNode;
3159
- const { wildcardSymbol } = nodeTypes.wildcard;
2179
+ peg$silentFails++;
2180
+ s0 = input.charAt(peg$currPos);
2181
+ if (peg$r4.test(s0)) {
2182
+ peg$currPos++;
2183
+ } else {
2184
+ s0 = peg$FAILED;
2185
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
2186
+ }
2187
+ peg$silentFails--;
2188
+ if (s0 === peg$FAILED) {
2189
+ s1 = peg$FAILED;
2190
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
2191
+ }
3160
2192
 
2193
+ return s0;
2194
+ }
3161
2195
 
3162
- peg$result = peg$startRuleFunction();
2196
+ function peg$parseCursor() {
2197
+ let s0, s1, s2;
3163
2198
 
3164
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
3165
- return peg$result;
2199
+ s0 = peg$currPos;
2200
+ peg$savedPos = peg$currPos;
2201
+ s1 = peg$f38();
2202
+ if (s1) {
2203
+ s1 = undefined;
3166
2204
  } else {
3167
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
3168
- peg$fail({ type: "end", description: "end of input" });
2205
+ s1 = peg$FAILED;
2206
+ }
2207
+ if (s1 !== peg$FAILED) {
2208
+ if (input.substr(peg$currPos, 14) === peg$c20) {
2209
+ s2 = peg$c20;
2210
+ peg$currPos += 14;
2211
+ } else {
2212
+ s2 = peg$FAILED;
2213
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
3169
2214
  }
3170
-
3171
- throw peg$buildException(
3172
- null,
3173
- peg$maxFailExpected,
3174
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
3175
- peg$maxFailPos < input.length
3176
- ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
3177
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
3178
- );
2215
+ if (s2 !== peg$FAILED) {
2216
+ peg$savedPos = s0;
2217
+ s0 = peg$f39();
2218
+ } else {
2219
+ peg$currPos = s0;
2220
+ s0 = peg$FAILED;
2221
+ }
2222
+ } else {
2223
+ peg$currPos = s0;
2224
+ s0 = peg$FAILED;
3179
2225
  }
2226
+
2227
+ return s0;
3180
2228
  }
3181
2229
 
2230
+
2231
+ const { errorOnLuceneSyntax, parseCursor, cursorSymbol, allowLeadingWildcards = true, helpers: { nodeTypes } } = options;
2232
+ const buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes;
2233
+ const buildLiteralNode = nodeTypes.literal.buildNode;
2234
+ const buildWildcardNode = nodeTypes.wildcard.buildNode;
2235
+ const buildNamedArgNode = nodeTypes.namedArg.buildNode;
2236
+ const { wildcardSymbol } = nodeTypes.wildcard;
2237
+
2238
+ peg$result = peg$startRuleFunction();
2239
+
2240
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
2241
+ function peg$throw() {
2242
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2243
+ peg$fail(peg$endExpectation());
2244
+ }
2245
+
2246
+ throw peg$buildStructuredError(
2247
+ peg$maxFailExpected,
2248
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
2249
+ peg$maxFailPos < input.length
2250
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2251
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
2252
+ );
2253
+ }
2254
+ if (options.peg$library) {
2255
+ return /** @type {any} */ ({
2256
+ peg$result,
2257
+ peg$currPos,
2258
+ peg$FAILED,
2259
+ peg$maxFailExpected,
2260
+ peg$maxFailPos,
2261
+ peg$success,
2262
+ peg$throw: peg$success ? undefined : peg$throw,
2263
+ });
2264
+ }
2265
+ if (peg$success) {
2266
+ return peg$result;
2267
+ } else {
2268
+ peg$throw();
2269
+ }
2270
+ }
3182
2271
  return {
2272
+ StartRules: ["start", "Literal"],
3183
2273
  SyntaxError: peg$SyntaxError,
3184
- parse: peg$parse
2274
+ parse: peg$parse,
3185
2275
  };
3186
- })();
2276
+ })()
2277
+ ;