source: frontend/node_modules/esquery/parser.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

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