UNPKG

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