UNPKG

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