1 | export default |
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function() {
|
7 | "use strict";
|
8 |
|
9 | function peg$subclass(child, parent) {
|
10 | function ctor() { this.constructor = child; }
|
11 | ctor.prototype = parent.prototype;
|
12 | child.prototype = new ctor();
|
13 | }
|
14 |
|
15 | function peg$SyntaxError(message, expected, found, location) {
|
16 | this.message = message;
|
17 | this.expected = expected;
|
18 | this.found = found;
|
19 | this.location = location;
|
20 | this.name = "SyntaxError";
|
21 |
|
22 | if (typeof Error.captureStackTrace === "function") {
|
23 | Error.captureStackTrace(this, peg$SyntaxError);
|
24 | }
|
25 | }
|
26 |
|
27 | peg$subclass(peg$SyntaxError, Error);
|
28 |
|
29 | peg$SyntaxError.buildMessage = function(expected, found) {
|
30 | var DESCRIBE_EXPECTATION_FNS = {
|
31 | literal: function(expectation) {
|
32 | return "\"" + literalEscape(expectation.text) + "\"";
|
33 | },
|
34 |
|
35 | "class": function(expectation) {
|
36 | var escapedParts = "",
|
37 | i;
|
38 |
|
39 | for (i = 0; i < expectation.parts.length; i++) {
|
40 | escapedParts += expectation.parts[i] instanceof Array
|
41 | ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
|
42 | : classEscape(expectation.parts[i]);
|
43 | }
|
44 |
|
45 | return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
46 | },
|
47 |
|
48 | any: function(expectation) {
|
49 | return "any character";
|
50 | },
|
51 |
|
52 | end: function(expectation) {
|
53 | return "end of input";
|
54 | },
|
55 |
|
56 | other: function(expectation) {
|
57 | return expectation.description;
|
58 | }
|
59 | };
|
60 |
|
61 | function hex(ch) {
|
62 | return ch.charCodeAt(0).toString(16).toUpperCase();
|
63 | }
|
64 |
|
65 | function literalEscape(s) {
|
66 | return s
|
67 | .replace(/\\/g, '\\\\')
|
68 | .replace(/"/g, '\\"')
|
69 | .replace(/\0/g, '\\0')
|
70 | .replace(/\t/g, '\\t')
|
71 | .replace(/\n/g, '\\n')
|
72 | .replace(/\r/g, '\\r')
|
73 | .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
74 | .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
75 | }
|
76 |
|
77 | function classEscape(s) {
|
78 | return s
|
79 | .replace(/\\/g, '\\\\')
|
80 | .replace(/\]/g, '\\]')
|
81 | .replace(/\^/g, '\\^')
|
82 | .replace(/-/g, '\\-')
|
83 | .replace(/\0/g, '\\0')
|
84 | .replace(/\t/g, '\\t')
|
85 | .replace(/\n/g, '\\n')
|
86 | .replace(/\r/g, '\\r')
|
87 | .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
88 | .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
|
89 | }
|
90 |
|
91 | function describeExpectation(expectation) {
|
92 | return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
93 | }
|
94 |
|
95 | function describeExpected(expected) {
|
96 | var descriptions = new Array(expected.length),
|
97 | i, j;
|
98 |
|
99 | for (i = 0; i < expected.length; i++) {
|
100 | descriptions[i] = describeExpectation(expected[i]);
|
101 | }
|
102 |
|
103 | descriptions.sort();
|
104 |
|
105 | if (descriptions.length > 0) {
|
106 | for (i = 1, j = 1; i < descriptions.length; i++) {
|
107 | if (descriptions[i - 1] !== descriptions[i]) {
|
108 | descriptions[j] = descriptions[i];
|
109 | j++;
|
110 | }
|
111 | }
|
112 | descriptions.length = j;
|
113 | }
|
114 |
|
115 | switch (descriptions.length) {
|
116 | case 1:
|
117 | return descriptions[0];
|
118 |
|
119 | case 2:
|
120 | return descriptions[0] + " or " + descriptions[1];
|
121 |
|
122 | default:
|
123 | return descriptions.slice(0, -1).join(", ")
|
124 | + ", or "
|
125 | + descriptions[descriptions.length - 1];
|
126 | }
|
127 | }
|
128 |
|
129 | function describeFound(found) {
|
130 | return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
131 | }
|
132 |
|
133 | return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
134 | };
|
135 |
|
136 | function peg$parse(input, options) {
|
137 | options = options !== void 0 ? options : {};
|
138 |
|
139 | var peg$FAILED = {},
|
140 |
|
141 | peg$startRuleFunctions = { start: peg$parsestart },
|
142 | peg$startRuleFunction = peg$parsestart,
|
143 |
|
144 | peg$c0 = function(elements) {
|
145 | return {
|
146 | type : 'messageFormatPattern',
|
147 | elements: elements,
|
148 | location: location()
|
149 | };
|
150 | },
|
151 | peg$c1 = function(chunks) {
|
152 | return chunks.reduce(function (all, chunk) {
|
153 | return all.concat(chunk)
|
154 | }, []).join('')
|
155 | },
|
156 | peg$c2 = function(messageText) {
|
157 | return {
|
158 | type : 'messageTextElement',
|
159 | value: messageText,
|
160 | location: location()
|
161 | };
|
162 | },
|
163 | peg$c3 = /^[^ \t\n\r,.+={}#]/,
|
164 | peg$c4 = peg$classExpectation([" ", "\t", "\n", "\r", ",", ".", "+", "=", "{", "}", "#"], true, false),
|
165 | peg$c5 = "{",
|
166 | peg$c6 = peg$literalExpectation("{", false),
|
167 | peg$c7 = ",",
|
168 | peg$c8 = peg$literalExpectation(",", false),
|
169 | peg$c9 = "}",
|
170 | peg$c10 = peg$literalExpectation("}", false),
|
171 | peg$c11 = function(id, format) {
|
172 | return {
|
173 | type : 'argumentElement',
|
174 | id : id,
|
175 | format: format && format[2],
|
176 | location: location()
|
177 | };
|
178 | },
|
179 | peg$c12 = "number",
|
180 | peg$c13 = peg$literalExpectation("number", false),
|
181 | peg$c14 = "date",
|
182 | peg$c15 = peg$literalExpectation("date", false),
|
183 | peg$c16 = "time",
|
184 | peg$c17 = peg$literalExpectation("time", false),
|
185 | peg$c18 = function(type, style) {
|
186 | return {
|
187 | type : type + 'Format',
|
188 | style: style && style[2],
|
189 | location: location()
|
190 | };
|
191 | },
|
192 | peg$c19 = "plural",
|
193 | peg$c20 = peg$literalExpectation("plural", false),
|
194 | peg$c21 = function(pluralStyle) {
|
195 | return {
|
196 | type : pluralStyle.type,
|
197 | ordinal: false,
|
198 | offset : pluralStyle.offset || 0,
|
199 | options: pluralStyle.options,
|
200 | location: location()
|
201 | };
|
202 | },
|
203 | peg$c22 = "selectordinal",
|
204 | peg$c23 = peg$literalExpectation("selectordinal", false),
|
205 | peg$c24 = function(pluralStyle) {
|
206 | return {
|
207 | type : pluralStyle.type,
|
208 | ordinal: true,
|
209 | offset : pluralStyle.offset || 0,
|
210 | options: pluralStyle.options,
|
211 | location: location()
|
212 | }
|
213 | },
|
214 | peg$c25 = "select",
|
215 | peg$c26 = peg$literalExpectation("select", false),
|
216 | peg$c27 = function(options) {
|
217 | return {
|
218 | type : 'selectFormat',
|
219 | options: options,
|
220 | location: location()
|
221 | };
|
222 | },
|
223 | peg$c28 = "=",
|
224 | peg$c29 = peg$literalExpectation("=", false),
|
225 | peg$c30 = function(selector, pattern) {
|
226 | return {
|
227 | type : 'optionalFormatPattern',
|
228 | selector: selector,
|
229 | value : pattern,
|
230 | location: location()
|
231 | };
|
232 | },
|
233 | peg$c31 = "offset:",
|
234 | peg$c32 = peg$literalExpectation("offset:", false),
|
235 | peg$c33 = function(number) {
|
236 | return number;
|
237 | },
|
238 | peg$c34 = function(offset, options) {
|
239 | return {
|
240 | type : 'pluralFormat',
|
241 | offset : offset,
|
242 | options: options,
|
243 | location: location()
|
244 | };
|
245 | },
|
246 | peg$c35 = peg$otherExpectation("whitespace"),
|
247 | peg$c36 = /^[ \t\n\r]/,
|
248 | peg$c37 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false),
|
249 | peg$c38 = peg$otherExpectation("optionalWhitespace"),
|
250 | peg$c39 = /^[0-9]/,
|
251 | peg$c40 = peg$classExpectation([["0", "9"]], false, false),
|
252 | peg$c41 = /^[0-9a-f]/i,
|
253 | peg$c42 = peg$classExpectation([["0", "9"], ["a", "f"]], false, true),
|
254 | peg$c43 = "0",
|
255 | peg$c44 = peg$literalExpectation("0", false),
|
256 | peg$c45 = /^[1-9]/,
|
257 | peg$c46 = peg$classExpectation([["1", "9"]], false, false),
|
258 | peg$c47 = function(digits) {
|
259 | return parseInt(digits, 10);
|
260 | },
|
261 | peg$c48 = /^[^{}\\\0-\x1F\x7F \t\n\r]/,
|
262 | peg$c49 = peg$classExpectation(["{", "}", "\\", ["\0", "\x1F"], "\x7F", " ", "\t", "\n", "\r"], true, false),
|
263 | peg$c50 = "\\\\",
|
264 | peg$c51 = peg$literalExpectation("\\\\", false),
|
265 | peg$c52 = function() { return '\\'; },
|
266 | peg$c53 = "\\#",
|
267 | peg$c54 = peg$literalExpectation("\\#", false),
|
268 | peg$c55 = function() { return '\\#'; },
|
269 | peg$c56 = "\\{",
|
270 | peg$c57 = peg$literalExpectation("\\{", false),
|
271 | peg$c58 = function() { return '\u007B'; },
|
272 | peg$c59 = "\\}",
|
273 | peg$c60 = peg$literalExpectation("\\}", false),
|
274 | peg$c61 = function() { return '\u007D'; },
|
275 | peg$c62 = "\\u",
|
276 | peg$c63 = peg$literalExpectation("\\u", false),
|
277 | peg$c64 = function(digits) {
|
278 | return String.fromCharCode(parseInt(digits, 16));
|
279 | },
|
280 | peg$c65 = function(chars) { return chars.join(''); },
|
281 |
|
282 | peg$currPos = 0,
|
283 | peg$savedPos = 0,
|
284 | peg$posDetailsCache = [{ line: 1, column: 1 }],
|
285 | peg$maxFailPos = 0,
|
286 | peg$maxFailExpected = [],
|
287 | peg$silentFails = 0,
|
288 |
|
289 | peg$result;
|
290 |
|
291 | if ("startRule" in options) {
|
292 | if (!(options.startRule in peg$startRuleFunctions)) {
|
293 | throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
294 | }
|
295 |
|
296 | peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
297 | }
|
298 |
|
299 | function text() {
|
300 | return input.substring(peg$savedPos, peg$currPos);
|
301 | }
|
302 |
|
303 | function location() {
|
304 | return peg$computeLocation(peg$savedPos, peg$currPos);
|
305 | }
|
306 |
|
307 | function expected(description, location) {
|
308 | location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
309 |
|
310 | throw peg$buildStructuredError(
|
311 | [peg$otherExpectation(description)],
|
312 | input.substring(peg$savedPos, peg$currPos),
|
313 | location
|
314 | );
|
315 | }
|
316 |
|
317 | function error(message, location) {
|
318 | location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
319 |
|
320 | throw peg$buildSimpleError(message, location);
|
321 | }
|
322 |
|
323 | function peg$literalExpectation(text, ignoreCase) {
|
324 | return { type: "literal", text: text, ignoreCase: ignoreCase };
|
325 | }
|
326 |
|
327 | function peg$classExpectation(parts, inverted, ignoreCase) {
|
328 | return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
329 | }
|
330 |
|
331 | function peg$anyExpectation() {
|
332 | return { type: "any" };
|
333 | }
|
334 |
|
335 | function peg$endExpectation() {
|
336 | return { type: "end" };
|
337 | }
|
338 |
|
339 | function peg$otherExpectation(description) {
|
340 | return { type: "other", description: description };
|
341 | }
|
342 |
|
343 | function peg$computePosDetails(pos) {
|
344 | var details = peg$posDetailsCache[pos], p;
|
345 |
|
346 | if (details) {
|
347 | return details;
|
348 | } else {
|
349 | p = pos - 1;
|
350 | while (!peg$posDetailsCache[p]) {
|
351 | p--;
|
352 | }
|
353 |
|
354 | details = peg$posDetailsCache[p];
|
355 | details = {
|
356 | line: details.line,
|
357 | column: details.column
|
358 | };
|
359 |
|
360 | while (p < pos) {
|
361 | if (input.charCodeAt(p) === 10) {
|
362 | details.line++;
|
363 | details.column = 1;
|
364 | } else {
|
365 | details.column++;
|
366 | }
|
367 |
|
368 | p++;
|
369 | }
|
370 |
|
371 | peg$posDetailsCache[pos] = details;
|
372 | return details;
|
373 | }
|
374 | }
|
375 |
|
376 | function peg$computeLocation(startPos, endPos) {
|
377 | var startPosDetails = peg$computePosDetails(startPos),
|
378 | endPosDetails = peg$computePosDetails(endPos);
|
379 |
|
380 | return {
|
381 | start: {
|
382 | offset: startPos,
|
383 | line: startPosDetails.line,
|
384 | column: startPosDetails.column
|
385 | },
|
386 | end: {
|
387 | offset: endPos,
|
388 | line: endPosDetails.line,
|
389 | column: endPosDetails.column
|
390 | }
|
391 | };
|
392 | }
|
393 |
|
394 | function peg$fail(expected) {
|
395 | if (peg$currPos < peg$maxFailPos) { return; }
|
396 |
|
397 | if (peg$currPos > peg$maxFailPos) {
|
398 | peg$maxFailPos = peg$currPos;
|
399 | peg$maxFailExpected = [];
|
400 | }
|
401 |
|
402 | peg$maxFailExpected.push(expected);
|
403 | }
|
404 |
|
405 | function peg$buildSimpleError(message, location) {
|
406 | return new peg$SyntaxError(message, null, null, location);
|
407 | }
|
408 |
|
409 | function peg$buildStructuredError(expected, found, location) {
|
410 | return new peg$SyntaxError(
|
411 | peg$SyntaxError.buildMessage(expected, found),
|
412 | expected,
|
413 | found,
|
414 | location
|
415 | );
|
416 | }
|
417 |
|
418 | function peg$parsestart() {
|
419 | var s0;
|
420 |
|
421 | s0 = peg$parsemessageFormatPattern();
|
422 |
|
423 | return s0;
|
424 | }
|
425 |
|
426 | function peg$parsemessageFormatPattern() {
|
427 | var s0, s1, s2;
|
428 |
|
429 | s0 = peg$currPos;
|
430 | s1 = [];
|
431 | s2 = peg$parsemessageFormatElement();
|
432 | while (s2 !== peg$FAILED) {
|
433 | s1.push(s2);
|
434 | s2 = peg$parsemessageFormatElement();
|
435 | }
|
436 | if (s1 !== peg$FAILED) {
|
437 | peg$savedPos = s0;
|
438 | s1 = peg$c0(s1);
|
439 | }
|
440 | s0 = s1;
|
441 |
|
442 | return s0;
|
443 | }
|
444 |
|
445 | function peg$parsemessageFormatElement() {
|
446 | var s0;
|
447 |
|
448 | s0 = peg$parsemessageTextElement();
|
449 | if (s0 === peg$FAILED) {
|
450 | s0 = peg$parseargumentElement();
|
451 | }
|
452 |
|
453 | return s0;
|
454 | }
|
455 |
|
456 | function peg$parsemessageText() {
|
457 | var s0, s1, s2, s3, s4, s5;
|
458 |
|
459 | s0 = peg$currPos;
|
460 | s1 = [];
|
461 | s2 = peg$currPos;
|
462 | s3 = peg$parse_();
|
463 | if (s3 !== peg$FAILED) {
|
464 | s4 = peg$parsechars();
|
465 | if (s4 !== peg$FAILED) {
|
466 | s5 = peg$parse_();
|
467 | if (s5 !== peg$FAILED) {
|
468 | s3 = [s3, s4, s5];
|
469 | s2 = s3;
|
470 | } else {
|
471 | peg$currPos = s2;
|
472 | s2 = peg$FAILED;
|
473 | }
|
474 | } else {
|
475 | peg$currPos = s2;
|
476 | s2 = peg$FAILED;
|
477 | }
|
478 | } else {
|
479 | peg$currPos = s2;
|
480 | s2 = peg$FAILED;
|
481 | }
|
482 | if (s2 !== peg$FAILED) {
|
483 | while (s2 !== peg$FAILED) {
|
484 | s1.push(s2);
|
485 | s2 = peg$currPos;
|
486 | s3 = peg$parse_();
|
487 | if (s3 !== peg$FAILED) {
|
488 | s4 = peg$parsechars();
|
489 | if (s4 !== peg$FAILED) {
|
490 | s5 = peg$parse_();
|
491 | if (s5 !== peg$FAILED) {
|
492 | s3 = [s3, s4, s5];
|
493 | s2 = s3;
|
494 | } else {
|
495 | peg$currPos = s2;
|
496 | s2 = peg$FAILED;
|
497 | }
|
498 | } else {
|
499 | peg$currPos = s2;
|
500 | s2 = peg$FAILED;
|
501 | }
|
502 | } else {
|
503 | peg$currPos = s2;
|
504 | s2 = peg$FAILED;
|
505 | }
|
506 | }
|
507 | } else {
|
508 | s1 = peg$FAILED;
|
509 | }
|
510 | if (s1 !== peg$FAILED) {
|
511 | peg$savedPos = s0;
|
512 | s1 = peg$c1(s1);
|
513 | }
|
514 | s0 = s1;
|
515 | if (s0 === peg$FAILED) {
|
516 | s0 = peg$currPos;
|
517 | s1 = peg$parsews();
|
518 | if (s1 !== peg$FAILED) {
|
519 | s0 = input.substring(s0, peg$currPos);
|
520 | } else {
|
521 | s0 = s1;
|
522 | }
|
523 | }
|
524 |
|
525 | return s0;
|
526 | }
|
527 |
|
528 | function peg$parsemessageTextElement() {
|
529 | var s0, s1;
|
530 |
|
531 | s0 = peg$currPos;
|
532 | s1 = peg$parsemessageText();
|
533 | if (s1 !== peg$FAILED) {
|
534 | peg$savedPos = s0;
|
535 | s1 = peg$c2(s1);
|
536 | }
|
537 | s0 = s1;
|
538 |
|
539 | return s0;
|
540 | }
|
541 |
|
542 | function peg$parseargument() {
|
543 | var s0, s1, s2;
|
544 |
|
545 | s0 = peg$parsenumber();
|
546 | if (s0 === peg$FAILED) {
|
547 | s0 = peg$currPos;
|
548 | s1 = [];
|
549 | if (peg$c3.test(input.charAt(peg$currPos))) {
|
550 | s2 = input.charAt(peg$currPos);
|
551 | peg$currPos++;
|
552 | } else {
|
553 | s2 = peg$FAILED;
|
554 | if (peg$silentFails === 0) { peg$fail(peg$c4); }
|
555 | }
|
556 | if (s2 !== peg$FAILED) {
|
557 | while (s2 !== peg$FAILED) {
|
558 | s1.push(s2);
|
559 | if (peg$c3.test(input.charAt(peg$currPos))) {
|
560 | s2 = input.charAt(peg$currPos);
|
561 | peg$currPos++;
|
562 | } else {
|
563 | s2 = peg$FAILED;
|
564 | if (peg$silentFails === 0) { peg$fail(peg$c4); }
|
565 | }
|
566 | }
|
567 | } else {
|
568 | s1 = peg$FAILED;
|
569 | }
|
570 | if (s1 !== peg$FAILED) {
|
571 | s0 = input.substring(s0, peg$currPos);
|
572 | } else {
|
573 | s0 = s1;
|
574 | }
|
575 | }
|
576 |
|
577 | return s0;
|
578 | }
|
579 |
|
580 | function peg$parseargumentElement() {
|
581 | var s0, s1, s2, s3, s4, s5, s6, s7, s8;
|
582 |
|
583 | s0 = peg$currPos;
|
584 | if (input.charCodeAt(peg$currPos) === 123) {
|
585 | s1 = peg$c5;
|
586 | peg$currPos++;
|
587 | } else {
|
588 | s1 = peg$FAILED;
|
589 | if (peg$silentFails === 0) { peg$fail(peg$c6); }
|
590 | }
|
591 | if (s1 !== peg$FAILED) {
|
592 | s2 = peg$parse_();
|
593 | if (s2 !== peg$FAILED) {
|
594 | s3 = peg$parseargument();
|
595 | if (s3 !== peg$FAILED) {
|
596 | s4 = peg$parse_();
|
597 | if (s4 !== peg$FAILED) {
|
598 | s5 = peg$currPos;
|
599 | if (input.charCodeAt(peg$currPos) === 44) {
|
600 | s6 = peg$c7;
|
601 | peg$currPos++;
|
602 | } else {
|
603 | s6 = peg$FAILED;
|
604 | if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
605 | }
|
606 | if (s6 !== peg$FAILED) {
|
607 | s7 = peg$parse_();
|
608 | if (s7 !== peg$FAILED) {
|
609 | s8 = peg$parseelementFormat();
|
610 | if (s8 !== peg$FAILED) {
|
611 | s6 = [s6, s7, s8];
|
612 | s5 = s6;
|
613 | } else {
|
614 | peg$currPos = s5;
|
615 | s5 = peg$FAILED;
|
616 | }
|
617 | } else {
|
618 | peg$currPos = s5;
|
619 | s5 = peg$FAILED;
|
620 | }
|
621 | } else {
|
622 | peg$currPos = s5;
|
623 | s5 = peg$FAILED;
|
624 | }
|
625 | if (s5 === peg$FAILED) {
|
626 | s5 = null;
|
627 | }
|
628 | if (s5 !== peg$FAILED) {
|
629 | s6 = peg$parse_();
|
630 | if (s6 !== peg$FAILED) {
|
631 | if (input.charCodeAt(peg$currPos) === 125) {
|
632 | s7 = peg$c9;
|
633 | peg$currPos++;
|
634 | } else {
|
635 | s7 = peg$FAILED;
|
636 | if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
637 | }
|
638 | if (s7 !== peg$FAILED) {
|
639 | peg$savedPos = s0;
|
640 | s1 = peg$c11(s3, s5);
|
641 | s0 = s1;
|
642 | } else {
|
643 | peg$currPos = s0;
|
644 | s0 = peg$FAILED;
|
645 | }
|
646 | } else {
|
647 | peg$currPos = s0;
|
648 | s0 = peg$FAILED;
|
649 | }
|
650 | } else {
|
651 | peg$currPos = s0;
|
652 | s0 = peg$FAILED;
|
653 | }
|
654 | } else {
|
655 | peg$currPos = s0;
|
656 | s0 = peg$FAILED;
|
657 | }
|
658 | } else {
|
659 | peg$currPos = s0;
|
660 | s0 = peg$FAILED;
|
661 | }
|
662 | } else {
|
663 | peg$currPos = s0;
|
664 | s0 = peg$FAILED;
|
665 | }
|
666 | } else {
|
667 | peg$currPos = s0;
|
668 | s0 = peg$FAILED;
|
669 | }
|
670 |
|
671 | return s0;
|
672 | }
|
673 |
|
674 | function peg$parseelementFormat() {
|
675 | var s0;
|
676 |
|
677 | s0 = peg$parsesimpleFormat();
|
678 | if (s0 === peg$FAILED) {
|
679 | s0 = peg$parsepluralFormat();
|
680 | if (s0 === peg$FAILED) {
|
681 | s0 = peg$parseselectOrdinalFormat();
|
682 | if (s0 === peg$FAILED) {
|
683 | s0 = peg$parseselectFormat();
|
684 | }
|
685 | }
|
686 | }
|
687 |
|
688 | return s0;
|
689 | }
|
690 |
|
691 | function peg$parsesimpleFormat() {
|
692 | var s0, s1, s2, s3, s4, s5, s6;
|
693 |
|
694 | s0 = peg$currPos;
|
695 | if (input.substr(peg$currPos, 6) === peg$c12) {
|
696 | s1 = peg$c12;
|
697 | peg$currPos += 6;
|
698 | } else {
|
699 | s1 = peg$FAILED;
|
700 | if (peg$silentFails === 0) { peg$fail(peg$c13); }
|
701 | }
|
702 | if (s1 === peg$FAILED) {
|
703 | if (input.substr(peg$currPos, 4) === peg$c14) {
|
704 | s1 = peg$c14;
|
705 | peg$currPos += 4;
|
706 | } else {
|
707 | s1 = peg$FAILED;
|
708 | if (peg$silentFails === 0) { peg$fail(peg$c15); }
|
709 | }
|
710 | if (s1 === peg$FAILED) {
|
711 | if (input.substr(peg$currPos, 4) === peg$c16) {
|
712 | s1 = peg$c16;
|
713 | peg$currPos += 4;
|
714 | } else {
|
715 | s1 = peg$FAILED;
|
716 | if (peg$silentFails === 0) { peg$fail(peg$c17); }
|
717 | }
|
718 | }
|
719 | }
|
720 | if (s1 !== peg$FAILED) {
|
721 | s2 = peg$parse_();
|
722 | if (s2 !== peg$FAILED) {
|
723 | s3 = peg$currPos;
|
724 | if (input.charCodeAt(peg$currPos) === 44) {
|
725 | s4 = peg$c7;
|
726 | peg$currPos++;
|
727 | } else {
|
728 | s4 = peg$FAILED;
|
729 | if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
730 | }
|
731 | if (s4 !== peg$FAILED) {
|
732 | s5 = peg$parse_();
|
733 | if (s5 !== peg$FAILED) {
|
734 | s6 = peg$parsechars();
|
735 | if (s6 !== peg$FAILED) {
|
736 | s4 = [s4, s5, s6];
|
737 | s3 = s4;
|
738 | } else {
|
739 | peg$currPos = s3;
|
740 | s3 = peg$FAILED;
|
741 | }
|
742 | } else {
|
743 | peg$currPos = s3;
|
744 | s3 = peg$FAILED;
|
745 | }
|
746 | } else {
|
747 | peg$currPos = s3;
|
748 | s3 = peg$FAILED;
|
749 | }
|
750 | if (s3 === peg$FAILED) {
|
751 | s3 = null;
|
752 | }
|
753 | if (s3 !== peg$FAILED) {
|
754 | peg$savedPos = s0;
|
755 | s1 = peg$c18(s1, s3);
|
756 | s0 = s1;
|
757 | } else {
|
758 | peg$currPos = s0;
|
759 | s0 = peg$FAILED;
|
760 | }
|
761 | } else {
|
762 | peg$currPos = s0;
|
763 | s0 = peg$FAILED;
|
764 | }
|
765 | } else {
|
766 | peg$currPos = s0;
|
767 | s0 = peg$FAILED;
|
768 | }
|
769 |
|
770 | return s0;
|
771 | }
|
772 |
|
773 | function peg$parsepluralFormat() {
|
774 | var s0, s1, s2, s3, s4, s5;
|
775 |
|
776 | s0 = peg$currPos;
|
777 | if (input.substr(peg$currPos, 6) === peg$c19) {
|
778 | s1 = peg$c19;
|
779 | peg$currPos += 6;
|
780 | } else {
|
781 | s1 = peg$FAILED;
|
782 | if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
783 | }
|
784 | if (s1 !== peg$FAILED) {
|
785 | s2 = peg$parse_();
|
786 | if (s2 !== peg$FAILED) {
|
787 | if (input.charCodeAt(peg$currPos) === 44) {
|
788 | s3 = peg$c7;
|
789 | peg$currPos++;
|
790 | } else {
|
791 | s3 = peg$FAILED;
|
792 | if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
793 | }
|
794 | if (s3 !== peg$FAILED) {
|
795 | s4 = peg$parse_();
|
796 | if (s4 !== peg$FAILED) {
|
797 | s5 = peg$parsepluralStyle();
|
798 | if (s5 !== peg$FAILED) {
|
799 | peg$savedPos = s0;
|
800 | s1 = peg$c21(s5);
|
801 | s0 = s1;
|
802 | } else {
|
803 | peg$currPos = s0;
|
804 | s0 = peg$FAILED;
|
805 | }
|
806 | } else {
|
807 | peg$currPos = s0;
|
808 | s0 = peg$FAILED;
|
809 | }
|
810 | } else {
|
811 | peg$currPos = s0;
|
812 | s0 = peg$FAILED;
|
813 | }
|
814 | } else {
|
815 | peg$currPos = s0;
|
816 | s0 = peg$FAILED;
|
817 | }
|
818 | } else {
|
819 | peg$currPos = s0;
|
820 | s0 = peg$FAILED;
|
821 | }
|
822 |
|
823 | return s0;
|
824 | }
|
825 |
|
826 | function peg$parseselectOrdinalFormat() {
|
827 | var s0, s1, s2, s3, s4, s5;
|
828 |
|
829 | s0 = peg$currPos;
|
830 | if (input.substr(peg$currPos, 13) === peg$c22) {
|
831 | s1 = peg$c22;
|
832 | peg$currPos += 13;
|
833 | } else {
|
834 | s1 = peg$FAILED;
|
835 | if (peg$silentFails === 0) { peg$fail(peg$c23); }
|
836 | }
|
837 | if (s1 !== peg$FAILED) {
|
838 | s2 = peg$parse_();
|
839 | if (s2 !== peg$FAILED) {
|
840 | if (input.charCodeAt(peg$currPos) === 44) {
|
841 | s3 = peg$c7;
|
842 | peg$currPos++;
|
843 | } else {
|
844 | s3 = peg$FAILED;
|
845 | if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
846 | }
|
847 | if (s3 !== peg$FAILED) {
|
848 | s4 = peg$parse_();
|
849 | if (s4 !== peg$FAILED) {
|
850 | s5 = peg$parsepluralStyle();
|
851 | if (s5 !== peg$FAILED) {
|
852 | peg$savedPos = s0;
|
853 | s1 = peg$c24(s5);
|
854 | s0 = s1;
|
855 | } else {
|
856 | peg$currPos = s0;
|
857 | s0 = peg$FAILED;
|
858 | }
|
859 | } else {
|
860 | peg$currPos = s0;
|
861 | s0 = peg$FAILED;
|
862 | }
|
863 | } else {
|
864 | peg$currPos = s0;
|
865 | s0 = peg$FAILED;
|
866 | }
|
867 | } else {
|
868 | peg$currPos = s0;
|
869 | s0 = peg$FAILED;
|
870 | }
|
871 | } else {
|
872 | peg$currPos = s0;
|
873 | s0 = peg$FAILED;
|
874 | }
|
875 |
|
876 | return s0;
|
877 | }
|
878 |
|
879 | function peg$parseselectFormat() {
|
880 | var s0, s1, s2, s3, s4, s5, s6;
|
881 |
|
882 | s0 = peg$currPos;
|
883 | if (input.substr(peg$currPos, 6) === peg$c25) {
|
884 | s1 = peg$c25;
|
885 | peg$currPos += 6;
|
886 | } else {
|
887 | s1 = peg$FAILED;
|
888 | if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
889 | }
|
890 | if (s1 !== peg$FAILED) {
|
891 | s2 = peg$parse_();
|
892 | if (s2 !== peg$FAILED) {
|
893 | if (input.charCodeAt(peg$currPos) === 44) {
|
894 | s3 = peg$c7;
|
895 | peg$currPos++;
|
896 | } else {
|
897 | s3 = peg$FAILED;
|
898 | if (peg$silentFails === 0) { peg$fail(peg$c8); }
|
899 | }
|
900 | if (s3 !== peg$FAILED) {
|
901 | s4 = peg$parse_();
|
902 | if (s4 !== peg$FAILED) {
|
903 | s5 = [];
|
904 | s6 = peg$parseoptionalFormatPattern();
|
905 | if (s6 !== peg$FAILED) {
|
906 | while (s6 !== peg$FAILED) {
|
907 | s5.push(s6);
|
908 | s6 = peg$parseoptionalFormatPattern();
|
909 | }
|
910 | } else {
|
911 | s5 = peg$FAILED;
|
912 | }
|
913 | if (s5 !== peg$FAILED) {
|
914 | peg$savedPos = s0;
|
915 | s1 = peg$c27(s5);
|
916 | s0 = s1;
|
917 | } else {
|
918 | peg$currPos = s0;
|
919 | s0 = peg$FAILED;
|
920 | }
|
921 | } else {
|
922 | peg$currPos = s0;
|
923 | s0 = peg$FAILED;
|
924 | }
|
925 | } else {
|
926 | peg$currPos = s0;
|
927 | s0 = peg$FAILED;
|
928 | }
|
929 | } else {
|
930 | peg$currPos = s0;
|
931 | s0 = peg$FAILED;
|
932 | }
|
933 | } else {
|
934 | peg$currPos = s0;
|
935 | s0 = peg$FAILED;
|
936 | }
|
937 |
|
938 | return s0;
|
939 | }
|
940 |
|
941 | function peg$parseselector() {
|
942 | var s0, s1, s2, s3;
|
943 |
|
944 | s0 = peg$currPos;
|
945 | s1 = peg$currPos;
|
946 | if (input.charCodeAt(peg$currPos) === 61) {
|
947 | s2 = peg$c28;
|
948 | peg$currPos++;
|
949 | } else {
|
950 | s2 = peg$FAILED;
|
951 | if (peg$silentFails === 0) { peg$fail(peg$c29); }
|
952 | }
|
953 | if (s2 !== peg$FAILED) {
|
954 | s3 = peg$parsenumber();
|
955 | if (s3 !== peg$FAILED) {
|
956 | s2 = [s2, s3];
|
957 | s1 = s2;
|
958 | } else {
|
959 | peg$currPos = s1;
|
960 | s1 = peg$FAILED;
|
961 | }
|
962 | } else {
|
963 | peg$currPos = s1;
|
964 | s1 = peg$FAILED;
|
965 | }
|
966 | if (s1 !== peg$FAILED) {
|
967 | s0 = input.substring(s0, peg$currPos);
|
968 | } else {
|
969 | s0 = s1;
|
970 | }
|
971 | if (s0 === peg$FAILED) {
|
972 | s0 = peg$parsechars();
|
973 | }
|
974 |
|
975 | return s0;
|
976 | }
|
977 |
|
978 | function peg$parseoptionalFormatPattern() {
|
979 | var s0, s1, s2, s3, s4, s5, s6;
|
980 |
|
981 | s0 = peg$currPos;
|
982 | s1 = peg$parse_();
|
983 | if (s1 !== peg$FAILED) {
|
984 | s2 = peg$parseselector();
|
985 | if (s2 !== peg$FAILED) {
|
986 | s3 = peg$parse_();
|
987 | if (s3 !== peg$FAILED) {
|
988 | if (input.charCodeAt(peg$currPos) === 123) {
|
989 | s4 = peg$c5;
|
990 | peg$currPos++;
|
991 | } else {
|
992 | s4 = peg$FAILED;
|
993 | if (peg$silentFails === 0) { peg$fail(peg$c6); }
|
994 | }
|
995 | if (s4 !== peg$FAILED) {
|
996 | s5 = peg$parsemessageFormatPattern();
|
997 | if (s5 !== peg$FAILED) {
|
998 | if (input.charCodeAt(peg$currPos) === 125) {
|
999 | s6 = peg$c9;
|
1000 | peg$currPos++;
|
1001 | } else {
|
1002 | s6 = peg$FAILED;
|
1003 | if (peg$silentFails === 0) { peg$fail(peg$c10); }
|
1004 | }
|
1005 | if (s6 !== peg$FAILED) {
|
1006 | peg$savedPos = s0;
|
1007 | s1 = peg$c30(s2, s5);
|
1008 | s0 = s1;
|
1009 | } else {
|
1010 | peg$currPos = s0;
|
1011 | s0 = peg$FAILED;
|
1012 | }
|
1013 | } else {
|
1014 | peg$currPos = s0;
|
1015 | s0 = peg$FAILED;
|
1016 | }
|
1017 | } else {
|
1018 | peg$currPos = s0;
|
1019 | s0 = peg$FAILED;
|
1020 | }
|
1021 | } else {
|
1022 | peg$currPos = s0;
|
1023 | s0 = peg$FAILED;
|
1024 | }
|
1025 | } else {
|
1026 | peg$currPos = s0;
|
1027 | s0 = peg$FAILED;
|
1028 | }
|
1029 | } else {
|
1030 | peg$currPos = s0;
|
1031 | s0 = peg$FAILED;
|
1032 | }
|
1033 |
|
1034 | return s0;
|
1035 | }
|
1036 |
|
1037 | function peg$parseoffset() {
|
1038 | var s0, s1, s2, s3;
|
1039 |
|
1040 | s0 = peg$currPos;
|
1041 | if (input.substr(peg$currPos, 7) === peg$c31) {
|
1042 | s1 = peg$c31;
|
1043 | peg$currPos += 7;
|
1044 | } else {
|
1045 | s1 = peg$FAILED;
|
1046 | if (peg$silentFails === 0) { peg$fail(peg$c32); }
|
1047 | }
|
1048 | if (s1 !== peg$FAILED) {
|
1049 | s2 = peg$parse_();
|
1050 | if (s2 !== peg$FAILED) {
|
1051 | s3 = peg$parsenumber();
|
1052 | if (s3 !== peg$FAILED) {
|
1053 | peg$savedPos = s0;
|
1054 | s1 = peg$c33(s3);
|
1055 | s0 = s1;
|
1056 | } else {
|
1057 | peg$currPos = s0;
|
1058 | s0 = peg$FAILED;
|
1059 | }
|
1060 | } else {
|
1061 | peg$currPos = s0;
|
1062 | s0 = peg$FAILED;
|
1063 | }
|
1064 | } else {
|
1065 | peg$currPos = s0;
|
1066 | s0 = peg$FAILED;
|
1067 | }
|
1068 |
|
1069 | return s0;
|
1070 | }
|
1071 |
|
1072 | function peg$parsepluralStyle() {
|
1073 | var s0, s1, s2, s3, s4;
|
1074 |
|
1075 | s0 = peg$currPos;
|
1076 | s1 = peg$parseoffset();
|
1077 | if (s1 === peg$FAILED) {
|
1078 | s1 = null;
|
1079 | }
|
1080 | if (s1 !== peg$FAILED) {
|
1081 | s2 = peg$parse_();
|
1082 | if (s2 !== peg$FAILED) {
|
1083 | s3 = [];
|
1084 | s4 = peg$parseoptionalFormatPattern();
|
1085 | if (s4 !== peg$FAILED) {
|
1086 | while (s4 !== peg$FAILED) {
|
1087 | s3.push(s4);
|
1088 | s4 = peg$parseoptionalFormatPattern();
|
1089 | }
|
1090 | } else {
|
1091 | s3 = peg$FAILED;
|
1092 | }
|
1093 | if (s3 !== peg$FAILED) {
|
1094 | peg$savedPos = s0;
|
1095 | s1 = peg$c34(s1, s3);
|
1096 | s0 = s1;
|
1097 | } else {
|
1098 | peg$currPos = s0;
|
1099 | s0 = peg$FAILED;
|
1100 | }
|
1101 | } else {
|
1102 | peg$currPos = s0;
|
1103 | s0 = peg$FAILED;
|
1104 | }
|
1105 | } else {
|
1106 | peg$currPos = s0;
|
1107 | s0 = peg$FAILED;
|
1108 | }
|
1109 |
|
1110 | return s0;
|
1111 | }
|
1112 |
|
1113 | function peg$parsews() {
|
1114 | var s0, s1;
|
1115 |
|
1116 | peg$silentFails++;
|
1117 | s0 = [];
|
1118 | if (peg$c36.test(input.charAt(peg$currPos))) {
|
1119 | s1 = input.charAt(peg$currPos);
|
1120 | peg$currPos++;
|
1121 | } else {
|
1122 | s1 = peg$FAILED;
|
1123 | if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
1124 | }
|
1125 | if (s1 !== peg$FAILED) {
|
1126 | while (s1 !== peg$FAILED) {
|
1127 | s0.push(s1);
|
1128 | if (peg$c36.test(input.charAt(peg$currPos))) {
|
1129 | s1 = input.charAt(peg$currPos);
|
1130 | peg$currPos++;
|
1131 | } else {
|
1132 | s1 = peg$FAILED;
|
1133 | if (peg$silentFails === 0) { peg$fail(peg$c37); }
|
1134 | }
|
1135 | }
|
1136 | } else {
|
1137 | s0 = peg$FAILED;
|
1138 | }
|
1139 | peg$silentFails--;
|
1140 | if (s0 === peg$FAILED) {
|
1141 | s1 = peg$FAILED;
|
1142 | if (peg$silentFails === 0) { peg$fail(peg$c35); }
|
1143 | }
|
1144 |
|
1145 | return s0;
|
1146 | }
|
1147 |
|
1148 | function peg$parse_() {
|
1149 | var s0, s1, s2;
|
1150 |
|
1151 | peg$silentFails++;
|
1152 | s0 = peg$currPos;
|
1153 | s1 = [];
|
1154 | s2 = peg$parsews();
|
1155 | while (s2 !== peg$FAILED) {
|
1156 | s1.push(s2);
|
1157 | s2 = peg$parsews();
|
1158 | }
|
1159 | if (s1 !== peg$FAILED) {
|
1160 | s0 = input.substring(s0, peg$currPos);
|
1161 | } else {
|
1162 | s0 = s1;
|
1163 | }
|
1164 | peg$silentFails--;
|
1165 | if (s0 === peg$FAILED) {
|
1166 | s1 = peg$FAILED;
|
1167 | if (peg$silentFails === 0) { peg$fail(peg$c38); }
|
1168 | }
|
1169 |
|
1170 | return s0;
|
1171 | }
|
1172 |
|
1173 | function peg$parsedigit() {
|
1174 | var s0;
|
1175 |
|
1176 | if (peg$c39.test(input.charAt(peg$currPos))) {
|
1177 | s0 = input.charAt(peg$currPos);
|
1178 | peg$currPos++;
|
1179 | } else {
|
1180 | s0 = peg$FAILED;
|
1181 | if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
1182 | }
|
1183 |
|
1184 | return s0;
|
1185 | }
|
1186 |
|
1187 | function peg$parsehexDigit() {
|
1188 | var s0;
|
1189 |
|
1190 | if (peg$c41.test(input.charAt(peg$currPos))) {
|
1191 | s0 = input.charAt(peg$currPos);
|
1192 | peg$currPos++;
|
1193 | } else {
|
1194 | s0 = peg$FAILED;
|
1195 | if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
1196 | }
|
1197 |
|
1198 | return s0;
|
1199 | }
|
1200 |
|
1201 | function peg$parsenumber() {
|
1202 | var s0, s1, s2, s3, s4, s5;
|
1203 |
|
1204 | s0 = peg$currPos;
|
1205 | if (input.charCodeAt(peg$currPos) === 48) {
|
1206 | s1 = peg$c43;
|
1207 | peg$currPos++;
|
1208 | } else {
|
1209 | s1 = peg$FAILED;
|
1210 | if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
1211 | }
|
1212 | if (s1 === peg$FAILED) {
|
1213 | s1 = peg$currPos;
|
1214 | s2 = peg$currPos;
|
1215 | if (peg$c45.test(input.charAt(peg$currPos))) {
|
1216 | s3 = input.charAt(peg$currPos);
|
1217 | peg$currPos++;
|
1218 | } else {
|
1219 | s3 = peg$FAILED;
|
1220 | if (peg$silentFails === 0) { peg$fail(peg$c46); }
|
1221 | }
|
1222 | if (s3 !== peg$FAILED) {
|
1223 | s4 = [];
|
1224 | s5 = peg$parsedigit();
|
1225 | while (s5 !== peg$FAILED) {
|
1226 | s4.push(s5);
|
1227 | s5 = peg$parsedigit();
|
1228 | }
|
1229 | if (s4 !== peg$FAILED) {
|
1230 | s3 = [s3, s4];
|
1231 | s2 = s3;
|
1232 | } else {
|
1233 | peg$currPos = s2;
|
1234 | s2 = peg$FAILED;
|
1235 | }
|
1236 | } else {
|
1237 | peg$currPos = s2;
|
1238 | s2 = peg$FAILED;
|
1239 | }
|
1240 | if (s2 !== peg$FAILED) {
|
1241 | s1 = input.substring(s1, peg$currPos);
|
1242 | } else {
|
1243 | s1 = s2;
|
1244 | }
|
1245 | }
|
1246 | if (s1 !== peg$FAILED) {
|
1247 | peg$savedPos = s0;
|
1248 | s1 = peg$c47(s1);
|
1249 | }
|
1250 | s0 = s1;
|
1251 |
|
1252 | return s0;
|
1253 | }
|
1254 |
|
1255 | function peg$parsechar() {
|
1256 | var s0, s1, s2, s3, s4, s5, s6, s7;
|
1257 |
|
1258 | if (peg$c48.test(input.charAt(peg$currPos))) {
|
1259 | s0 = input.charAt(peg$currPos);
|
1260 | peg$currPos++;
|
1261 | } else {
|
1262 | s0 = peg$FAILED;
|
1263 | if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
1264 | }
|
1265 | if (s0 === peg$FAILED) {
|
1266 | s0 = peg$currPos;
|
1267 | if (input.substr(peg$currPos, 2) === peg$c50) {
|
1268 | s1 = peg$c50;
|
1269 | peg$currPos += 2;
|
1270 | } else {
|
1271 | s1 = peg$FAILED;
|
1272 | if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
1273 | }
|
1274 | if (s1 !== peg$FAILED) {
|
1275 | peg$savedPos = s0;
|
1276 | s1 = peg$c52();
|
1277 | }
|
1278 | s0 = s1;
|
1279 | if (s0 === peg$FAILED) {
|
1280 | s0 = peg$currPos;
|
1281 | if (input.substr(peg$currPos, 2) === peg$c53) {
|
1282 | s1 = peg$c53;
|
1283 | peg$currPos += 2;
|
1284 | } else {
|
1285 | s1 = peg$FAILED;
|
1286 | if (peg$silentFails === 0) { peg$fail(peg$c54); }
|
1287 | }
|
1288 | if (s1 !== peg$FAILED) {
|
1289 | peg$savedPos = s0;
|
1290 | s1 = peg$c55();
|
1291 | }
|
1292 | s0 = s1;
|
1293 | if (s0 === peg$FAILED) {
|
1294 | s0 = peg$currPos;
|
1295 | if (input.substr(peg$currPos, 2) === peg$c56) {
|
1296 | s1 = peg$c56;
|
1297 | peg$currPos += 2;
|
1298 | } else {
|
1299 | s1 = peg$FAILED;
|
1300 | if (peg$silentFails === 0) { peg$fail(peg$c57); }
|
1301 | }
|
1302 | if (s1 !== peg$FAILED) {
|
1303 | peg$savedPos = s0;
|
1304 | s1 = peg$c58();
|
1305 | }
|
1306 | s0 = s1;
|
1307 | if (s0 === peg$FAILED) {
|
1308 | s0 = peg$currPos;
|
1309 | if (input.substr(peg$currPos, 2) === peg$c59) {
|
1310 | s1 = peg$c59;
|
1311 | peg$currPos += 2;
|
1312 | } else {
|
1313 | s1 = peg$FAILED;
|
1314 | if (peg$silentFails === 0) { peg$fail(peg$c60); }
|
1315 | }
|
1316 | if (s1 !== peg$FAILED) {
|
1317 | peg$savedPos = s0;
|
1318 | s1 = peg$c61();
|
1319 | }
|
1320 | s0 = s1;
|
1321 | if (s0 === peg$FAILED) {
|
1322 | s0 = peg$currPos;
|
1323 | if (input.substr(peg$currPos, 2) === peg$c62) {
|
1324 | s1 = peg$c62;
|
1325 | peg$currPos += 2;
|
1326 | } else {
|
1327 | s1 = peg$FAILED;
|
1328 | if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
1329 | }
|
1330 | if (s1 !== peg$FAILED) {
|
1331 | s2 = peg$currPos;
|
1332 | s3 = peg$currPos;
|
1333 | s4 = peg$parsehexDigit();
|
1334 | if (s4 !== peg$FAILED) {
|
1335 | s5 = peg$parsehexDigit();
|
1336 | if (s5 !== peg$FAILED) {
|
1337 | s6 = peg$parsehexDigit();
|
1338 | if (s6 !== peg$FAILED) {
|
1339 | s7 = peg$parsehexDigit();
|
1340 | if (s7 !== peg$FAILED) {
|
1341 | s4 = [s4, s5, s6, s7];
|
1342 | s3 = s4;
|
1343 | } else {
|
1344 | peg$currPos = s3;
|
1345 | s3 = peg$FAILED;
|
1346 | }
|
1347 | } else {
|
1348 | peg$currPos = s3;
|
1349 | s3 = peg$FAILED;
|
1350 | }
|
1351 | } else {
|
1352 | peg$currPos = s3;
|
1353 | s3 = peg$FAILED;
|
1354 | }
|
1355 | } else {
|
1356 | peg$currPos = s3;
|
1357 | s3 = peg$FAILED;
|
1358 | }
|
1359 | if (s3 !== peg$FAILED) {
|
1360 | s2 = input.substring(s2, peg$currPos);
|
1361 | } else {
|
1362 | s2 = s3;
|
1363 | }
|
1364 | if (s2 !== peg$FAILED) {
|
1365 | peg$savedPos = s0;
|
1366 | s1 = peg$c64(s2);
|
1367 | s0 = s1;
|
1368 | } else {
|
1369 | peg$currPos = s0;
|
1370 | s0 = peg$FAILED;
|
1371 | }
|
1372 | } else {
|
1373 | peg$currPos = s0;
|
1374 | s0 = peg$FAILED;
|
1375 | }
|
1376 | }
|
1377 | }
|
1378 | }
|
1379 | }
|
1380 | }
|
1381 |
|
1382 | return s0;
|
1383 | }
|
1384 |
|
1385 | function peg$parsechars() {
|
1386 | var s0, s1, s2;
|
1387 |
|
1388 | s0 = peg$currPos;
|
1389 | s1 = [];
|
1390 | s2 = peg$parsechar();
|
1391 | if (s2 !== peg$FAILED) {
|
1392 | while (s2 !== peg$FAILED) {
|
1393 | s1.push(s2);
|
1394 | s2 = peg$parsechar();
|
1395 | }
|
1396 | } else {
|
1397 | s1 = peg$FAILED;
|
1398 | }
|
1399 | if (s1 !== peg$FAILED) {
|
1400 | peg$savedPos = s0;
|
1401 | s1 = peg$c65(s1);
|
1402 | }
|
1403 | s0 = s1;
|
1404 |
|
1405 | return s0;
|
1406 | }
|
1407 |
|
1408 | peg$result = peg$startRuleFunction();
|
1409 |
|
1410 | if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
1411 | return peg$result;
|
1412 | } else {
|
1413 | if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
1414 | peg$fail(peg$endExpectation());
|
1415 | }
|
1416 |
|
1417 | throw peg$buildStructuredError(
|
1418 | peg$maxFailExpected,
|
1419 | peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
1420 | peg$maxFailPos < input.length
|
1421 | ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
1422 | : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
|
1423 | );
|
1424 | }
|
1425 | }
|
1426 |
|
1427 | return {
|
1428 | SyntaxError: peg$SyntaxError,
|
1429 | parse: peg$parse
|
1430 | };
|
1431 | })() |
\ | No newline at end of file |