util-cql-parser 0.0.2
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.
- package/README.md +32 -0
- package/index.js +7 -0
- package/lib/convertToAST.js +8 -0
- package/lib/convertToSimpleFilters.js +268 -0
- package/lib/parser.js +2128 -0
- package/package.json +20 -0
package/lib/parser.js
ADDED
@@ -0,0 +1,2128 @@
|
|
1
|
+
/*
|
2
|
+
* Generated by PEG.js 0.10.0.
|
3
|
+
*
|
4
|
+
* http://pegjs.org/
|
5
|
+
*/
|
6
|
+
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
function peg$subclass(child, parent) {
|
10
|
+
function ctor() { this.constructor = child; }
|
11
|
+
ctor.prototype = parent.prototype;
|
12
|
+
child.prototype = new ctor();
|
13
|
+
}
|
14
|
+
|
15
|
+
function peg$SyntaxError(message, expected, found, location) {
|
16
|
+
this.message = message;
|
17
|
+
this.expected = expected;
|
18
|
+
this.found = found;
|
19
|
+
this.location = location;
|
20
|
+
this.name = "SyntaxError";
|
21
|
+
|
22
|
+
if (typeof Error.captureStackTrace === "function") {
|
23
|
+
Error.captureStackTrace(this, peg$SyntaxError);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
peg$subclass(peg$SyntaxError, Error);
|
28
|
+
|
29
|
+
peg$SyntaxError.buildMessage = function(expected, found) {
|
30
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
31
|
+
literal: function(expectation) {
|
32
|
+
return "\"" + literalEscape(expectation.text) + "\"";
|
33
|
+
},
|
34
|
+
|
35
|
+
"class": function(expectation) {
|
36
|
+
var escapedParts = "",
|
37
|
+
i;
|
38
|
+
|
39
|
+
for (i = 0; i < expectation.parts.length; i++) {
|
40
|
+
escapedParts += expectation.parts[i] instanceof Array
|
41
|
+
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
|
42
|
+
: classEscape(expectation.parts[i]);
|
43
|
+
}
|
44
|
+
|
45
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
46
|
+
},
|
47
|
+
|
48
|
+
any: function(expectation) {
|
49
|
+
return "any character";
|
50
|
+
},
|
51
|
+
|
52
|
+
end: function(expectation) {
|
53
|
+
return "end of input";
|
54
|
+
},
|
55
|
+
|
56
|
+
other: function(expectation) {
|
57
|
+
return expectation.description;
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
function hex(ch) {
|
62
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
63
|
+
}
|
64
|
+
|
65
|
+
function literalEscape(s) {
|
66
|
+
return s
|
67
|
+
.replace(/\\/g, '\\\\')
|
68
|
+
.replace(/"/g, '\\"')
|
69
|
+
.replace(/\0/g, '\\0')
|
70
|
+
.replace(/\t/g, '\\t')
|
71
|
+
.replace(/\n/g, '\\n')
|
72
|
+
.replace(/\r/g, '\\r')
|
73
|
+
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
74
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
75
|
+
}
|
76
|
+
|
77
|
+
function classEscape(s) {
|
78
|
+
return s
|
79
|
+
.replace(/\\/g, '\\\\')
|
80
|
+
.replace(/\]/g, '\\]')
|
81
|
+
.replace(/\^/g, '\\^')
|
82
|
+
.replace(/-/g, '\\-')
|
83
|
+
.replace(/\0/g, '\\0')
|
84
|
+
.replace(/\t/g, '\\t')
|
85
|
+
.replace(/\n/g, '\\n')
|
86
|
+
.replace(/\r/g, '\\r')
|
87
|
+
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
88
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
89
|
+
}
|
90
|
+
|
91
|
+
function describeExpectation(expectation) {
|
92
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
93
|
+
}
|
94
|
+
|
95
|
+
function describeExpected(expected) {
|
96
|
+
var descriptions = new Array(expected.length),
|
97
|
+
i, j;
|
98
|
+
|
99
|
+
for (i = 0; i < expected.length; i++) {
|
100
|
+
descriptions[i] = describeExpectation(expected[i]);
|
101
|
+
}
|
102
|
+
|
103
|
+
descriptions.sort();
|
104
|
+
|
105
|
+
if (descriptions.length > 0) {
|
106
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
107
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
108
|
+
descriptions[j] = descriptions[i];
|
109
|
+
j++;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
descriptions.length = j;
|
113
|
+
}
|
114
|
+
|
115
|
+
switch (descriptions.length) {
|
116
|
+
case 1:
|
117
|
+
return descriptions[0];
|
118
|
+
|
119
|
+
case 2:
|
120
|
+
return descriptions[0] + " or " + descriptions[1];
|
121
|
+
|
122
|
+
default:
|
123
|
+
return descriptions.slice(0, -1).join(", ")
|
124
|
+
+ ", or "
|
125
|
+
+ descriptions[descriptions.length - 1];
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
function describeFound(found) {
|
130
|
+
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
131
|
+
}
|
132
|
+
|
133
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
134
|
+
};
|
135
|
+
|
136
|
+
function peg$parse(input, options) {
|
137
|
+
options = options !== void 0 ? options : {};
|
138
|
+
|
139
|
+
var peg$FAILED = {},
|
140
|
+
|
141
|
+
peg$startRuleFunctions = { start: peg$parsestart },
|
142
|
+
peg$startRuleFunction = peg$parsestart,
|
143
|
+
|
144
|
+
peg$c0 = function(node) {
|
145
|
+
return node[0];
|
146
|
+
},
|
147
|
+
peg$c1 = function() {
|
148
|
+
return {};
|
149
|
+
},
|
150
|
+
peg$c2 = function(operator) {
|
151
|
+
return {
|
152
|
+
'operator': operator
|
153
|
+
};
|
154
|
+
},
|
155
|
+
peg$c3 = function(operator, right) {
|
156
|
+
return right;
|
157
|
+
},
|
158
|
+
peg$c4 = function(left, operator, right) {
|
159
|
+
var node= {
|
160
|
+
'left':left
|
161
|
+
};
|
162
|
+
|
163
|
+
var right =
|
164
|
+
right.length == 0
|
165
|
+
? null
|
166
|
+
: right[0]['right'] == null
|
167
|
+
? right[0]['left']
|
168
|
+
: right[0];
|
169
|
+
|
170
|
+
if (right != null)
|
171
|
+
{
|
172
|
+
node['operator'] = operator=='' || operator==undefined ? '<implicit>' : operator[0];
|
173
|
+
node['right'] = right;
|
174
|
+
}
|
175
|
+
|
176
|
+
return node;
|
177
|
+
},
|
178
|
+
peg$c5 = function(field_exp) {
|
179
|
+
return field_exp;
|
180
|
+
},
|
181
|
+
peg$c6 = "(",
|
182
|
+
peg$c7 = peg$literalExpectation("(", false),
|
183
|
+
peg$c8 = ")",
|
184
|
+
peg$c9 = peg$literalExpectation(")", false),
|
185
|
+
peg$c10 = function(fieldname, range) {
|
186
|
+
range['field'] =
|
187
|
+
fieldname == '' || fieldname == undefined
|
188
|
+
? "<implicit>"
|
189
|
+
: fieldname;
|
190
|
+
|
191
|
+
return range;
|
192
|
+
},
|
193
|
+
peg$c11 = function(fieldname, node) {
|
194
|
+
node['field']= fieldname;
|
195
|
+
return node;
|
196
|
+
},
|
197
|
+
peg$c12 = function(fieldname, term) {
|
198
|
+
var fieldexp = {
|
199
|
+
'field':
|
200
|
+
fieldname == '' || fieldname == undefined
|
201
|
+
? "<implicit>"
|
202
|
+
: fieldname
|
203
|
+
};
|
204
|
+
|
205
|
+
for(var key in term)
|
206
|
+
fieldexp[key] = term[key];
|
207
|
+
|
208
|
+
return fieldexp;
|
209
|
+
},
|
210
|
+
peg$c13 = /^[:]/,
|
211
|
+
peg$c14 = peg$classExpectation([":"], false, false),
|
212
|
+
peg$c15 = function(fieldname) {
|
213
|
+
return fieldname;
|
214
|
+
},
|
215
|
+
peg$c16 = function(op, term, proximity, boost) {
|
216
|
+
var result = { 'term': term };
|
217
|
+
|
218
|
+
if('' != proximity)
|
219
|
+
{
|
220
|
+
result['proximity'] = proximity;
|
221
|
+
}
|
222
|
+
if('' != boost)
|
223
|
+
{
|
224
|
+
result['boost'] = boost;
|
225
|
+
}
|
226
|
+
if('' != op)
|
227
|
+
{
|
228
|
+
result['prefix'] = op;
|
229
|
+
}
|
230
|
+
|
231
|
+
return result;
|
232
|
+
},
|
233
|
+
peg$c17 = function(op, term, similarity, boost) {
|
234
|
+
var result = { 'term': term };
|
235
|
+
if('' != similarity)
|
236
|
+
{
|
237
|
+
result['similarity'] = similarity;
|
238
|
+
}
|
239
|
+
if('' != boost)
|
240
|
+
{
|
241
|
+
result['boost'] = boost;
|
242
|
+
}
|
243
|
+
if('' != op)
|
244
|
+
{
|
245
|
+
result['prefix'] = op;
|
246
|
+
}
|
247
|
+
return result;
|
248
|
+
},
|
249
|
+
peg$c18 = function(op, term, boost) {
|
250
|
+
var result = { 'term': term, 'regexpr': true };
|
251
|
+
if('' != boost)
|
252
|
+
{
|
253
|
+
result['boost'] = boost;
|
254
|
+
}
|
255
|
+
if('' != op)
|
256
|
+
{
|
257
|
+
result['prefix'] = op;
|
258
|
+
}
|
259
|
+
return result;
|
260
|
+
},
|
261
|
+
peg$c19 = function(term_start, term) {
|
262
|
+
var res = term_start + term.join('');
|
263
|
+
if (/^(?:AND|OR|NOT|and|or|not|\|\||&&)$/.test(res)) {
|
264
|
+
var e = new Error('Term can not be AND, OR, NOT, ||, &&')
|
265
|
+
e.name = 'SyntaxError'
|
266
|
+
e.column = location
|
267
|
+
throw e
|
268
|
+
}
|
269
|
+
return res
|
270
|
+
},
|
271
|
+
peg$c20 = ".",
|
272
|
+
peg$c21 = peg$literalExpectation(".", false),
|
273
|
+
peg$c22 = /^[^: \t\r\n\f{}()"+-\/\^~[\]]/,
|
274
|
+
peg$c23 = peg$classExpectation([":", " ", "\t", "\r", "\n", "\f", "{", "}", "(", ")", "\"", ["+", "/"], "^", "~", "[", "]"], true, false),
|
275
|
+
peg$c24 = "\\",
|
276
|
+
peg$c25 = peg$literalExpectation("\\", false),
|
277
|
+
peg$c26 = /^[: \t\r\n\f{}()"\/\^~[\]]/,
|
278
|
+
peg$c27 = peg$classExpectation([":", " ", "\t", "\r", "\n", "\f", "{", "}", "(", ")", "\"", "/", "^", "~", "[", "]"], false, false),
|
279
|
+
peg$c28 = function(escaping_char) {
|
280
|
+
return '\\' + escaping_char;
|
281
|
+
},
|
282
|
+
peg$c29 = "+",
|
283
|
+
peg$c30 = peg$literalExpectation("+", false),
|
284
|
+
peg$c31 = "-",
|
285
|
+
peg$c32 = peg$literalExpectation("-", false),
|
286
|
+
peg$c33 = "/",
|
287
|
+
peg$c34 = peg$literalExpectation("/", false),
|
288
|
+
peg$c35 = function(term) {
|
289
|
+
return term.join('').replace('\\/', '/');
|
290
|
+
},
|
291
|
+
peg$c36 = "\\/",
|
292
|
+
peg$c37 = peg$literalExpectation("\\/", false),
|
293
|
+
peg$c38 = /^[^\/]/,
|
294
|
+
peg$c39 = peg$classExpectation(["/"], true, false),
|
295
|
+
peg$c40 = "\"",
|
296
|
+
peg$c41 = peg$literalExpectation("\"", false),
|
297
|
+
peg$c42 = /^[^"]/,
|
298
|
+
peg$c43 = peg$classExpectation(["\""], true, false),
|
299
|
+
peg$c44 = function(term) {
|
300
|
+
return term.join('');
|
301
|
+
},
|
302
|
+
peg$c45 = "~",
|
303
|
+
peg$c46 = peg$literalExpectation("~", false),
|
304
|
+
peg$c47 = function(proximity) {
|
305
|
+
return proximity;
|
306
|
+
},
|
307
|
+
peg$c48 = "^",
|
308
|
+
peg$c49 = peg$literalExpectation("^", false),
|
309
|
+
peg$c50 = function(boost) {
|
310
|
+
return boost;
|
311
|
+
},
|
312
|
+
peg$c51 = function(fuzziness) {
|
313
|
+
return fuzziness == '' || fuzziness == undefined ? 0.5 : fuzziness;
|
314
|
+
},
|
315
|
+
peg$c52 = "0.",
|
316
|
+
peg$c53 = peg$literalExpectation("0.", false),
|
317
|
+
peg$c54 = /^[0-9]/,
|
318
|
+
peg$c55 = peg$classExpectation([["0", "9"]], false, false),
|
319
|
+
peg$c56 = function(val) {
|
320
|
+
return parseFloat("0." + val.join(''));
|
321
|
+
},
|
322
|
+
peg$c57 = function(val) {
|
323
|
+
return parseInt(val.join(''));
|
324
|
+
},
|
325
|
+
peg$c58 = "[",
|
326
|
+
peg$c59 = peg$literalExpectation("[", false),
|
327
|
+
peg$c60 = "TO",
|
328
|
+
peg$c61 = peg$literalExpectation("TO", false),
|
329
|
+
peg$c62 = "]",
|
330
|
+
peg$c63 = peg$literalExpectation("]", false),
|
331
|
+
peg$c64 = function(term_min, term_max) {
|
332
|
+
return {
|
333
|
+
'term_min': term_min,
|
334
|
+
'term_max': term_max,
|
335
|
+
'inclusive': true,
|
336
|
+
'inclusive_min': true,
|
337
|
+
'inclusive_max': true
|
338
|
+
};
|
339
|
+
},
|
340
|
+
peg$c65 = "{",
|
341
|
+
peg$c66 = peg$literalExpectation("{", false),
|
342
|
+
peg$c67 = "}",
|
343
|
+
peg$c68 = peg$literalExpectation("}", false),
|
344
|
+
peg$c69 = function(term_min, term_max) {
|
345
|
+
return {
|
346
|
+
'term_min': term_min,
|
347
|
+
'term_max': term_max,
|
348
|
+
'inclusive': false,
|
349
|
+
'inclusive_min': false,
|
350
|
+
'inclusive_max': false
|
351
|
+
};
|
352
|
+
},
|
353
|
+
peg$c70 = function(term_min, term_max) {
|
354
|
+
return {
|
355
|
+
'term_min': term_min,
|
356
|
+
'term_max': term_max,
|
357
|
+
'inclusive': false,
|
358
|
+
'inclusive_min': false,
|
359
|
+
'inclusive_max': true
|
360
|
+
};
|
361
|
+
},
|
362
|
+
peg$c71 = function(term_min, term_max) {
|
363
|
+
return {
|
364
|
+
'term_min': term_min,
|
365
|
+
'term_max': term_max,
|
366
|
+
'inclusive': false,
|
367
|
+
'inclusive_min': true,
|
368
|
+
'inclusive_max': false
|
369
|
+
};
|
370
|
+
},
|
371
|
+
peg$c72 = function(operator) {
|
372
|
+
return operator;
|
373
|
+
},
|
374
|
+
peg$c73 = "OR",
|
375
|
+
peg$c74 = peg$literalExpectation("OR", false),
|
376
|
+
peg$c75 = "AND",
|
377
|
+
peg$c76 = peg$literalExpectation("AND", false),
|
378
|
+
peg$c77 = "NOT",
|
379
|
+
peg$c78 = peg$literalExpectation("NOT", false),
|
380
|
+
peg$c79 = "and",
|
381
|
+
peg$c80 = peg$literalExpectation("and", false),
|
382
|
+
peg$c81 = function() { return 'AND'; },
|
383
|
+
peg$c82 = "or",
|
384
|
+
peg$c83 = peg$literalExpectation("or", false),
|
385
|
+
peg$c84 = function() { return 'OR'; },
|
386
|
+
peg$c85 = "||",
|
387
|
+
peg$c86 = peg$literalExpectation("||", false),
|
388
|
+
peg$c87 = "&&",
|
389
|
+
peg$c88 = peg$literalExpectation("&&", false),
|
390
|
+
peg$c89 = "!",
|
391
|
+
peg$c90 = peg$literalExpectation("!", false),
|
392
|
+
peg$c91 = function() { return 'NOT'},
|
393
|
+
peg$c92 = peg$otherExpectation("whitespace"),
|
394
|
+
peg$c93 = /^[ \t\r\n\f]/,
|
395
|
+
peg$c94 = peg$classExpectation([" ", "\t", "\r", "\n", "\f"], false, false),
|
396
|
+
peg$c95 = peg$anyExpectation(),
|
397
|
+
|
398
|
+
peg$currPos = 0,
|
399
|
+
peg$savedPos = 0,
|
400
|
+
peg$posDetailsCache = [{ line: 1, column: 1 }],
|
401
|
+
peg$maxFailPos = 0,
|
402
|
+
peg$maxFailExpected = [],
|
403
|
+
peg$silentFails = 0,
|
404
|
+
|
405
|
+
peg$result;
|
406
|
+
|
407
|
+
if ("startRule" in options) {
|
408
|
+
if (!(options.startRule in peg$startRuleFunctions)) {
|
409
|
+
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
410
|
+
}
|
411
|
+
|
412
|
+
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
413
|
+
}
|
414
|
+
|
415
|
+
function text() {
|
416
|
+
return input.substring(peg$savedPos, peg$currPos);
|
417
|
+
}
|
418
|
+
|
419
|
+
function location() {
|
420
|
+
return peg$computeLocation(peg$savedPos, peg$currPos);
|
421
|
+
}
|
422
|
+
|
423
|
+
function expected(description, location) {
|
424
|
+
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
425
|
+
|
426
|
+
throw peg$buildStructuredError(
|
427
|
+
[peg$otherExpectation(description)],
|
428
|
+
input.substring(peg$savedPos, peg$currPos),
|
429
|
+
location
|
430
|
+
);
|
431
|
+
}
|
432
|
+
|
433
|
+
function error(message, location) {
|
434
|
+
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
435
|
+
|
436
|
+
throw peg$buildSimpleError(message, location);
|
437
|
+
}
|
438
|
+
|
439
|
+
function peg$literalExpectation(text, ignoreCase) {
|
440
|
+
return { type: "literal", text: text, ignoreCase: ignoreCase };
|
441
|
+
}
|
442
|
+
|
443
|
+
function peg$classExpectation(parts, inverted, ignoreCase) {
|
444
|
+
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
445
|
+
}
|
446
|
+
|
447
|
+
function peg$anyExpectation() {
|
448
|
+
return { type: "any" };
|
449
|
+
}
|
450
|
+
|
451
|
+
function peg$endExpectation() {
|
452
|
+
return { type: "end" };
|
453
|
+
}
|
454
|
+
|
455
|
+
function peg$otherExpectation(description) {
|
456
|
+
return { type: "other", description: description };
|
457
|
+
}
|
458
|
+
|
459
|
+
function peg$computePosDetails(pos) {
|
460
|
+
var details = peg$posDetailsCache[pos], p;
|
461
|
+
|
462
|
+
if (details) {
|
463
|
+
return details;
|
464
|
+
} else {
|
465
|
+
p = pos - 1;
|
466
|
+
while (!peg$posDetailsCache[p]) {
|
467
|
+
p--;
|
468
|
+
}
|
469
|
+
|
470
|
+
details = peg$posDetailsCache[p];
|
471
|
+
details = {
|
472
|
+
line: details.line,
|
473
|
+
column: details.column
|
474
|
+
};
|
475
|
+
|
476
|
+
while (p < pos) {
|
477
|
+
if (input.charCodeAt(p) === 10) {
|
478
|
+
details.line++;
|
479
|
+
details.column = 1;
|
480
|
+
} else {
|
481
|
+
details.column++;
|
482
|
+
}
|
483
|
+
|
484
|
+
p++;
|
485
|
+
}
|
486
|
+
|
487
|
+
peg$posDetailsCache[pos] = details;
|
488
|
+
return details;
|
489
|
+
}
|
490
|
+
}
|
491
|
+
|
492
|
+
function peg$computeLocation(startPos, endPos) {
|
493
|
+
var startPosDetails = peg$computePosDetails(startPos),
|
494
|
+
endPosDetails = peg$computePosDetails(endPos);
|
495
|
+
|
496
|
+
return {
|
497
|
+
start: {
|
498
|
+
offset: startPos,
|
499
|
+
line: startPosDetails.line,
|
500
|
+
column: startPosDetails.column
|
501
|
+
},
|
502
|
+
end: {
|
503
|
+
offset: endPos,
|
504
|
+
line: endPosDetails.line,
|
505
|
+
column: endPosDetails.column
|
506
|
+
}
|
507
|
+
};
|
508
|
+
}
|
509
|
+
|
510
|
+
function peg$fail(expected) {
|
511
|
+
if (peg$currPos < peg$maxFailPos) { return; }
|
512
|
+
|
513
|
+
if (peg$currPos > peg$maxFailPos) {
|
514
|
+
peg$maxFailPos = peg$currPos;
|
515
|
+
peg$maxFailExpected = [];
|
516
|
+
}
|
517
|
+
|
518
|
+
peg$maxFailExpected.push(expected);
|
519
|
+
}
|
520
|
+
|
521
|
+
function peg$buildSimpleError(message, location) {
|
522
|
+
return new peg$SyntaxError(message, null, null, location);
|
523
|
+
}
|
524
|
+
|
525
|
+
function peg$buildStructuredError(expected, found, location) {
|
526
|
+
return new peg$SyntaxError(
|
527
|
+
peg$SyntaxError.buildMessage(expected, found),
|
528
|
+
expected,
|
529
|
+
found,
|
530
|
+
location
|
531
|
+
);
|
532
|
+
}
|
533
|
+
|
534
|
+
function peg$parsestart() {
|
535
|
+
var s0, s1, s2, s3;
|
536
|
+
|
537
|
+
s0 = peg$currPos;
|
538
|
+
s1 = [];
|
539
|
+
s2 = peg$parse_();
|
540
|
+
while (s2 !== peg$FAILED) {
|
541
|
+
s1.push(s2);
|
542
|
+
s2 = peg$parse_();
|
543
|
+
}
|
544
|
+
if (s1 !== peg$FAILED) {
|
545
|
+
s2 = [];
|
546
|
+
s3 = peg$parsenode();
|
547
|
+
if (s3 !== peg$FAILED) {
|
548
|
+
while (s3 !== peg$FAILED) {
|
549
|
+
s2.push(s3);
|
550
|
+
s3 = peg$parsenode();
|
551
|
+
}
|
552
|
+
} else {
|
553
|
+
s2 = peg$FAILED;
|
554
|
+
}
|
555
|
+
if (s2 !== peg$FAILED) {
|
556
|
+
peg$savedPos = s0;
|
557
|
+
s1 = peg$c0(s2);
|
558
|
+
s0 = s1;
|
559
|
+
} else {
|
560
|
+
peg$currPos = s0;
|
561
|
+
s0 = peg$FAILED;
|
562
|
+
}
|
563
|
+
} else {
|
564
|
+
peg$currPos = s0;
|
565
|
+
s0 = peg$FAILED;
|
566
|
+
}
|
567
|
+
if (s0 === peg$FAILED) {
|
568
|
+
s0 = peg$currPos;
|
569
|
+
s1 = [];
|
570
|
+
s2 = peg$parse_();
|
571
|
+
while (s2 !== peg$FAILED) {
|
572
|
+
s1.push(s2);
|
573
|
+
s2 = peg$parse_();
|
574
|
+
}
|
575
|
+
if (s1 !== peg$FAILED) {
|
576
|
+
peg$savedPos = s0;
|
577
|
+
s1 = peg$c1();
|
578
|
+
}
|
579
|
+
s0 = s1;
|
580
|
+
if (s0 === peg$FAILED) {
|
581
|
+
s0 = peg$currPos;
|
582
|
+
s1 = peg$parseEOF();
|
583
|
+
if (s1 !== peg$FAILED) {
|
584
|
+
peg$savedPos = s0;
|
585
|
+
s1 = peg$c1();
|
586
|
+
}
|
587
|
+
s0 = s1;
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
return s0;
|
592
|
+
}
|
593
|
+
|
594
|
+
function peg$parsenode() {
|
595
|
+
var s0, s1, s2, s3, s4;
|
596
|
+
|
597
|
+
s0 = peg$currPos;
|
598
|
+
s1 = peg$parseoperator_exp();
|
599
|
+
if (s1 !== peg$FAILED) {
|
600
|
+
s2 = peg$parseEOF();
|
601
|
+
if (s2 !== peg$FAILED) {
|
602
|
+
peg$savedPos = s0;
|
603
|
+
s1 = peg$c2(s1);
|
604
|
+
s0 = s1;
|
605
|
+
} else {
|
606
|
+
peg$currPos = s0;
|
607
|
+
s0 = peg$FAILED;
|
608
|
+
}
|
609
|
+
} else {
|
610
|
+
peg$currPos = s0;
|
611
|
+
s0 = peg$FAILED;
|
612
|
+
}
|
613
|
+
if (s0 === peg$FAILED) {
|
614
|
+
s0 = peg$currPos;
|
615
|
+
s1 = peg$parseoperator_exp();
|
616
|
+
if (s1 !== peg$FAILED) {
|
617
|
+
s2 = peg$parsenode();
|
618
|
+
if (s2 !== peg$FAILED) {
|
619
|
+
peg$savedPos = s0;
|
620
|
+
s1 = peg$c3(s1, s2);
|
621
|
+
s0 = s1;
|
622
|
+
} else {
|
623
|
+
peg$currPos = s0;
|
624
|
+
s0 = peg$FAILED;
|
625
|
+
}
|
626
|
+
} else {
|
627
|
+
peg$currPos = s0;
|
628
|
+
s0 = peg$FAILED;
|
629
|
+
}
|
630
|
+
if (s0 === peg$FAILED) {
|
631
|
+
s0 = peg$currPos;
|
632
|
+
s1 = peg$parsegroup_exp();
|
633
|
+
if (s1 !== peg$FAILED) {
|
634
|
+
s2 = [];
|
635
|
+
s3 = peg$parseoperator_exp();
|
636
|
+
while (s3 !== peg$FAILED) {
|
637
|
+
s2.push(s3);
|
638
|
+
s3 = peg$parseoperator_exp();
|
639
|
+
}
|
640
|
+
if (s2 !== peg$FAILED) {
|
641
|
+
s3 = [];
|
642
|
+
s4 = peg$parsenode();
|
643
|
+
while (s4 !== peg$FAILED) {
|
644
|
+
s3.push(s4);
|
645
|
+
s4 = peg$parsenode();
|
646
|
+
}
|
647
|
+
if (s3 !== peg$FAILED) {
|
648
|
+
peg$savedPos = s0;
|
649
|
+
s1 = peg$c4(s1, s2, s3);
|
650
|
+
s0 = s1;
|
651
|
+
} else {
|
652
|
+
peg$currPos = s0;
|
653
|
+
s0 = peg$FAILED;
|
654
|
+
}
|
655
|
+
} else {
|
656
|
+
peg$currPos = s0;
|
657
|
+
s0 = peg$FAILED;
|
658
|
+
}
|
659
|
+
} else {
|
660
|
+
peg$currPos = s0;
|
661
|
+
s0 = peg$FAILED;
|
662
|
+
}
|
663
|
+
}
|
664
|
+
}
|
665
|
+
|
666
|
+
return s0;
|
667
|
+
}
|
668
|
+
|
669
|
+
function peg$parsegroup_exp() {
|
670
|
+
var s0, s1, s2, s3;
|
671
|
+
|
672
|
+
s0 = peg$currPos;
|
673
|
+
s1 = peg$parsefield_exp();
|
674
|
+
if (s1 !== peg$FAILED) {
|
675
|
+
s2 = [];
|
676
|
+
s3 = peg$parse_();
|
677
|
+
while (s3 !== peg$FAILED) {
|
678
|
+
s2.push(s3);
|
679
|
+
s3 = peg$parse_();
|
680
|
+
}
|
681
|
+
if (s2 !== peg$FAILED) {
|
682
|
+
peg$savedPos = s0;
|
683
|
+
s1 = peg$c5(s1);
|
684
|
+
s0 = s1;
|
685
|
+
} else {
|
686
|
+
peg$currPos = s0;
|
687
|
+
s0 = peg$FAILED;
|
688
|
+
}
|
689
|
+
} else {
|
690
|
+
peg$currPos = s0;
|
691
|
+
s0 = peg$FAILED;
|
692
|
+
}
|
693
|
+
if (s0 === peg$FAILED) {
|
694
|
+
s0 = peg$parseparen_exp();
|
695
|
+
}
|
696
|
+
|
697
|
+
return s0;
|
698
|
+
}
|
699
|
+
|
700
|
+
function peg$parseparen_exp() {
|
701
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
702
|
+
|
703
|
+
s0 = peg$currPos;
|
704
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
705
|
+
s1 = peg$c6;
|
706
|
+
peg$currPos++;
|
707
|
+
} else {
|
708
|
+
s1 = peg$FAILED;
|
709
|
+
if (peg$silentFails === 0) { peg$fail(peg$c7); }
|
710
|
+
}
|
711
|
+
if (s1 !== peg$FAILED) {
|
712
|
+
s2 = [];
|
713
|
+
s3 = peg$parse_();
|
714
|
+
while (s3 !== peg$FAILED) {
|
715
|
+
s2.push(s3);
|
716
|
+
s3 = peg$parse_();
|
717
|
+
}
|
718
|
+
if (s2 !== peg$FAILED) {
|
719
|
+
s3 = [];
|
720
|
+
s4 = peg$parsenode();
|
721
|
+
if (s4 !== peg$FAILED) {
|
722
|
+
while (s4 !== peg$FAILED) {
|
723
|
+
s3.push(s4);
|
724
|
+
s4 = peg$parsenode();
|
725
|
+
}
|
726
|
+
} else {
|
727
|
+
s3 = peg$FAILED;
|
728
|
+
}
|
729
|
+
if (s3 !== peg$FAILED) {
|
730
|
+
if (input.charCodeAt(peg$currPos) === 41) {
|
731
|
+
s4 = peg$c8;
|
732
|
+
peg$currPos++;
|
733
|
+
} else {
|
734
|
+
s4 = peg$FAILED;
|
735
|
+
if (peg$silentFails === 0) { peg$fail(peg$c9); }
|
736
|
+
}
|
737
|
+
if (s4 !== peg$FAILED) {
|
738
|
+
s5 = [];
|
739
|
+
s6 = peg$parse_();
|
740
|
+
while (s6 !== peg$FAILED) {
|
741
|
+
s5.push(s6);
|
742
|
+
s6 = peg$parse_();
|
743
|
+
}
|
744
|
+
if (s5 !== peg$FAILED) {
|
745
|
+
peg$savedPos = s0;
|
746
|
+
s1 = peg$c0(s3);
|
747
|
+
s0 = s1;
|
748
|
+
} else {
|
749
|
+
peg$currPos = s0;
|
750
|
+
s0 = peg$FAILED;
|
751
|
+
}
|
752
|
+
} else {
|
753
|
+
peg$currPos = s0;
|
754
|
+
s0 = peg$FAILED;
|
755
|
+
}
|
756
|
+
} else {
|
757
|
+
peg$currPos = s0;
|
758
|
+
s0 = peg$FAILED;
|
759
|
+
}
|
760
|
+
} else {
|
761
|
+
peg$currPos = s0;
|
762
|
+
s0 = peg$FAILED;
|
763
|
+
}
|
764
|
+
} else {
|
765
|
+
peg$currPos = s0;
|
766
|
+
s0 = peg$FAILED;
|
767
|
+
}
|
768
|
+
|
769
|
+
return s0;
|
770
|
+
}
|
771
|
+
|
772
|
+
function peg$parsefield_exp() {
|
773
|
+
var s0, s1, s2;
|
774
|
+
|
775
|
+
s0 = peg$currPos;
|
776
|
+
s1 = peg$parsefieldname();
|
777
|
+
if (s1 === peg$FAILED) {
|
778
|
+
s1 = null;
|
779
|
+
}
|
780
|
+
if (s1 !== peg$FAILED) {
|
781
|
+
s2 = peg$parserange_operator_exp();
|
782
|
+
if (s2 !== peg$FAILED) {
|
783
|
+
peg$savedPos = s0;
|
784
|
+
s1 = peg$c10(s1, s2);
|
785
|
+
s0 = s1;
|
786
|
+
} else {
|
787
|
+
peg$currPos = s0;
|
788
|
+
s0 = peg$FAILED;
|
789
|
+
}
|
790
|
+
} else {
|
791
|
+
peg$currPos = s0;
|
792
|
+
s0 = peg$FAILED;
|
793
|
+
}
|
794
|
+
if (s0 === peg$FAILED) {
|
795
|
+
s0 = peg$currPos;
|
796
|
+
s1 = peg$parsefieldname();
|
797
|
+
if (s1 !== peg$FAILED) {
|
798
|
+
s2 = peg$parseparen_exp();
|
799
|
+
if (s2 !== peg$FAILED) {
|
800
|
+
peg$savedPos = s0;
|
801
|
+
s1 = peg$c11(s1, s2);
|
802
|
+
s0 = s1;
|
803
|
+
} else {
|
804
|
+
peg$currPos = s0;
|
805
|
+
s0 = peg$FAILED;
|
806
|
+
}
|
807
|
+
} else {
|
808
|
+
peg$currPos = s0;
|
809
|
+
s0 = peg$FAILED;
|
810
|
+
}
|
811
|
+
if (s0 === peg$FAILED) {
|
812
|
+
s0 = peg$currPos;
|
813
|
+
s1 = peg$parsefieldname();
|
814
|
+
if (s1 === peg$FAILED) {
|
815
|
+
s1 = null;
|
816
|
+
}
|
817
|
+
if (s1 !== peg$FAILED) {
|
818
|
+
s2 = peg$parseterm();
|
819
|
+
if (s2 !== peg$FAILED) {
|
820
|
+
peg$savedPos = s0;
|
821
|
+
s1 = peg$c12(s1, s2);
|
822
|
+
s0 = s1;
|
823
|
+
} else {
|
824
|
+
peg$currPos = s0;
|
825
|
+
s0 = peg$FAILED;
|
826
|
+
}
|
827
|
+
} else {
|
828
|
+
peg$currPos = s0;
|
829
|
+
s0 = peg$FAILED;
|
830
|
+
}
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
return s0;
|
835
|
+
}
|
836
|
+
|
837
|
+
function peg$parsefieldname() {
|
838
|
+
var s0, s1, s2, s3, s4, s5;
|
839
|
+
|
840
|
+
s0 = peg$currPos;
|
841
|
+
s1 = peg$parseunquoted_term();
|
842
|
+
if (s1 !== peg$FAILED) {
|
843
|
+
s2 = [];
|
844
|
+
s3 = peg$parse_();
|
845
|
+
while (s3 !== peg$FAILED) {
|
846
|
+
s2.push(s3);
|
847
|
+
s3 = peg$parse_();
|
848
|
+
}
|
849
|
+
if (s2 !== peg$FAILED) {
|
850
|
+
if (peg$c13.test(input.charAt(peg$currPos))) {
|
851
|
+
s3 = input.charAt(peg$currPos);
|
852
|
+
peg$currPos++;
|
853
|
+
} else {
|
854
|
+
s3 = peg$FAILED;
|
855
|
+
if (peg$silentFails === 0) { peg$fail(peg$c14); }
|
856
|
+
}
|
857
|
+
if (s3 !== peg$FAILED) {
|
858
|
+
s4 = [];
|
859
|
+
s5 = peg$parse_();
|
860
|
+
while (s5 !== peg$FAILED) {
|
861
|
+
s4.push(s5);
|
862
|
+
s5 = peg$parse_();
|
863
|
+
}
|
864
|
+
if (s4 !== peg$FAILED) {
|
865
|
+
peg$savedPos = s0;
|
866
|
+
s1 = peg$c15(s1);
|
867
|
+
s0 = s1;
|
868
|
+
} else {
|
869
|
+
peg$currPos = s0;
|
870
|
+
s0 = peg$FAILED;
|
871
|
+
}
|
872
|
+
} else {
|
873
|
+
peg$currPos = s0;
|
874
|
+
s0 = peg$FAILED;
|
875
|
+
}
|
876
|
+
} else {
|
877
|
+
peg$currPos = s0;
|
878
|
+
s0 = peg$FAILED;
|
879
|
+
}
|
880
|
+
} else {
|
881
|
+
peg$currPos = s0;
|
882
|
+
s0 = peg$FAILED;
|
883
|
+
}
|
884
|
+
|
885
|
+
return s0;
|
886
|
+
}
|
887
|
+
|
888
|
+
function peg$parseterm() {
|
889
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
890
|
+
|
891
|
+
s0 = peg$currPos;
|
892
|
+
s1 = peg$parseprefix_operator_exp();
|
893
|
+
if (s1 === peg$FAILED) {
|
894
|
+
s1 = null;
|
895
|
+
}
|
896
|
+
if (s1 !== peg$FAILED) {
|
897
|
+
s2 = peg$parsequoted_term();
|
898
|
+
if (s2 !== peg$FAILED) {
|
899
|
+
s3 = peg$parseproximity_modifier();
|
900
|
+
if (s3 === peg$FAILED) {
|
901
|
+
s3 = null;
|
902
|
+
}
|
903
|
+
if (s3 !== peg$FAILED) {
|
904
|
+
s4 = peg$parseboost_modifier();
|
905
|
+
if (s4 === peg$FAILED) {
|
906
|
+
s4 = null;
|
907
|
+
}
|
908
|
+
if (s4 !== peg$FAILED) {
|
909
|
+
s5 = [];
|
910
|
+
s6 = peg$parse_();
|
911
|
+
while (s6 !== peg$FAILED) {
|
912
|
+
s5.push(s6);
|
913
|
+
s6 = peg$parse_();
|
914
|
+
}
|
915
|
+
if (s5 !== peg$FAILED) {
|
916
|
+
peg$savedPos = s0;
|
917
|
+
s1 = peg$c16(s1, s2, s3, s4);
|
918
|
+
s0 = s1;
|
919
|
+
} else {
|
920
|
+
peg$currPos = s0;
|
921
|
+
s0 = peg$FAILED;
|
922
|
+
}
|
923
|
+
} else {
|
924
|
+
peg$currPos = s0;
|
925
|
+
s0 = peg$FAILED;
|
926
|
+
}
|
927
|
+
} else {
|
928
|
+
peg$currPos = s0;
|
929
|
+
s0 = peg$FAILED;
|
930
|
+
}
|
931
|
+
} else {
|
932
|
+
peg$currPos = s0;
|
933
|
+
s0 = peg$FAILED;
|
934
|
+
}
|
935
|
+
} else {
|
936
|
+
peg$currPos = s0;
|
937
|
+
s0 = peg$FAILED;
|
938
|
+
}
|
939
|
+
if (s0 === peg$FAILED) {
|
940
|
+
s0 = peg$currPos;
|
941
|
+
s1 = peg$parseprefix_operator_exp();
|
942
|
+
if (s1 === peg$FAILED) {
|
943
|
+
s1 = null;
|
944
|
+
}
|
945
|
+
if (s1 !== peg$FAILED) {
|
946
|
+
s2 = peg$parseunquoted_term();
|
947
|
+
if (s2 !== peg$FAILED) {
|
948
|
+
s3 = peg$parsefuzzy_modifier();
|
949
|
+
if (s3 === peg$FAILED) {
|
950
|
+
s3 = null;
|
951
|
+
}
|
952
|
+
if (s3 !== peg$FAILED) {
|
953
|
+
s4 = peg$parseboost_modifier();
|
954
|
+
if (s4 === peg$FAILED) {
|
955
|
+
s4 = null;
|
956
|
+
}
|
957
|
+
if (s4 !== peg$FAILED) {
|
958
|
+
s5 = [];
|
959
|
+
s6 = peg$parse_();
|
960
|
+
while (s6 !== peg$FAILED) {
|
961
|
+
s5.push(s6);
|
962
|
+
s6 = peg$parse_();
|
963
|
+
}
|
964
|
+
if (s5 !== peg$FAILED) {
|
965
|
+
peg$savedPos = s0;
|
966
|
+
s1 = peg$c17(s1, s2, s3, s4);
|
967
|
+
s0 = s1;
|
968
|
+
} else {
|
969
|
+
peg$currPos = s0;
|
970
|
+
s0 = peg$FAILED;
|
971
|
+
}
|
972
|
+
} else {
|
973
|
+
peg$currPos = s0;
|
974
|
+
s0 = peg$FAILED;
|
975
|
+
}
|
976
|
+
} else {
|
977
|
+
peg$currPos = s0;
|
978
|
+
s0 = peg$FAILED;
|
979
|
+
}
|
980
|
+
} else {
|
981
|
+
peg$currPos = s0;
|
982
|
+
s0 = peg$FAILED;
|
983
|
+
}
|
984
|
+
} else {
|
985
|
+
peg$currPos = s0;
|
986
|
+
s0 = peg$FAILED;
|
987
|
+
}
|
988
|
+
if (s0 === peg$FAILED) {
|
989
|
+
s0 = peg$currPos;
|
990
|
+
s1 = peg$parseprefix_operator_exp();
|
991
|
+
if (s1 === peg$FAILED) {
|
992
|
+
s1 = null;
|
993
|
+
}
|
994
|
+
if (s1 !== peg$FAILED) {
|
995
|
+
s2 = peg$parseregexpr_term();
|
996
|
+
if (s2 !== peg$FAILED) {
|
997
|
+
s3 = peg$parseboost_modifier();
|
998
|
+
if (s3 === peg$FAILED) {
|
999
|
+
s3 = null;
|
1000
|
+
}
|
1001
|
+
if (s3 !== peg$FAILED) {
|
1002
|
+
s4 = [];
|
1003
|
+
s5 = peg$parse_();
|
1004
|
+
while (s5 !== peg$FAILED) {
|
1005
|
+
s4.push(s5);
|
1006
|
+
s5 = peg$parse_();
|
1007
|
+
}
|
1008
|
+
if (s4 !== peg$FAILED) {
|
1009
|
+
peg$savedPos = s0;
|
1010
|
+
s1 = peg$c18(s1, s2, s3);
|
1011
|
+
s0 = s1;
|
1012
|
+
} else {
|
1013
|
+
peg$currPos = s0;
|
1014
|
+
s0 = peg$FAILED;
|
1015
|
+
}
|
1016
|
+
} else {
|
1017
|
+
peg$currPos = s0;
|
1018
|
+
s0 = peg$FAILED;
|
1019
|
+
}
|
1020
|
+
} else {
|
1021
|
+
peg$currPos = s0;
|
1022
|
+
s0 = peg$FAILED;
|
1023
|
+
}
|
1024
|
+
} else {
|
1025
|
+
peg$currPos = s0;
|
1026
|
+
s0 = peg$FAILED;
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
return s0;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
function peg$parseunquoted_term() {
|
1035
|
+
var s0, s1, s2, s3;
|
1036
|
+
|
1037
|
+
s0 = peg$currPos;
|
1038
|
+
s1 = peg$parseterm_start_char();
|
1039
|
+
if (s1 !== peg$FAILED) {
|
1040
|
+
s2 = [];
|
1041
|
+
s3 = peg$parseterm_char();
|
1042
|
+
while (s3 !== peg$FAILED) {
|
1043
|
+
s2.push(s3);
|
1044
|
+
s3 = peg$parseterm_char();
|
1045
|
+
}
|
1046
|
+
if (s2 !== peg$FAILED) {
|
1047
|
+
peg$savedPos = s0;
|
1048
|
+
s1 = peg$c19(s1, s2);
|
1049
|
+
s0 = s1;
|
1050
|
+
} else {
|
1051
|
+
peg$currPos = s0;
|
1052
|
+
s0 = peg$FAILED;
|
1053
|
+
}
|
1054
|
+
} else {
|
1055
|
+
peg$currPos = s0;
|
1056
|
+
s0 = peg$FAILED;
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
return s0;
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
function peg$parseterm_start_char() {
|
1063
|
+
var s0;
|
1064
|
+
|
1065
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
1066
|
+
s0 = peg$c20;
|
1067
|
+
peg$currPos++;
|
1068
|
+
} else {
|
1069
|
+
s0 = peg$FAILED;
|
1070
|
+
if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
1071
|
+
}
|
1072
|
+
if (s0 === peg$FAILED) {
|
1073
|
+
s0 = peg$parseterm_escaping_char();
|
1074
|
+
if (s0 === peg$FAILED) {
|
1075
|
+
if (peg$c22.test(input.charAt(peg$currPos))) {
|
1076
|
+
s0 = input.charAt(peg$currPos);
|
1077
|
+
peg$currPos++;
|
1078
|
+
} else {
|
1079
|
+
s0 = peg$FAILED;
|
1080
|
+
if (peg$silentFails === 0) { peg$fail(peg$c23); }
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
return s0;
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
function peg$parseterm_escaping_char() {
|
1089
|
+
var s0, s1, s2;
|
1090
|
+
|
1091
|
+
s0 = peg$currPos;
|
1092
|
+
if (input.charCodeAt(peg$currPos) === 92) {
|
1093
|
+
s1 = peg$c24;
|
1094
|
+
peg$currPos++;
|
1095
|
+
} else {
|
1096
|
+
s1 = peg$FAILED;
|
1097
|
+
if (peg$silentFails === 0) { peg$fail(peg$c25); }
|
1098
|
+
}
|
1099
|
+
if (s1 !== peg$FAILED) {
|
1100
|
+
if (peg$c26.test(input.charAt(peg$currPos))) {
|
1101
|
+
s2 = input.charAt(peg$currPos);
|
1102
|
+
peg$currPos++;
|
1103
|
+
} else {
|
1104
|
+
s2 = peg$FAILED;
|
1105
|
+
if (peg$silentFails === 0) { peg$fail(peg$c27); }
|
1106
|
+
}
|
1107
|
+
if (s2 !== peg$FAILED) {
|
1108
|
+
peg$savedPos = s0;
|
1109
|
+
s1 = peg$c28(s2);
|
1110
|
+
s0 = s1;
|
1111
|
+
} else {
|
1112
|
+
peg$currPos = s0;
|
1113
|
+
s0 = peg$FAILED;
|
1114
|
+
}
|
1115
|
+
} else {
|
1116
|
+
peg$currPos = s0;
|
1117
|
+
s0 = peg$FAILED;
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
return s0;
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
function peg$parseterm_char() {
|
1124
|
+
var s0;
|
1125
|
+
|
1126
|
+
if (input.charCodeAt(peg$currPos) === 43) {
|
1127
|
+
s0 = peg$c29;
|
1128
|
+
peg$currPos++;
|
1129
|
+
} else {
|
1130
|
+
s0 = peg$FAILED;
|
1131
|
+
if (peg$silentFails === 0) { peg$fail(peg$c30); }
|
1132
|
+
}
|
1133
|
+
if (s0 === peg$FAILED) {
|
1134
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
1135
|
+
s0 = peg$c31;
|
1136
|
+
peg$currPos++;
|
1137
|
+
} else {
|
1138
|
+
s0 = peg$FAILED;
|
1139
|
+
if (peg$silentFails === 0) { peg$fail(peg$c32); }
|
1140
|
+
}
|
1141
|
+
if (s0 === peg$FAILED) {
|
1142
|
+
s0 = peg$parseterm_escaping_char();
|
1143
|
+
if (s0 === peg$FAILED) {
|
1144
|
+
s0 = peg$parseterm_start_char();
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
return s0;
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
function peg$parseregexpr_term() {
|
1153
|
+
var s0, s1, s2, s3;
|
1154
|
+
|
1155
|
+
s0 = peg$currPos;
|
1156
|
+
if (input.charCodeAt(peg$currPos) === 47) {
|
1157
|
+
s1 = peg$c33;
|
1158
|
+
peg$currPos++;
|
1159
|
+
} else {
|
1160
|
+
s1 = peg$FAILED;
|
1161
|
+
if (peg$silentFails === 0) { peg$fail(peg$c34); }
|
1162
|
+
}
|
1163
|
+
if (s1 !== peg$FAILED) {
|
1164
|
+
s2 = [];
|
1165
|
+
s3 = peg$parseregexpr_char();
|
1166
|
+
if (s3 !== peg$FAILED) {
|
1167
|
+
while (s3 !== peg$FAILED) {
|
1168
|
+
s2.push(s3);
|
1169
|
+
s3 = peg$parseregexpr_char();
|
1170
|
+
}
|
1171
|
+
} else {
|
1172
|
+
s2 = peg$FAILED;
|
1173
|
+
}
|
1174
|
+
if (s2 !== peg$FAILED) {
|
1175
|
+
if (input.charCodeAt(peg$currPos) === 47) {
|
1176
|
+
s3 = peg$c33;
|
1177
|
+
peg$currPos++;
|
1178
|
+
} else {
|
1179
|
+
s3 = peg$FAILED;
|
1180
|
+
if (peg$silentFails === 0) { peg$fail(peg$c34); }
|
1181
|
+
}
|
1182
|
+
if (s3 !== peg$FAILED) {
|
1183
|
+
peg$savedPos = s0;
|
1184
|
+
s1 = peg$c35(s2);
|
1185
|
+
s0 = s1;
|
1186
|
+
} else {
|
1187
|
+
peg$currPos = s0;
|
1188
|
+
s0 = peg$FAILED;
|
1189
|
+
}
|
1190
|
+
} else {
|
1191
|
+
peg$currPos = s0;
|
1192
|
+
s0 = peg$FAILED;
|
1193
|
+
}
|
1194
|
+
} else {
|
1195
|
+
peg$currPos = s0;
|
1196
|
+
s0 = peg$FAILED;
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
return s0;
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
function peg$parseregexpr_char() {
|
1203
|
+
var s0;
|
1204
|
+
|
1205
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
1206
|
+
s0 = peg$c20;
|
1207
|
+
peg$currPos++;
|
1208
|
+
} else {
|
1209
|
+
s0 = peg$FAILED;
|
1210
|
+
if (peg$silentFails === 0) { peg$fail(peg$c21); }
|
1211
|
+
}
|
1212
|
+
if (s0 === peg$FAILED) {
|
1213
|
+
if (input.substr(peg$currPos, 2) === peg$c36) {
|
1214
|
+
s0 = peg$c36;
|
1215
|
+
peg$currPos += 2;
|
1216
|
+
} else {
|
1217
|
+
s0 = peg$FAILED;
|
1218
|
+
if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
1219
|
+
}
|
1220
|
+
if (s0 === peg$FAILED) {
|
1221
|
+
if (peg$c38.test(input.charAt(peg$currPos))) {
|
1222
|
+
s0 = input.charAt(peg$currPos);
|
1223
|
+
peg$currPos++;
|
1224
|
+
} else {
|
1225
|
+
s0 = peg$FAILED;
|
1226
|
+
if (peg$silentFails === 0) { peg$fail(peg$c39); }
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
return s0;
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
function peg$parsequoted_term() {
|
1235
|
+
var s0, s1, s2, s3;
|
1236
|
+
|
1237
|
+
s0 = peg$currPos;
|
1238
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
1239
|
+
s1 = peg$c40;
|
1240
|
+
peg$currPos++;
|
1241
|
+
} else {
|
1242
|
+
s1 = peg$FAILED;
|
1243
|
+
if (peg$silentFails === 0) { peg$fail(peg$c41); }
|
1244
|
+
}
|
1245
|
+
if (s1 !== peg$FAILED) {
|
1246
|
+
s2 = [];
|
1247
|
+
if (peg$c42.test(input.charAt(peg$currPos))) {
|
1248
|
+
s3 = input.charAt(peg$currPos);
|
1249
|
+
peg$currPos++;
|
1250
|
+
} else {
|
1251
|
+
s3 = peg$FAILED;
|
1252
|
+
if (peg$silentFails === 0) { peg$fail(peg$c43); }
|
1253
|
+
}
|
1254
|
+
if (s3 !== peg$FAILED) {
|
1255
|
+
while (s3 !== peg$FAILED) {
|
1256
|
+
s2.push(s3);
|
1257
|
+
if (peg$c42.test(input.charAt(peg$currPos))) {
|
1258
|
+
s3 = input.charAt(peg$currPos);
|
1259
|
+
peg$currPos++;
|
1260
|
+
} else {
|
1261
|
+
s3 = peg$FAILED;
|
1262
|
+
if (peg$silentFails === 0) { peg$fail(peg$c43); }
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
} else {
|
1266
|
+
s2 = peg$FAILED;
|
1267
|
+
}
|
1268
|
+
if (s2 !== peg$FAILED) {
|
1269
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
1270
|
+
s3 = peg$c40;
|
1271
|
+
peg$currPos++;
|
1272
|
+
} else {
|
1273
|
+
s3 = peg$FAILED;
|
1274
|
+
if (peg$silentFails === 0) { peg$fail(peg$c41); }
|
1275
|
+
}
|
1276
|
+
if (s3 !== peg$FAILED) {
|
1277
|
+
peg$savedPos = s0;
|
1278
|
+
s1 = peg$c44(s2);
|
1279
|
+
s0 = s1;
|
1280
|
+
} else {
|
1281
|
+
peg$currPos = s0;
|
1282
|
+
s0 = peg$FAILED;
|
1283
|
+
}
|
1284
|
+
} else {
|
1285
|
+
peg$currPos = s0;
|
1286
|
+
s0 = peg$FAILED;
|
1287
|
+
}
|
1288
|
+
} else {
|
1289
|
+
peg$currPos = s0;
|
1290
|
+
s0 = peg$FAILED;
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
return s0;
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
function peg$parseproximity_modifier() {
|
1297
|
+
var s0, s1, s2;
|
1298
|
+
|
1299
|
+
s0 = peg$currPos;
|
1300
|
+
if (input.charCodeAt(peg$currPos) === 126) {
|
1301
|
+
s1 = peg$c45;
|
1302
|
+
peg$currPos++;
|
1303
|
+
} else {
|
1304
|
+
s1 = peg$FAILED;
|
1305
|
+
if (peg$silentFails === 0) { peg$fail(peg$c46); }
|
1306
|
+
}
|
1307
|
+
if (s1 !== peg$FAILED) {
|
1308
|
+
s2 = peg$parseint_exp();
|
1309
|
+
if (s2 !== peg$FAILED) {
|
1310
|
+
peg$savedPos = s0;
|
1311
|
+
s1 = peg$c47(s2);
|
1312
|
+
s0 = s1;
|
1313
|
+
} else {
|
1314
|
+
peg$currPos = s0;
|
1315
|
+
s0 = peg$FAILED;
|
1316
|
+
}
|
1317
|
+
} else {
|
1318
|
+
peg$currPos = s0;
|
1319
|
+
s0 = peg$FAILED;
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
return s0;
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
function peg$parseboost_modifier() {
|
1326
|
+
var s0, s1, s2;
|
1327
|
+
|
1328
|
+
s0 = peg$currPos;
|
1329
|
+
if (input.charCodeAt(peg$currPos) === 94) {
|
1330
|
+
s1 = peg$c48;
|
1331
|
+
peg$currPos++;
|
1332
|
+
} else {
|
1333
|
+
s1 = peg$FAILED;
|
1334
|
+
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
1335
|
+
}
|
1336
|
+
if (s1 !== peg$FAILED) {
|
1337
|
+
s2 = peg$parsedecimal_or_int_exp();
|
1338
|
+
if (s2 !== peg$FAILED) {
|
1339
|
+
peg$savedPos = s0;
|
1340
|
+
s1 = peg$c50(s2);
|
1341
|
+
s0 = s1;
|
1342
|
+
} else {
|
1343
|
+
peg$currPos = s0;
|
1344
|
+
s0 = peg$FAILED;
|
1345
|
+
}
|
1346
|
+
} else {
|
1347
|
+
peg$currPos = s0;
|
1348
|
+
s0 = peg$FAILED;
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
return s0;
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
function peg$parsefuzzy_modifier() {
|
1355
|
+
var s0, s1, s2;
|
1356
|
+
|
1357
|
+
s0 = peg$currPos;
|
1358
|
+
if (input.charCodeAt(peg$currPos) === 126) {
|
1359
|
+
s1 = peg$c45;
|
1360
|
+
peg$currPos++;
|
1361
|
+
} else {
|
1362
|
+
s1 = peg$FAILED;
|
1363
|
+
if (peg$silentFails === 0) { peg$fail(peg$c46); }
|
1364
|
+
}
|
1365
|
+
if (s1 !== peg$FAILED) {
|
1366
|
+
s2 = peg$parsedecimal_exp();
|
1367
|
+
if (s2 === peg$FAILED) {
|
1368
|
+
s2 = null;
|
1369
|
+
}
|
1370
|
+
if (s2 !== peg$FAILED) {
|
1371
|
+
peg$savedPos = s0;
|
1372
|
+
s1 = peg$c51(s2);
|
1373
|
+
s0 = s1;
|
1374
|
+
} else {
|
1375
|
+
peg$currPos = s0;
|
1376
|
+
s0 = peg$FAILED;
|
1377
|
+
}
|
1378
|
+
} else {
|
1379
|
+
peg$currPos = s0;
|
1380
|
+
s0 = peg$FAILED;
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
return s0;
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
function peg$parsedecimal_or_int_exp() {
|
1387
|
+
var s0;
|
1388
|
+
|
1389
|
+
s0 = peg$parsedecimal_exp();
|
1390
|
+
if (s0 === peg$FAILED) {
|
1391
|
+
s0 = peg$parseint_exp();
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
return s0;
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
function peg$parsedecimal_exp() {
|
1398
|
+
var s0, s1, s2, s3;
|
1399
|
+
|
1400
|
+
s0 = peg$currPos;
|
1401
|
+
if (input.substr(peg$currPos, 2) === peg$c52) {
|
1402
|
+
s1 = peg$c52;
|
1403
|
+
peg$currPos += 2;
|
1404
|
+
} else {
|
1405
|
+
s1 = peg$FAILED;
|
1406
|
+
if (peg$silentFails === 0) { peg$fail(peg$c53); }
|
1407
|
+
}
|
1408
|
+
if (s1 !== peg$FAILED) {
|
1409
|
+
s2 = [];
|
1410
|
+
if (peg$c54.test(input.charAt(peg$currPos))) {
|
1411
|
+
s3 = input.charAt(peg$currPos);
|
1412
|
+
peg$currPos++;
|
1413
|
+
} else {
|
1414
|
+
s3 = peg$FAILED;
|
1415
|
+
if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1416
|
+
}
|
1417
|
+
if (s3 !== peg$FAILED) {
|
1418
|
+
while (s3 !== peg$FAILED) {
|
1419
|
+
s2.push(s3);
|
1420
|
+
if (peg$c54.test(input.charAt(peg$currPos))) {
|
1421
|
+
s3 = input.charAt(peg$currPos);
|
1422
|
+
peg$currPos++;
|
1423
|
+
} else {
|
1424
|
+
s3 = peg$FAILED;
|
1425
|
+
if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
} else {
|
1429
|
+
s2 = peg$FAILED;
|
1430
|
+
}
|
1431
|
+
if (s2 !== peg$FAILED) {
|
1432
|
+
peg$savedPos = s0;
|
1433
|
+
s1 = peg$c56(s2);
|
1434
|
+
s0 = s1;
|
1435
|
+
} else {
|
1436
|
+
peg$currPos = s0;
|
1437
|
+
s0 = peg$FAILED;
|
1438
|
+
}
|
1439
|
+
} else {
|
1440
|
+
peg$currPos = s0;
|
1441
|
+
s0 = peg$FAILED;
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
return s0;
|
1445
|
+
}
|
1446
|
+
|
1447
|
+
function peg$parseint_exp() {
|
1448
|
+
var s0, s1, s2;
|
1449
|
+
|
1450
|
+
s0 = peg$currPos;
|
1451
|
+
s1 = [];
|
1452
|
+
if (peg$c54.test(input.charAt(peg$currPos))) {
|
1453
|
+
s2 = input.charAt(peg$currPos);
|
1454
|
+
peg$currPos++;
|
1455
|
+
} else {
|
1456
|
+
s2 = peg$FAILED;
|
1457
|
+
if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1458
|
+
}
|
1459
|
+
if (s2 !== peg$FAILED) {
|
1460
|
+
while (s2 !== peg$FAILED) {
|
1461
|
+
s1.push(s2);
|
1462
|
+
if (peg$c54.test(input.charAt(peg$currPos))) {
|
1463
|
+
s2 = input.charAt(peg$currPos);
|
1464
|
+
peg$currPos++;
|
1465
|
+
} else {
|
1466
|
+
s2 = peg$FAILED;
|
1467
|
+
if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
} else {
|
1471
|
+
s1 = peg$FAILED;
|
1472
|
+
}
|
1473
|
+
if (s1 !== peg$FAILED) {
|
1474
|
+
peg$savedPos = s0;
|
1475
|
+
s1 = peg$c57(s1);
|
1476
|
+
}
|
1477
|
+
s0 = s1;
|
1478
|
+
|
1479
|
+
return s0;
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
function peg$parserange_operator_exp() {
|
1483
|
+
var s0, s1, s2, s3, s4, s5, s6, s7;
|
1484
|
+
|
1485
|
+
s0 = peg$currPos;
|
1486
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
1487
|
+
s1 = peg$c58;
|
1488
|
+
peg$currPos++;
|
1489
|
+
} else {
|
1490
|
+
s1 = peg$FAILED;
|
1491
|
+
if (peg$silentFails === 0) { peg$fail(peg$c59); }
|
1492
|
+
}
|
1493
|
+
if (s1 !== peg$FAILED) {
|
1494
|
+
s2 = peg$parseunquoted_term();
|
1495
|
+
if (s2 !== peg$FAILED) {
|
1496
|
+
s3 = [];
|
1497
|
+
s4 = peg$parse_();
|
1498
|
+
while (s4 !== peg$FAILED) {
|
1499
|
+
s3.push(s4);
|
1500
|
+
s4 = peg$parse_();
|
1501
|
+
}
|
1502
|
+
if (s3 !== peg$FAILED) {
|
1503
|
+
if (input.substr(peg$currPos, 2) === peg$c60) {
|
1504
|
+
s4 = peg$c60;
|
1505
|
+
peg$currPos += 2;
|
1506
|
+
} else {
|
1507
|
+
s4 = peg$FAILED;
|
1508
|
+
if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
1509
|
+
}
|
1510
|
+
if (s4 !== peg$FAILED) {
|
1511
|
+
s5 = [];
|
1512
|
+
s6 = peg$parse_();
|
1513
|
+
if (s6 !== peg$FAILED) {
|
1514
|
+
while (s6 !== peg$FAILED) {
|
1515
|
+
s5.push(s6);
|
1516
|
+
s6 = peg$parse_();
|
1517
|
+
}
|
1518
|
+
} else {
|
1519
|
+
s5 = peg$FAILED;
|
1520
|
+
}
|
1521
|
+
if (s5 !== peg$FAILED) {
|
1522
|
+
s6 = peg$parseunquoted_term();
|
1523
|
+
if (s6 !== peg$FAILED) {
|
1524
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
1525
|
+
s7 = peg$c62;
|
1526
|
+
peg$currPos++;
|
1527
|
+
} else {
|
1528
|
+
s7 = peg$FAILED;
|
1529
|
+
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
1530
|
+
}
|
1531
|
+
if (s7 !== peg$FAILED) {
|
1532
|
+
peg$savedPos = s0;
|
1533
|
+
s1 = peg$c64(s2, s6);
|
1534
|
+
s0 = s1;
|
1535
|
+
} else {
|
1536
|
+
peg$currPos = s0;
|
1537
|
+
s0 = peg$FAILED;
|
1538
|
+
}
|
1539
|
+
} else {
|
1540
|
+
peg$currPos = s0;
|
1541
|
+
s0 = peg$FAILED;
|
1542
|
+
}
|
1543
|
+
} else {
|
1544
|
+
peg$currPos = s0;
|
1545
|
+
s0 = peg$FAILED;
|
1546
|
+
}
|
1547
|
+
} else {
|
1548
|
+
peg$currPos = s0;
|
1549
|
+
s0 = peg$FAILED;
|
1550
|
+
}
|
1551
|
+
} else {
|
1552
|
+
peg$currPos = s0;
|
1553
|
+
s0 = peg$FAILED;
|
1554
|
+
}
|
1555
|
+
} else {
|
1556
|
+
peg$currPos = s0;
|
1557
|
+
s0 = peg$FAILED;
|
1558
|
+
}
|
1559
|
+
} else {
|
1560
|
+
peg$currPos = s0;
|
1561
|
+
s0 = peg$FAILED;
|
1562
|
+
}
|
1563
|
+
if (s0 === peg$FAILED) {
|
1564
|
+
s0 = peg$currPos;
|
1565
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
1566
|
+
s1 = peg$c65;
|
1567
|
+
peg$currPos++;
|
1568
|
+
} else {
|
1569
|
+
s1 = peg$FAILED;
|
1570
|
+
if (peg$silentFails === 0) { peg$fail(peg$c66); }
|
1571
|
+
}
|
1572
|
+
if (s1 !== peg$FAILED) {
|
1573
|
+
s2 = peg$parseunquoted_term();
|
1574
|
+
if (s2 !== peg$FAILED) {
|
1575
|
+
s3 = [];
|
1576
|
+
s4 = peg$parse_();
|
1577
|
+
while (s4 !== peg$FAILED) {
|
1578
|
+
s3.push(s4);
|
1579
|
+
s4 = peg$parse_();
|
1580
|
+
}
|
1581
|
+
if (s3 !== peg$FAILED) {
|
1582
|
+
if (input.substr(peg$currPos, 2) === peg$c60) {
|
1583
|
+
s4 = peg$c60;
|
1584
|
+
peg$currPos += 2;
|
1585
|
+
} else {
|
1586
|
+
s4 = peg$FAILED;
|
1587
|
+
if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
1588
|
+
}
|
1589
|
+
if (s4 !== peg$FAILED) {
|
1590
|
+
s5 = [];
|
1591
|
+
s6 = peg$parse_();
|
1592
|
+
if (s6 !== peg$FAILED) {
|
1593
|
+
while (s6 !== peg$FAILED) {
|
1594
|
+
s5.push(s6);
|
1595
|
+
s6 = peg$parse_();
|
1596
|
+
}
|
1597
|
+
} else {
|
1598
|
+
s5 = peg$FAILED;
|
1599
|
+
}
|
1600
|
+
if (s5 !== peg$FAILED) {
|
1601
|
+
s6 = peg$parseunquoted_term();
|
1602
|
+
if (s6 !== peg$FAILED) {
|
1603
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
1604
|
+
s7 = peg$c67;
|
1605
|
+
peg$currPos++;
|
1606
|
+
} else {
|
1607
|
+
s7 = peg$FAILED;
|
1608
|
+
if (peg$silentFails === 0) { peg$fail(peg$c68); }
|
1609
|
+
}
|
1610
|
+
if (s7 !== peg$FAILED) {
|
1611
|
+
peg$savedPos = s0;
|
1612
|
+
s1 = peg$c69(s2, s6);
|
1613
|
+
s0 = s1;
|
1614
|
+
} else {
|
1615
|
+
peg$currPos = s0;
|
1616
|
+
s0 = peg$FAILED;
|
1617
|
+
}
|
1618
|
+
} else {
|
1619
|
+
peg$currPos = s0;
|
1620
|
+
s0 = peg$FAILED;
|
1621
|
+
}
|
1622
|
+
} else {
|
1623
|
+
peg$currPos = s0;
|
1624
|
+
s0 = peg$FAILED;
|
1625
|
+
}
|
1626
|
+
} else {
|
1627
|
+
peg$currPos = s0;
|
1628
|
+
s0 = peg$FAILED;
|
1629
|
+
}
|
1630
|
+
} else {
|
1631
|
+
peg$currPos = s0;
|
1632
|
+
s0 = peg$FAILED;
|
1633
|
+
}
|
1634
|
+
} else {
|
1635
|
+
peg$currPos = s0;
|
1636
|
+
s0 = peg$FAILED;
|
1637
|
+
}
|
1638
|
+
} else {
|
1639
|
+
peg$currPos = s0;
|
1640
|
+
s0 = peg$FAILED;
|
1641
|
+
}
|
1642
|
+
if (s0 === peg$FAILED) {
|
1643
|
+
s0 = peg$currPos;
|
1644
|
+
if (input.charCodeAt(peg$currPos) === 123) {
|
1645
|
+
s1 = peg$c65;
|
1646
|
+
peg$currPos++;
|
1647
|
+
} else {
|
1648
|
+
s1 = peg$FAILED;
|
1649
|
+
if (peg$silentFails === 0) { peg$fail(peg$c66); }
|
1650
|
+
}
|
1651
|
+
if (s1 !== peg$FAILED) {
|
1652
|
+
s2 = peg$parseunquoted_term();
|
1653
|
+
if (s2 !== peg$FAILED) {
|
1654
|
+
s3 = [];
|
1655
|
+
s4 = peg$parse_();
|
1656
|
+
while (s4 !== peg$FAILED) {
|
1657
|
+
s3.push(s4);
|
1658
|
+
s4 = peg$parse_();
|
1659
|
+
}
|
1660
|
+
if (s3 !== peg$FAILED) {
|
1661
|
+
if (input.substr(peg$currPos, 2) === peg$c60) {
|
1662
|
+
s4 = peg$c60;
|
1663
|
+
peg$currPos += 2;
|
1664
|
+
} else {
|
1665
|
+
s4 = peg$FAILED;
|
1666
|
+
if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
1667
|
+
}
|
1668
|
+
if (s4 !== peg$FAILED) {
|
1669
|
+
s5 = [];
|
1670
|
+
s6 = peg$parse_();
|
1671
|
+
if (s6 !== peg$FAILED) {
|
1672
|
+
while (s6 !== peg$FAILED) {
|
1673
|
+
s5.push(s6);
|
1674
|
+
s6 = peg$parse_();
|
1675
|
+
}
|
1676
|
+
} else {
|
1677
|
+
s5 = peg$FAILED;
|
1678
|
+
}
|
1679
|
+
if (s5 !== peg$FAILED) {
|
1680
|
+
s6 = peg$parseunquoted_term();
|
1681
|
+
if (s6 !== peg$FAILED) {
|
1682
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
1683
|
+
s7 = peg$c62;
|
1684
|
+
peg$currPos++;
|
1685
|
+
} else {
|
1686
|
+
s7 = peg$FAILED;
|
1687
|
+
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
1688
|
+
}
|
1689
|
+
if (s7 !== peg$FAILED) {
|
1690
|
+
peg$savedPos = s0;
|
1691
|
+
s1 = peg$c70(s2, s6);
|
1692
|
+
s0 = s1;
|
1693
|
+
} else {
|
1694
|
+
peg$currPos = s0;
|
1695
|
+
s0 = peg$FAILED;
|
1696
|
+
}
|
1697
|
+
} else {
|
1698
|
+
peg$currPos = s0;
|
1699
|
+
s0 = peg$FAILED;
|
1700
|
+
}
|
1701
|
+
} else {
|
1702
|
+
peg$currPos = s0;
|
1703
|
+
s0 = peg$FAILED;
|
1704
|
+
}
|
1705
|
+
} else {
|
1706
|
+
peg$currPos = s0;
|
1707
|
+
s0 = peg$FAILED;
|
1708
|
+
}
|
1709
|
+
} else {
|
1710
|
+
peg$currPos = s0;
|
1711
|
+
s0 = peg$FAILED;
|
1712
|
+
}
|
1713
|
+
} else {
|
1714
|
+
peg$currPos = s0;
|
1715
|
+
s0 = peg$FAILED;
|
1716
|
+
}
|
1717
|
+
} else {
|
1718
|
+
peg$currPos = s0;
|
1719
|
+
s0 = peg$FAILED;
|
1720
|
+
}
|
1721
|
+
if (s0 === peg$FAILED) {
|
1722
|
+
s0 = peg$currPos;
|
1723
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
1724
|
+
s1 = peg$c58;
|
1725
|
+
peg$currPos++;
|
1726
|
+
} else {
|
1727
|
+
s1 = peg$FAILED;
|
1728
|
+
if (peg$silentFails === 0) { peg$fail(peg$c59); }
|
1729
|
+
}
|
1730
|
+
if (s1 !== peg$FAILED) {
|
1731
|
+
s2 = peg$parseunquoted_term();
|
1732
|
+
if (s2 !== peg$FAILED) {
|
1733
|
+
s3 = [];
|
1734
|
+
s4 = peg$parse_();
|
1735
|
+
while (s4 !== peg$FAILED) {
|
1736
|
+
s3.push(s4);
|
1737
|
+
s4 = peg$parse_();
|
1738
|
+
}
|
1739
|
+
if (s3 !== peg$FAILED) {
|
1740
|
+
if (input.substr(peg$currPos, 2) === peg$c60) {
|
1741
|
+
s4 = peg$c60;
|
1742
|
+
peg$currPos += 2;
|
1743
|
+
} else {
|
1744
|
+
s4 = peg$FAILED;
|
1745
|
+
if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
1746
|
+
}
|
1747
|
+
if (s4 !== peg$FAILED) {
|
1748
|
+
s5 = [];
|
1749
|
+
s6 = peg$parse_();
|
1750
|
+
if (s6 !== peg$FAILED) {
|
1751
|
+
while (s6 !== peg$FAILED) {
|
1752
|
+
s5.push(s6);
|
1753
|
+
s6 = peg$parse_();
|
1754
|
+
}
|
1755
|
+
} else {
|
1756
|
+
s5 = peg$FAILED;
|
1757
|
+
}
|
1758
|
+
if (s5 !== peg$FAILED) {
|
1759
|
+
s6 = peg$parseunquoted_term();
|
1760
|
+
if (s6 !== peg$FAILED) {
|
1761
|
+
if (input.charCodeAt(peg$currPos) === 125) {
|
1762
|
+
s7 = peg$c67;
|
1763
|
+
peg$currPos++;
|
1764
|
+
} else {
|
1765
|
+
s7 = peg$FAILED;
|
1766
|
+
if (peg$silentFails === 0) { peg$fail(peg$c68); }
|
1767
|
+
}
|
1768
|
+
if (s7 !== peg$FAILED) {
|
1769
|
+
peg$savedPos = s0;
|
1770
|
+
s1 = peg$c71(s2, s6);
|
1771
|
+
s0 = s1;
|
1772
|
+
} else {
|
1773
|
+
peg$currPos = s0;
|
1774
|
+
s0 = peg$FAILED;
|
1775
|
+
}
|
1776
|
+
} else {
|
1777
|
+
peg$currPos = s0;
|
1778
|
+
s0 = peg$FAILED;
|
1779
|
+
}
|
1780
|
+
} else {
|
1781
|
+
peg$currPos = s0;
|
1782
|
+
s0 = peg$FAILED;
|
1783
|
+
}
|
1784
|
+
} else {
|
1785
|
+
peg$currPos = s0;
|
1786
|
+
s0 = peg$FAILED;
|
1787
|
+
}
|
1788
|
+
} else {
|
1789
|
+
peg$currPos = s0;
|
1790
|
+
s0 = peg$FAILED;
|
1791
|
+
}
|
1792
|
+
} else {
|
1793
|
+
peg$currPos = s0;
|
1794
|
+
s0 = peg$FAILED;
|
1795
|
+
}
|
1796
|
+
} else {
|
1797
|
+
peg$currPos = s0;
|
1798
|
+
s0 = peg$FAILED;
|
1799
|
+
}
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
}
|
1803
|
+
|
1804
|
+
return s0;
|
1805
|
+
}
|
1806
|
+
|
1807
|
+
function peg$parseoperator_exp() {
|
1808
|
+
var s0, s1, s2, s3, s4;
|
1809
|
+
|
1810
|
+
s0 = peg$currPos;
|
1811
|
+
s1 = [];
|
1812
|
+
s2 = peg$parse_();
|
1813
|
+
while (s2 !== peg$FAILED) {
|
1814
|
+
s1.push(s2);
|
1815
|
+
s2 = peg$parse_();
|
1816
|
+
}
|
1817
|
+
if (s1 !== peg$FAILED) {
|
1818
|
+
s2 = peg$parseoperator();
|
1819
|
+
if (s2 !== peg$FAILED) {
|
1820
|
+
s3 = [];
|
1821
|
+
s4 = peg$parse_();
|
1822
|
+
if (s4 !== peg$FAILED) {
|
1823
|
+
while (s4 !== peg$FAILED) {
|
1824
|
+
s3.push(s4);
|
1825
|
+
s4 = peg$parse_();
|
1826
|
+
}
|
1827
|
+
} else {
|
1828
|
+
s3 = peg$FAILED;
|
1829
|
+
}
|
1830
|
+
if (s3 !== peg$FAILED) {
|
1831
|
+
peg$savedPos = s0;
|
1832
|
+
s1 = peg$c72(s2);
|
1833
|
+
s0 = s1;
|
1834
|
+
} else {
|
1835
|
+
peg$currPos = s0;
|
1836
|
+
s0 = peg$FAILED;
|
1837
|
+
}
|
1838
|
+
} else {
|
1839
|
+
peg$currPos = s0;
|
1840
|
+
s0 = peg$FAILED;
|
1841
|
+
}
|
1842
|
+
} else {
|
1843
|
+
peg$currPos = s0;
|
1844
|
+
s0 = peg$FAILED;
|
1845
|
+
}
|
1846
|
+
if (s0 === peg$FAILED) {
|
1847
|
+
s0 = peg$currPos;
|
1848
|
+
s1 = [];
|
1849
|
+
s2 = peg$parse_();
|
1850
|
+
while (s2 !== peg$FAILED) {
|
1851
|
+
s1.push(s2);
|
1852
|
+
s2 = peg$parse_();
|
1853
|
+
}
|
1854
|
+
if (s1 !== peg$FAILED) {
|
1855
|
+
s2 = peg$parseoperator();
|
1856
|
+
if (s2 !== peg$FAILED) {
|
1857
|
+
s3 = peg$parseEOF();
|
1858
|
+
if (s3 !== peg$FAILED) {
|
1859
|
+
peg$savedPos = s0;
|
1860
|
+
s1 = peg$c72(s2);
|
1861
|
+
s0 = s1;
|
1862
|
+
} else {
|
1863
|
+
peg$currPos = s0;
|
1864
|
+
s0 = peg$FAILED;
|
1865
|
+
}
|
1866
|
+
} else {
|
1867
|
+
peg$currPos = s0;
|
1868
|
+
s0 = peg$FAILED;
|
1869
|
+
}
|
1870
|
+
} else {
|
1871
|
+
peg$currPos = s0;
|
1872
|
+
s0 = peg$FAILED;
|
1873
|
+
}
|
1874
|
+
}
|
1875
|
+
|
1876
|
+
return s0;
|
1877
|
+
}
|
1878
|
+
|
1879
|
+
function peg$parseoperator() {
|
1880
|
+
var s0, s1;
|
1881
|
+
|
1882
|
+
if (input.substr(peg$currPos, 2) === peg$c73) {
|
1883
|
+
s0 = peg$c73;
|
1884
|
+
peg$currPos += 2;
|
1885
|
+
} else {
|
1886
|
+
s0 = peg$FAILED;
|
1887
|
+
if (peg$silentFails === 0) { peg$fail(peg$c74); }
|
1888
|
+
}
|
1889
|
+
if (s0 === peg$FAILED) {
|
1890
|
+
if (input.substr(peg$currPos, 3) === peg$c75) {
|
1891
|
+
s0 = peg$c75;
|
1892
|
+
peg$currPos += 3;
|
1893
|
+
} else {
|
1894
|
+
s0 = peg$FAILED;
|
1895
|
+
if (peg$silentFails === 0) { peg$fail(peg$c76); }
|
1896
|
+
}
|
1897
|
+
if (s0 === peg$FAILED) {
|
1898
|
+
if (input.substr(peg$currPos, 3) === peg$c77) {
|
1899
|
+
s0 = peg$c77;
|
1900
|
+
peg$currPos += 3;
|
1901
|
+
} else {
|
1902
|
+
s0 = peg$FAILED;
|
1903
|
+
if (peg$silentFails === 0) { peg$fail(peg$c78); }
|
1904
|
+
}
|
1905
|
+
if (s0 === peg$FAILED) {
|
1906
|
+
s0 = peg$currPos;
|
1907
|
+
if (input.substr(peg$currPos, 3) === peg$c79) {
|
1908
|
+
s1 = peg$c79;
|
1909
|
+
peg$currPos += 3;
|
1910
|
+
} else {
|
1911
|
+
s1 = peg$FAILED;
|
1912
|
+
if (peg$silentFails === 0) { peg$fail(peg$c80); }
|
1913
|
+
}
|
1914
|
+
if (s1 !== peg$FAILED) {
|
1915
|
+
peg$savedPos = s0;
|
1916
|
+
s1 = peg$c81();
|
1917
|
+
}
|
1918
|
+
s0 = s1;
|
1919
|
+
if (s0 === peg$FAILED) {
|
1920
|
+
s0 = peg$currPos;
|
1921
|
+
if (input.substr(peg$currPos, 2) === peg$c82) {
|
1922
|
+
s1 = peg$c82;
|
1923
|
+
peg$currPos += 2;
|
1924
|
+
} else {
|
1925
|
+
s1 = peg$FAILED;
|
1926
|
+
if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
1927
|
+
}
|
1928
|
+
if (s1 !== peg$FAILED) {
|
1929
|
+
peg$savedPos = s0;
|
1930
|
+
s1 = peg$c84();
|
1931
|
+
}
|
1932
|
+
s0 = s1;
|
1933
|
+
if (s0 === peg$FAILED) {
|
1934
|
+
s0 = peg$currPos;
|
1935
|
+
if (input.substr(peg$currPos, 2) === peg$c85) {
|
1936
|
+
s1 = peg$c85;
|
1937
|
+
peg$currPos += 2;
|
1938
|
+
} else {
|
1939
|
+
s1 = peg$FAILED;
|
1940
|
+
if (peg$silentFails === 0) { peg$fail(peg$c86); }
|
1941
|
+
}
|
1942
|
+
if (s1 !== peg$FAILED) {
|
1943
|
+
peg$savedPos = s0;
|
1944
|
+
s1 = peg$c84();
|
1945
|
+
}
|
1946
|
+
s0 = s1;
|
1947
|
+
if (s0 === peg$FAILED) {
|
1948
|
+
s0 = peg$currPos;
|
1949
|
+
if (input.substr(peg$currPos, 2) === peg$c87) {
|
1950
|
+
s1 = peg$c87;
|
1951
|
+
peg$currPos += 2;
|
1952
|
+
} else {
|
1953
|
+
s1 = peg$FAILED;
|
1954
|
+
if (peg$silentFails === 0) { peg$fail(peg$c88); }
|
1955
|
+
}
|
1956
|
+
if (s1 !== peg$FAILED) {
|
1957
|
+
peg$savedPos = s0;
|
1958
|
+
s1 = peg$c81();
|
1959
|
+
}
|
1960
|
+
s0 = s1;
|
1961
|
+
if (s0 === peg$FAILED) {
|
1962
|
+
s0 = peg$currPos;
|
1963
|
+
if (input.charCodeAt(peg$currPos) === 33) {
|
1964
|
+
s1 = peg$c89;
|
1965
|
+
peg$currPos++;
|
1966
|
+
} else {
|
1967
|
+
s1 = peg$FAILED;
|
1968
|
+
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
1969
|
+
}
|
1970
|
+
if (s1 !== peg$FAILED) {
|
1971
|
+
peg$savedPos = s0;
|
1972
|
+
s1 = peg$c91();
|
1973
|
+
}
|
1974
|
+
s0 = s1;
|
1975
|
+
}
|
1976
|
+
}
|
1977
|
+
}
|
1978
|
+
}
|
1979
|
+
}
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
return s0;
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
function peg$parseprefix_operator_exp() {
|
1987
|
+
var s0, s1, s2, s3, s4;
|
1988
|
+
|
1989
|
+
s0 = peg$currPos;
|
1990
|
+
s1 = [];
|
1991
|
+
s2 = peg$parse_();
|
1992
|
+
while (s2 !== peg$FAILED) {
|
1993
|
+
s1.push(s2);
|
1994
|
+
s2 = peg$parse_();
|
1995
|
+
}
|
1996
|
+
if (s1 !== peg$FAILED) {
|
1997
|
+
s2 = peg$parseprefix_operator();
|
1998
|
+
if (s2 !== peg$FAILED) {
|
1999
|
+
s3 = [];
|
2000
|
+
s4 = peg$parse_();
|
2001
|
+
while (s4 !== peg$FAILED) {
|
2002
|
+
s3.push(s4);
|
2003
|
+
s4 = peg$parse_();
|
2004
|
+
}
|
2005
|
+
if (s3 !== peg$FAILED) {
|
2006
|
+
peg$savedPos = s0;
|
2007
|
+
s1 = peg$c72(s2);
|
2008
|
+
s0 = s1;
|
2009
|
+
} else {
|
2010
|
+
peg$currPos = s0;
|
2011
|
+
s0 = peg$FAILED;
|
2012
|
+
}
|
2013
|
+
} else {
|
2014
|
+
peg$currPos = s0;
|
2015
|
+
s0 = peg$FAILED;
|
2016
|
+
}
|
2017
|
+
} else {
|
2018
|
+
peg$currPos = s0;
|
2019
|
+
s0 = peg$FAILED;
|
2020
|
+
}
|
2021
|
+
|
2022
|
+
return s0;
|
2023
|
+
}
|
2024
|
+
|
2025
|
+
function peg$parseprefix_operator() {
|
2026
|
+
var s0;
|
2027
|
+
|
2028
|
+
if (input.charCodeAt(peg$currPos) === 43) {
|
2029
|
+
s0 = peg$c29;
|
2030
|
+
peg$currPos++;
|
2031
|
+
} else {
|
2032
|
+
s0 = peg$FAILED;
|
2033
|
+
if (peg$silentFails === 0) { peg$fail(peg$c30); }
|
2034
|
+
}
|
2035
|
+
if (s0 === peg$FAILED) {
|
2036
|
+
if (input.charCodeAt(peg$currPos) === 45) {
|
2037
|
+
s0 = peg$c31;
|
2038
|
+
peg$currPos++;
|
2039
|
+
} else {
|
2040
|
+
s0 = peg$FAILED;
|
2041
|
+
if (peg$silentFails === 0) { peg$fail(peg$c32); }
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
return s0;
|
2046
|
+
}
|
2047
|
+
|
2048
|
+
function peg$parse_() {
|
2049
|
+
var s0, s1;
|
2050
|
+
|
2051
|
+
peg$silentFails++;
|
2052
|
+
s0 = [];
|
2053
|
+
if (peg$c93.test(input.charAt(peg$currPos))) {
|
2054
|
+
s1 = input.charAt(peg$currPos);
|
2055
|
+
peg$currPos++;
|
2056
|
+
} else {
|
2057
|
+
s1 = peg$FAILED;
|
2058
|
+
if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
2059
|
+
}
|
2060
|
+
if (s1 !== peg$FAILED) {
|
2061
|
+
while (s1 !== peg$FAILED) {
|
2062
|
+
s0.push(s1);
|
2063
|
+
if (peg$c93.test(input.charAt(peg$currPos))) {
|
2064
|
+
s1 = input.charAt(peg$currPos);
|
2065
|
+
peg$currPos++;
|
2066
|
+
} else {
|
2067
|
+
s1 = peg$FAILED;
|
2068
|
+
if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
2069
|
+
}
|
2070
|
+
}
|
2071
|
+
} else {
|
2072
|
+
s0 = peg$FAILED;
|
2073
|
+
}
|
2074
|
+
peg$silentFails--;
|
2075
|
+
if (s0 === peg$FAILED) {
|
2076
|
+
s1 = peg$FAILED;
|
2077
|
+
if (peg$silentFails === 0) { peg$fail(peg$c92); }
|
2078
|
+
}
|
2079
|
+
|
2080
|
+
return s0;
|
2081
|
+
}
|
2082
|
+
|
2083
|
+
function peg$parseEOF() {
|
2084
|
+
var s0, s1;
|
2085
|
+
|
2086
|
+
s0 = peg$currPos;
|
2087
|
+
peg$silentFails++;
|
2088
|
+
if (input.length > peg$currPos) {
|
2089
|
+
s1 = input.charAt(peg$currPos);
|
2090
|
+
peg$currPos++;
|
2091
|
+
} else {
|
2092
|
+
s1 = peg$FAILED;
|
2093
|
+
if (peg$silentFails === 0) { peg$fail(peg$c95); }
|
2094
|
+
}
|
2095
|
+
peg$silentFails--;
|
2096
|
+
if (s1 === peg$FAILED) {
|
2097
|
+
s0 = void 0;
|
2098
|
+
} else {
|
2099
|
+
peg$currPos = s0;
|
2100
|
+
s0 = peg$FAILED;
|
2101
|
+
}
|
2102
|
+
|
2103
|
+
return s0;
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
peg$result = peg$startRuleFunction();
|
2107
|
+
|
2108
|
+
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
2109
|
+
return peg$result;
|
2110
|
+
} else {
|
2111
|
+
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
2112
|
+
peg$fail(peg$endExpectation());
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
throw peg$buildStructuredError(
|
2116
|
+
peg$maxFailExpected,
|
2117
|
+
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
2118
|
+
peg$maxFailPos < input.length
|
2119
|
+
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
2120
|
+
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
2121
|
+
);
|
2122
|
+
}
|
2123
|
+
}
|
2124
|
+
|
2125
|
+
module.exports = {
|
2126
|
+
SyntaxError: peg$SyntaxError,
|
2127
|
+
parse: peg$parse
|
2128
|
+
};
|