intl-messageformat 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -256,10 +256,12 @@
256
256
  };
257
257
 
258
258
  var intl$messageformat$parser$$default = (function() {
259
+ "use strict";
260
+
259
261
  /*
260
- * Generated by PEG.js 0.8.0.
262
+ * Generated by PEG.js 0.9.0.
261
263
  *
262
- * http://pegjs.majda.cz/
264
+ * http://pegjs.org/
263
265
  */
264
266
 
265
267
  function peg$subclass(child, parent) {
@@ -268,36 +270,37 @@
268
270
  child.prototype = new ctor();
269
271
  }
270
272
 
271
- function SyntaxError(message, expected, found, offset, line, column) {
273
+ function peg$SyntaxError(message, expected, found, location) {
272
274
  this.message = message;
273
275
  this.expected = expected;
274
276
  this.found = found;
275
- this.offset = offset;
276
- this.line = line;
277
- this.column = column;
278
-
277
+ this.location = location;
279
278
  this.name = "SyntaxError";
279
+
280
+ if (typeof Error.captureStackTrace === "function") {
281
+ Error.captureStackTrace(this, peg$SyntaxError);
282
+ }
280
283
  }
281
284
 
282
- peg$subclass(SyntaxError, Error);
285
+ peg$subclass(peg$SyntaxError, Error);
283
286
 
284
- function parse(input) {
287
+ function peg$parse(input) {
285
288
  var options = arguments.length > 1 ? arguments[1] : {},
289
+ parser = this,
286
290
 
287
291
  peg$FAILED = {},
288
292
 
289
293
  peg$startRuleFunctions = { start: peg$parsestart },
290
294
  peg$startRuleFunction = peg$parsestart,
291
295
 
292
- peg$c0 = [],
293
- peg$c1 = function(elements) {
296
+ peg$c0 = function(elements) {
294
297
  return {
295
298
  type : 'messageFormatPattern',
296
- elements: elements
299
+ elements: elements,
300
+ location: location()
297
301
  };
298
302
  },
299
- peg$c2 = peg$FAILED,
300
- peg$c3 = function(text) {
303
+ peg$c1 = function(text) {
301
304
  var string = '',
302
305
  i, j, outerLen, inner, innerLen;
303
306
 
@@ -311,129 +314,135 @@
311
314
 
312
315
  return string;
313
316
  },
314
- peg$c4 = function(messageText) {
317
+ peg$c2 = function(messageText) {
315
318
  return {
316
319
  type : 'messageTextElement',
317
- value: messageText
320
+ value: messageText,
321
+ location: location()
318
322
  };
319
323
  },
320
- peg$c5 = /^[^ \t\n\r,.+={}#]/,
321
- peg$c6 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
322
- peg$c7 = "{",
323
- peg$c8 = { type: "literal", value: "{", description: "\"{\"" },
324
- peg$c9 = null,
325
- peg$c10 = ",",
326
- peg$c11 = { type: "literal", value: ",", description: "\",\"" },
327
- peg$c12 = "}",
328
- peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
329
- peg$c14 = function(id, format) {
324
+ peg$c3 = /^[^ \t\n\r,.+={}#]/,
325
+ peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
326
+ peg$c5 = "{",
327
+ peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
328
+ peg$c7 = ",",
329
+ peg$c8 = { type: "literal", value: ",", description: "\",\"" },
330
+ peg$c9 = "}",
331
+ peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
332
+ peg$c11 = function(id, format) {
330
333
  return {
331
334
  type : 'argumentElement',
332
335
  id : id,
333
- format: format && format[2]
336
+ format: format && format[2],
337
+ location: location()
334
338
  };
335
339
  },
336
- peg$c15 = "number",
337
- peg$c16 = { type: "literal", value: "number", description: "\"number\"" },
338
- peg$c17 = "date",
339
- peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
340
- peg$c19 = "time",
341
- peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
342
- peg$c21 = function(type, style) {
340
+ peg$c12 = "number",
341
+ peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
342
+ peg$c14 = "date",
343
+ peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
344
+ peg$c16 = "time",
345
+ peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
346
+ peg$c18 = function(type, style) {
343
347
  return {
344
348
  type : type + 'Format',
345
- style: style && style[2]
349
+ style: style && style[2],
350
+ location: location()
346
351
  };
347
352
  },
348
- peg$c22 = "plural",
349
- peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
350
- peg$c24 = function(pluralStyle) {
353
+ peg$c19 = "plural",
354
+ peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
355
+ peg$c21 = function(pluralStyle) {
351
356
  return {
352
357
  type : pluralStyle.type,
353
358
  ordinal: false,
354
359
  offset : pluralStyle.offset || 0,
355
- options: pluralStyle.options
360
+ options: pluralStyle.options,
361
+ location: location()
356
362
  };
357
363
  },
358
- peg$c25 = "selectordinal",
359
- peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
360
- peg$c27 = function(pluralStyle) {
364
+ peg$c22 = "selectordinal",
365
+ peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
366
+ peg$c24 = function(pluralStyle) {
361
367
  return {
362
368
  type : pluralStyle.type,
363
369
  ordinal: true,
364
370
  offset : pluralStyle.offset || 0,
365
- options: pluralStyle.options
371
+ options: pluralStyle.options,
372
+ location: location()
366
373
  }
367
374
  },
368
- peg$c28 = "select",
369
- peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
370
- peg$c30 = function(options) {
375
+ peg$c25 = "select",
376
+ peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
377
+ peg$c27 = function(options) {
371
378
  return {
372
379
  type : 'selectFormat',
373
- options: options
380
+ options: options,
381
+ location: location()
374
382
  };
375
383
  },
376
- peg$c31 = "=",
377
- peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
378
- peg$c33 = function(selector, pattern) {
384
+ peg$c28 = "=",
385
+ peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
386
+ peg$c30 = function(selector, pattern) {
379
387
  return {
380
388
  type : 'optionalFormatPattern',
381
389
  selector: selector,
382
- value : pattern
390
+ value : pattern,
391
+ location: location()
383
392
  };
384
393
  },
385
- peg$c34 = "offset:",
386
- peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
387
- peg$c36 = function(number) {
394
+ peg$c31 = "offset:",
395
+ peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
396
+ peg$c33 = function(number) {
388
397
  return number;
389
398
  },
390
- peg$c37 = function(offset, options) {
399
+ peg$c34 = function(offset, options) {
391
400
  return {
392
401
  type : 'pluralFormat',
393
402
  offset : offset,
394
- options: options
403
+ options: options,
404
+ location: location()
395
405
  };
396
406
  },
397
- peg$c38 = { type: "other", description: "whitespace" },
398
- peg$c39 = /^[ \t\n\r]/,
399
- peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
400
- peg$c41 = { type: "other", description: "optionalWhitespace" },
401
- peg$c42 = /^[0-9]/,
402
- peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
403
- peg$c44 = /^[0-9a-f]/i,
404
- peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
405
- peg$c46 = "0",
406
- peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
407
- peg$c48 = /^[1-9]/,
408
- peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
409
- peg$c50 = function(digits) {
407
+ peg$c35 = { type: "other", description: "whitespace" },
408
+ peg$c36 = /^[ \t\n\r]/,
409
+ peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
410
+ peg$c38 = { type: "other", description: "optionalWhitespace" },
411
+ peg$c39 = /^[0-9]/,
412
+ peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
413
+ peg$c41 = /^[0-9a-f]/i,
414
+ peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
415
+ peg$c43 = "0",
416
+ peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
417
+ peg$c45 = /^[1-9]/,
418
+ peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
419
+ peg$c47 = function(digits) {
410
420
  return parseInt(digits, 10);
411
421
  },
412
- peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
413
- peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
414
- peg$c53 = "\\\\",
415
- peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
416
- peg$c55 = function() { return '\\'; },
417
- peg$c56 = "\\#",
418
- peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
419
- peg$c58 = function() { return '\\#'; },
420
- peg$c59 = "\\{",
421
- peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
422
- peg$c61 = function() { return '\u007B'; },
423
- peg$c62 = "\\}",
424
- peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
425
- peg$c64 = function() { return '\u007D'; },
426
- peg$c65 = "\\u",
427
- peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
428
- peg$c67 = function(digits) {
422
+ peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
423
+ peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
424
+ peg$c50 = "\\\\",
425
+ peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
426
+ peg$c52 = function() { return '\\'; },
427
+ peg$c53 = "\\#",
428
+ peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
429
+ peg$c55 = function() { return '\\#'; },
430
+ peg$c56 = "\\{",
431
+ peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
432
+ peg$c58 = function() { return '\u007B'; },
433
+ peg$c59 = "\\}",
434
+ peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
435
+ peg$c61 = function() { return '\u007D'; },
436
+ peg$c62 = "\\u",
437
+ peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
438
+ peg$c64 = function(digits) {
429
439
  return String.fromCharCode(parseInt(digits, 16));
430
440
  },
431
- peg$c68 = function(chars) { return chars.join(''); },
441
+ peg$c65 = function(chars) { return chars.join(''); },
432
442
 
433
443
  peg$currPos = 0,
434
- peg$reportedPos = 0,
435
- peg$cachedPos = 0,
436
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
444
+ peg$savedPos = 0,
445
+ peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
437
446
  peg$maxFailPos = 0,
438
447
  peg$maxFailExpected = [],
439
448
  peg$silentFails = 0,
@@ -449,38 +458,51 @@
449
458
  }
450
459
 
451
460
  function text() {
452
- return input.substring(peg$reportedPos, peg$currPos);
461
+ return input.substring(peg$savedPos, peg$currPos);
453
462
  }
454
463
 
455
- function offset() {
456
- return peg$reportedPos;
457
- }
458
-
459
- function line() {
460
- return peg$computePosDetails(peg$reportedPos).line;
461
- }
462
-
463
- function column() {
464
- return peg$computePosDetails(peg$reportedPos).column;
464
+ function location() {
465
+ return peg$computeLocation(peg$savedPos, peg$currPos);
465
466
  }
466
467
 
467
468
  function expected(description) {
468
469
  throw peg$buildException(
469
470
  null,
470
471
  [{ type: "other", description: description }],
471
- peg$reportedPos
472
+ input.substring(peg$savedPos, peg$currPos),
473
+ peg$computeLocation(peg$savedPos, peg$currPos)
472
474
  );
473
475
  }
474
476
 
475
477
  function error(message) {
476
- throw peg$buildException(message, null, peg$reportedPos);
478
+ throw peg$buildException(
479
+ message,
480
+ null,
481
+ input.substring(peg$savedPos, peg$currPos),
482
+ peg$computeLocation(peg$savedPos, peg$currPos)
483
+ );
477
484
  }
478
485
 
479
486
  function peg$computePosDetails(pos) {
480
- function advance(details, startPos, endPos) {
481
- var p, ch;
487
+ var details = peg$posDetailsCache[pos],
488
+ p, ch;
489
+
490
+ if (details) {
491
+ return details;
492
+ } else {
493
+ p = pos - 1;
494
+ while (!peg$posDetailsCache[p]) {
495
+ p--;
496
+ }
497
+
498
+ details = peg$posDetailsCache[p];
499
+ details = {
500
+ line: details.line,
501
+ column: details.column,
502
+ seenCR: details.seenCR
503
+ };
482
504
 
483
- for (p = startPos; p < endPos; p++) {
505
+ while (p < pos) {
484
506
  ch = input.charAt(p);
485
507
  if (ch === "\n") {
486
508
  if (!details.seenCR) { details.line++; }
@@ -494,19 +516,31 @@
494
516
  details.column++;
495
517
  details.seenCR = false;
496
518
  }
497
- }
498
- }
499
519
 
500
- if (peg$cachedPos !== pos) {
501
- if (peg$cachedPos > pos) {
502
- peg$cachedPos = 0;
503
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
520
+ p++;
504
521
  }
505
- advance(peg$cachedPosDetails, peg$cachedPos, pos);
506
- peg$cachedPos = pos;
522
+
523
+ peg$posDetailsCache[pos] = details;
524
+ return details;
507
525
  }
526
+ }
508
527
 
509
- return peg$cachedPosDetails;
528
+ function peg$computeLocation(startPos, endPos) {
529
+ var startPosDetails = peg$computePosDetails(startPos),
530
+ endPosDetails = peg$computePosDetails(endPos);
531
+
532
+ return {
533
+ start: {
534
+ offset: startPos,
535
+ line: startPosDetails.line,
536
+ column: startPosDetails.column
537
+ },
538
+ end: {
539
+ offset: endPos,
540
+ line: endPosDetails.line,
541
+ column: endPosDetails.column
542
+ }
543
+ };
510
544
  }
511
545
 
512
546
  function peg$fail(expected) {
@@ -520,7 +554,7 @@
520
554
  peg$maxFailExpected.push(expected);
521
555
  }
522
556
 
523
- function peg$buildException(message, expected, pos) {
557
+ function peg$buildException(message, expected, found, location) {
524
558
  function cleanupExpected(expected) {
525
559
  var i = 1;
526
560
 
@@ -557,8 +591,8 @@
557
591
  .replace(/\r/g, '\\r')
558
592
  .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
559
593
  .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
560
- .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
561
- .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
594
+ .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
595
+ .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
562
596
  }
563
597
 
564
598
  var expectedDescs = new Array(expected.length),
@@ -579,20 +613,15 @@
579
613
  return "Expected " + expectedDesc + " but " + foundDesc + " found.";
580
614
  }
581
615
 
582
- var posDetails = peg$computePosDetails(pos),
583
- found = pos < input.length ? input.charAt(pos) : null;
584
-
585
616
  if (expected !== null) {
586
617
  cleanupExpected(expected);
587
618
  }
588
619
 
589
- return new SyntaxError(
620
+ return new peg$SyntaxError(
590
621
  message !== null ? message : buildMessage(expected, found),
591
622
  expected,
592
623
  found,
593
- pos,
594
- posDetails.line,
595
- posDetails.column
624
+ location
596
625
  );
597
626
  }
598
627
 
@@ -615,8 +644,8 @@
615
644
  s2 = peg$parsemessageFormatElement();
616
645
  }
617
646
  if (s1 !== peg$FAILED) {
618
- peg$reportedPos = s0;
619
- s1 = peg$c1(s1);
647
+ peg$savedPos = s0;
648
+ s1 = peg$c0(s1);
620
649
  }
621
650
  s0 = s1;
622
651
 
@@ -650,15 +679,15 @@
650
679
  s2 = s3;
651
680
  } else {
652
681
  peg$currPos = s2;
653
- s2 = peg$c2;
682
+ s2 = peg$FAILED;
654
683
  }
655
684
  } else {
656
685
  peg$currPos = s2;
657
- s2 = peg$c2;
686
+ s2 = peg$FAILED;
658
687
  }
659
688
  } else {
660
689
  peg$currPos = s2;
661
- s2 = peg$c2;
690
+ s2 = peg$FAILED;
662
691
  }
663
692
  if (s2 !== peg$FAILED) {
664
693
  while (s2 !== peg$FAILED) {
@@ -674,32 +703,33 @@
674
703
  s2 = s3;
675
704
  } else {
676
705
  peg$currPos = s2;
677
- s2 = peg$c2;
706
+ s2 = peg$FAILED;
678
707
  }
679
708
  } else {
680
709
  peg$currPos = s2;
681
- s2 = peg$c2;
710
+ s2 = peg$FAILED;
682
711
  }
683
712
  } else {
684
713
  peg$currPos = s2;
685
- s2 = peg$c2;
714
+ s2 = peg$FAILED;
686
715
  }
687
716
  }
688
717
  } else {
689
- s1 = peg$c2;
718
+ s1 = peg$FAILED;
690
719
  }
691
720
  if (s1 !== peg$FAILED) {
692
- peg$reportedPos = s0;
693
- s1 = peg$c3(s1);
721
+ peg$savedPos = s0;
722
+ s1 = peg$c1(s1);
694
723
  }
695
724
  s0 = s1;
696
725
  if (s0 === peg$FAILED) {
697
726
  s0 = peg$currPos;
698
727
  s1 = peg$parsews();
699
728
  if (s1 !== peg$FAILED) {
700
- s1 = input.substring(s0, peg$currPos);
729
+ s0 = input.substring(s0, peg$currPos);
730
+ } else {
731
+ s0 = s1;
701
732
  }
702
- s0 = s1;
703
733
  }
704
734
 
705
735
  return s0;
@@ -711,8 +741,8 @@
711
741
  s0 = peg$currPos;
712
742
  s1 = peg$parsemessageText();
713
743
  if (s1 !== peg$FAILED) {
714
- peg$reportedPos = s0;
715
- s1 = peg$c4(s1);
744
+ peg$savedPos = s0;
745
+ s1 = peg$c2(s1);
716
746
  }
717
747
  s0 = s1;
718
748
 
@@ -726,31 +756,32 @@
726
756
  if (s0 === peg$FAILED) {
727
757
  s0 = peg$currPos;
728
758
  s1 = [];
729
- if (peg$c5.test(input.charAt(peg$currPos))) {
759
+ if (peg$c3.test(input.charAt(peg$currPos))) {
730
760
  s2 = input.charAt(peg$currPos);
731
761
  peg$currPos++;
732
762
  } else {
733
763
  s2 = peg$FAILED;
734
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
764
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
735
765
  }
736
766
  if (s2 !== peg$FAILED) {
737
767
  while (s2 !== peg$FAILED) {
738
768
  s1.push(s2);
739
- if (peg$c5.test(input.charAt(peg$currPos))) {
769
+ if (peg$c3.test(input.charAt(peg$currPos))) {
740
770
  s2 = input.charAt(peg$currPos);
741
771
  peg$currPos++;
742
772
  } else {
743
773
  s2 = peg$FAILED;
744
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
774
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
745
775
  }
746
776
  }
747
777
  } else {
748
- s1 = peg$c2;
778
+ s1 = peg$FAILED;
749
779
  }
750
780
  if (s1 !== peg$FAILED) {
751
- s1 = input.substring(s0, peg$currPos);
781
+ s0 = input.substring(s0, peg$currPos);
782
+ } else {
783
+ s0 = s1;
752
784
  }
753
- s0 = s1;
754
785
  }
755
786
 
756
787
  return s0;
@@ -761,11 +792,11 @@
761
792
 
762
793
  s0 = peg$currPos;
763
794
  if (input.charCodeAt(peg$currPos) === 123) {
764
- s1 = peg$c7;
795
+ s1 = peg$c5;
765
796
  peg$currPos++;
766
797
  } else {
767
798
  s1 = peg$FAILED;
768
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
799
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
769
800
  }
770
801
  if (s1 !== peg$FAILED) {
771
802
  s2 = peg$parse_();
@@ -776,11 +807,11 @@
776
807
  if (s4 !== peg$FAILED) {
777
808
  s5 = peg$currPos;
778
809
  if (input.charCodeAt(peg$currPos) === 44) {
779
- s6 = peg$c10;
810
+ s6 = peg$c7;
780
811
  peg$currPos++;
781
812
  } else {
782
813
  s6 = peg$FAILED;
783
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
814
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
784
815
  }
785
816
  if (s6 !== peg$FAILED) {
786
817
  s7 = peg$parse_();
@@ -791,60 +822,60 @@
791
822
  s5 = s6;
792
823
  } else {
793
824
  peg$currPos = s5;
794
- s5 = peg$c2;
825
+ s5 = peg$FAILED;
795
826
  }
796
827
  } else {
797
828
  peg$currPos = s5;
798
- s5 = peg$c2;
829
+ s5 = peg$FAILED;
799
830
  }
800
831
  } else {
801
832
  peg$currPos = s5;
802
- s5 = peg$c2;
833
+ s5 = peg$FAILED;
803
834
  }
804
835
  if (s5 === peg$FAILED) {
805
- s5 = peg$c9;
836
+ s5 = null;
806
837
  }
807
838
  if (s5 !== peg$FAILED) {
808
839
  s6 = peg$parse_();
809
840
  if (s6 !== peg$FAILED) {
810
841
  if (input.charCodeAt(peg$currPos) === 125) {
811
- s7 = peg$c12;
842
+ s7 = peg$c9;
812
843
  peg$currPos++;
813
844
  } else {
814
845
  s7 = peg$FAILED;
815
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
846
+ if (peg$silentFails === 0) { peg$fail(peg$c10); }
816
847
  }
817
848
  if (s7 !== peg$FAILED) {
818
- peg$reportedPos = s0;
819
- s1 = peg$c14(s3, s5);
849
+ peg$savedPos = s0;
850
+ s1 = peg$c11(s3, s5);
820
851
  s0 = s1;
821
852
  } else {
822
853
  peg$currPos = s0;
823
- s0 = peg$c2;
854
+ s0 = peg$FAILED;
824
855
  }
825
856
  } else {
826
857
  peg$currPos = s0;
827
- s0 = peg$c2;
858
+ s0 = peg$FAILED;
828
859
  }
829
860
  } else {
830
861
  peg$currPos = s0;
831
- s0 = peg$c2;
862
+ s0 = peg$FAILED;
832
863
  }
833
864
  } else {
834
865
  peg$currPos = s0;
835
- s0 = peg$c2;
866
+ s0 = peg$FAILED;
836
867
  }
837
868
  } else {
838
869
  peg$currPos = s0;
839
- s0 = peg$c2;
870
+ s0 = peg$FAILED;
840
871
  }
841
872
  } else {
842
873
  peg$currPos = s0;
843
- s0 = peg$c2;
874
+ s0 = peg$FAILED;
844
875
  }
845
876
  } else {
846
877
  peg$currPos = s0;
847
- s0 = peg$c2;
878
+ s0 = peg$FAILED;
848
879
  }
849
880
 
850
881
  return s0;
@@ -871,28 +902,28 @@
871
902
  var s0, s1, s2, s3, s4, s5, s6;
872
903
 
873
904
  s0 = peg$currPos;
874
- if (input.substr(peg$currPos, 6) === peg$c15) {
875
- s1 = peg$c15;
905
+ if (input.substr(peg$currPos, 6) === peg$c12) {
906
+ s1 = peg$c12;
876
907
  peg$currPos += 6;
877
908
  } else {
878
909
  s1 = peg$FAILED;
879
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
910
+ if (peg$silentFails === 0) { peg$fail(peg$c13); }
880
911
  }
881
912
  if (s1 === peg$FAILED) {
882
- if (input.substr(peg$currPos, 4) === peg$c17) {
883
- s1 = peg$c17;
913
+ if (input.substr(peg$currPos, 4) === peg$c14) {
914
+ s1 = peg$c14;
884
915
  peg$currPos += 4;
885
916
  } else {
886
917
  s1 = peg$FAILED;
887
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
918
+ if (peg$silentFails === 0) { peg$fail(peg$c15); }
888
919
  }
889
920
  if (s1 === peg$FAILED) {
890
- if (input.substr(peg$currPos, 4) === peg$c19) {
891
- s1 = peg$c19;
921
+ if (input.substr(peg$currPos, 4) === peg$c16) {
922
+ s1 = peg$c16;
892
923
  peg$currPos += 4;
893
924
  } else {
894
925
  s1 = peg$FAILED;
895
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
926
+ if (peg$silentFails === 0) { peg$fail(peg$c17); }
896
927
  }
897
928
  }
898
929
  }
@@ -901,11 +932,11 @@
901
932
  if (s2 !== peg$FAILED) {
902
933
  s3 = peg$currPos;
903
934
  if (input.charCodeAt(peg$currPos) === 44) {
904
- s4 = peg$c10;
935
+ s4 = peg$c7;
905
936
  peg$currPos++;
906
937
  } else {
907
938
  s4 = peg$FAILED;
908
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
939
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
909
940
  }
910
941
  if (s4 !== peg$FAILED) {
911
942
  s5 = peg$parse_();
@@ -916,34 +947,34 @@
916
947
  s3 = s4;
917
948
  } else {
918
949
  peg$currPos = s3;
919
- s3 = peg$c2;
950
+ s3 = peg$FAILED;
920
951
  }
921
952
  } else {
922
953
  peg$currPos = s3;
923
- s3 = peg$c2;
954
+ s3 = peg$FAILED;
924
955
  }
925
956
  } else {
926
957
  peg$currPos = s3;
927
- s3 = peg$c2;
958
+ s3 = peg$FAILED;
928
959
  }
929
960
  if (s3 === peg$FAILED) {
930
- s3 = peg$c9;
961
+ s3 = null;
931
962
  }
932
963
  if (s3 !== peg$FAILED) {
933
- peg$reportedPos = s0;
934
- s1 = peg$c21(s1, s3);
964
+ peg$savedPos = s0;
965
+ s1 = peg$c18(s1, s3);
935
966
  s0 = s1;
936
967
  } else {
937
968
  peg$currPos = s0;
938
- s0 = peg$c2;
969
+ s0 = peg$FAILED;
939
970
  }
940
971
  } else {
941
972
  peg$currPos = s0;
942
- s0 = peg$c2;
973
+ s0 = peg$FAILED;
943
974
  }
944
975
  } else {
945
976
  peg$currPos = s0;
946
- s0 = peg$c2;
977
+ s0 = peg$FAILED;
947
978
  }
948
979
 
949
980
  return s0;
@@ -953,50 +984,50 @@
953
984
  var s0, s1, s2, s3, s4, s5;
954
985
 
955
986
  s0 = peg$currPos;
956
- if (input.substr(peg$currPos, 6) === peg$c22) {
957
- s1 = peg$c22;
987
+ if (input.substr(peg$currPos, 6) === peg$c19) {
988
+ s1 = peg$c19;
958
989
  peg$currPos += 6;
959
990
  } else {
960
991
  s1 = peg$FAILED;
961
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
992
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
962
993
  }
963
994
  if (s1 !== peg$FAILED) {
964
995
  s2 = peg$parse_();
965
996
  if (s2 !== peg$FAILED) {
966
997
  if (input.charCodeAt(peg$currPos) === 44) {
967
- s3 = peg$c10;
998
+ s3 = peg$c7;
968
999
  peg$currPos++;
969
1000
  } else {
970
1001
  s3 = peg$FAILED;
971
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1002
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
972
1003
  }
973
1004
  if (s3 !== peg$FAILED) {
974
1005
  s4 = peg$parse_();
975
1006
  if (s4 !== peg$FAILED) {
976
1007
  s5 = peg$parsepluralStyle();
977
1008
  if (s5 !== peg$FAILED) {
978
- peg$reportedPos = s0;
979
- s1 = peg$c24(s5);
1009
+ peg$savedPos = s0;
1010
+ s1 = peg$c21(s5);
980
1011
  s0 = s1;
981
1012
  } else {
982
1013
  peg$currPos = s0;
983
- s0 = peg$c2;
1014
+ s0 = peg$FAILED;
984
1015
  }
985
1016
  } else {
986
1017
  peg$currPos = s0;
987
- s0 = peg$c2;
1018
+ s0 = peg$FAILED;
988
1019
  }
989
1020
  } else {
990
1021
  peg$currPos = s0;
991
- s0 = peg$c2;
1022
+ s0 = peg$FAILED;
992
1023
  }
993
1024
  } else {
994
1025
  peg$currPos = s0;
995
- s0 = peg$c2;
1026
+ s0 = peg$FAILED;
996
1027
  }
997
1028
  } else {
998
1029
  peg$currPos = s0;
999
- s0 = peg$c2;
1030
+ s0 = peg$FAILED;
1000
1031
  }
1001
1032
 
1002
1033
  return s0;
@@ -1006,50 +1037,50 @@
1006
1037
  var s0, s1, s2, s3, s4, s5;
1007
1038
 
1008
1039
  s0 = peg$currPos;
1009
- if (input.substr(peg$currPos, 13) === peg$c25) {
1010
- s1 = peg$c25;
1040
+ if (input.substr(peg$currPos, 13) === peg$c22) {
1041
+ s1 = peg$c22;
1011
1042
  peg$currPos += 13;
1012
1043
  } else {
1013
1044
  s1 = peg$FAILED;
1014
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
1045
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
1015
1046
  }
1016
1047
  if (s1 !== peg$FAILED) {
1017
1048
  s2 = peg$parse_();
1018
1049
  if (s2 !== peg$FAILED) {
1019
1050
  if (input.charCodeAt(peg$currPos) === 44) {
1020
- s3 = peg$c10;
1051
+ s3 = peg$c7;
1021
1052
  peg$currPos++;
1022
1053
  } else {
1023
1054
  s3 = peg$FAILED;
1024
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1055
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
1025
1056
  }
1026
1057
  if (s3 !== peg$FAILED) {
1027
1058
  s4 = peg$parse_();
1028
1059
  if (s4 !== peg$FAILED) {
1029
1060
  s5 = peg$parsepluralStyle();
1030
1061
  if (s5 !== peg$FAILED) {
1031
- peg$reportedPos = s0;
1032
- s1 = peg$c27(s5);
1062
+ peg$savedPos = s0;
1063
+ s1 = peg$c24(s5);
1033
1064
  s0 = s1;
1034
1065
  } else {
1035
1066
  peg$currPos = s0;
1036
- s0 = peg$c2;
1067
+ s0 = peg$FAILED;
1037
1068
  }
1038
1069
  } else {
1039
1070
  peg$currPos = s0;
1040
- s0 = peg$c2;
1071
+ s0 = peg$FAILED;
1041
1072
  }
1042
1073
  } else {
1043
1074
  peg$currPos = s0;
1044
- s0 = peg$c2;
1075
+ s0 = peg$FAILED;
1045
1076
  }
1046
1077
  } else {
1047
1078
  peg$currPos = s0;
1048
- s0 = peg$c2;
1079
+ s0 = peg$FAILED;
1049
1080
  }
1050
1081
  } else {
1051
1082
  peg$currPos = s0;
1052
- s0 = peg$c2;
1083
+ s0 = peg$FAILED;
1053
1084
  }
1054
1085
 
1055
1086
  return s0;
@@ -1059,22 +1090,22 @@
1059
1090
  var s0, s1, s2, s3, s4, s5, s6;
1060
1091
 
1061
1092
  s0 = peg$currPos;
1062
- if (input.substr(peg$currPos, 6) === peg$c28) {
1063
- s1 = peg$c28;
1093
+ if (input.substr(peg$currPos, 6) === peg$c25) {
1094
+ s1 = peg$c25;
1064
1095
  peg$currPos += 6;
1065
1096
  } else {
1066
1097
  s1 = peg$FAILED;
1067
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
1098
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
1068
1099
  }
1069
1100
  if (s1 !== peg$FAILED) {
1070
1101
  s2 = peg$parse_();
1071
1102
  if (s2 !== peg$FAILED) {
1072
1103
  if (input.charCodeAt(peg$currPos) === 44) {
1073
- s3 = peg$c10;
1104
+ s3 = peg$c7;
1074
1105
  peg$currPos++;
1075
1106
  } else {
1076
1107
  s3 = peg$FAILED;
1077
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1108
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
1078
1109
  }
1079
1110
  if (s3 !== peg$FAILED) {
1080
1111
  s4 = peg$parse_();
@@ -1087,31 +1118,31 @@
1087
1118
  s6 = peg$parseoptionalFormatPattern();
1088
1119
  }
1089
1120
  } else {
1090
- s5 = peg$c2;
1121
+ s5 = peg$FAILED;
1091
1122
  }
1092
1123
  if (s5 !== peg$FAILED) {
1093
- peg$reportedPos = s0;
1094
- s1 = peg$c30(s5);
1124
+ peg$savedPos = s0;
1125
+ s1 = peg$c27(s5);
1095
1126
  s0 = s1;
1096
1127
  } else {
1097
1128
  peg$currPos = s0;
1098
- s0 = peg$c2;
1129
+ s0 = peg$FAILED;
1099
1130
  }
1100
1131
  } else {
1101
1132
  peg$currPos = s0;
1102
- s0 = peg$c2;
1133
+ s0 = peg$FAILED;
1103
1134
  }
1104
1135
  } else {
1105
1136
  peg$currPos = s0;
1106
- s0 = peg$c2;
1137
+ s0 = peg$FAILED;
1107
1138
  }
1108
1139
  } else {
1109
1140
  peg$currPos = s0;
1110
- s0 = peg$c2;
1141
+ s0 = peg$FAILED;
1111
1142
  }
1112
1143
  } else {
1113
1144
  peg$currPos = s0;
1114
- s0 = peg$c2;
1145
+ s0 = peg$FAILED;
1115
1146
  }
1116
1147
 
1117
1148
  return s0;
@@ -1123,11 +1154,11 @@
1123
1154
  s0 = peg$currPos;
1124
1155
  s1 = peg$currPos;
1125
1156
  if (input.charCodeAt(peg$currPos) === 61) {
1126
- s2 = peg$c31;
1157
+ s2 = peg$c28;
1127
1158
  peg$currPos++;
1128
1159
  } else {
1129
1160
  s2 = peg$FAILED;
1130
- if (peg$silentFails === 0) { peg$fail(peg$c32); }
1161
+ if (peg$silentFails === 0) { peg$fail(peg$c29); }
1131
1162
  }
1132
1163
  if (s2 !== peg$FAILED) {
1133
1164
  s3 = peg$parsenumber();
@@ -1136,16 +1167,17 @@
1136
1167
  s1 = s2;
1137
1168
  } else {
1138
1169
  peg$currPos = s1;
1139
- s1 = peg$c2;
1170
+ s1 = peg$FAILED;
1140
1171
  }
1141
1172
  } else {
1142
1173
  peg$currPos = s1;
1143
- s1 = peg$c2;
1174
+ s1 = peg$FAILED;
1144
1175
  }
1145
1176
  if (s1 !== peg$FAILED) {
1146
- s1 = input.substring(s0, peg$currPos);
1177
+ s0 = input.substring(s0, peg$currPos);
1178
+ } else {
1179
+ s0 = s1;
1147
1180
  }
1148
- s0 = s1;
1149
1181
  if (s0 === peg$FAILED) {
1150
1182
  s0 = peg$parsechars();
1151
1183
  }
@@ -1164,11 +1196,11 @@
1164
1196
  s3 = peg$parse_();
1165
1197
  if (s3 !== peg$FAILED) {
1166
1198
  if (input.charCodeAt(peg$currPos) === 123) {
1167
- s4 = peg$c7;
1199
+ s4 = peg$c5;
1168
1200
  peg$currPos++;
1169
1201
  } else {
1170
1202
  s4 = peg$FAILED;
1171
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
1203
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
1172
1204
  }
1173
1205
  if (s4 !== peg$FAILED) {
1174
1206
  s5 = peg$parse_();
@@ -1178,47 +1210,47 @@
1178
1210
  s7 = peg$parse_();
1179
1211
  if (s7 !== peg$FAILED) {
1180
1212
  if (input.charCodeAt(peg$currPos) === 125) {
1181
- s8 = peg$c12;
1213
+ s8 = peg$c9;
1182
1214
  peg$currPos++;
1183
1215
  } else {
1184
1216
  s8 = peg$FAILED;
1185
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
1217
+ if (peg$silentFails === 0) { peg$fail(peg$c10); }
1186
1218
  }
1187
1219
  if (s8 !== peg$FAILED) {
1188
- peg$reportedPos = s0;
1189
- s1 = peg$c33(s2, s6);
1220
+ peg$savedPos = s0;
1221
+ s1 = peg$c30(s2, s6);
1190
1222
  s0 = s1;
1191
1223
  } else {
1192
1224
  peg$currPos = s0;
1193
- s0 = peg$c2;
1225
+ s0 = peg$FAILED;
1194
1226
  }
1195
1227
  } else {
1196
1228
  peg$currPos = s0;
1197
- s0 = peg$c2;
1229
+ s0 = peg$FAILED;
1198
1230
  }
1199
1231
  } else {
1200
1232
  peg$currPos = s0;
1201
- s0 = peg$c2;
1233
+ s0 = peg$FAILED;
1202
1234
  }
1203
1235
  } else {
1204
1236
  peg$currPos = s0;
1205
- s0 = peg$c2;
1237
+ s0 = peg$FAILED;
1206
1238
  }
1207
1239
  } else {
1208
1240
  peg$currPos = s0;
1209
- s0 = peg$c2;
1241
+ s0 = peg$FAILED;
1210
1242
  }
1211
1243
  } else {
1212
1244
  peg$currPos = s0;
1213
- s0 = peg$c2;
1245
+ s0 = peg$FAILED;
1214
1246
  }
1215
1247
  } else {
1216
1248
  peg$currPos = s0;
1217
- s0 = peg$c2;
1249
+ s0 = peg$FAILED;
1218
1250
  }
1219
1251
  } else {
1220
1252
  peg$currPos = s0;
1221
- s0 = peg$c2;
1253
+ s0 = peg$FAILED;
1222
1254
  }
1223
1255
 
1224
1256
  return s0;
@@ -1228,32 +1260,32 @@
1228
1260
  var s0, s1, s2, s3;
1229
1261
 
1230
1262
  s0 = peg$currPos;
1231
- if (input.substr(peg$currPos, 7) === peg$c34) {
1232
- s1 = peg$c34;
1263
+ if (input.substr(peg$currPos, 7) === peg$c31) {
1264
+ s1 = peg$c31;
1233
1265
  peg$currPos += 7;
1234
1266
  } else {
1235
1267
  s1 = peg$FAILED;
1236
- if (peg$silentFails === 0) { peg$fail(peg$c35); }
1268
+ if (peg$silentFails === 0) { peg$fail(peg$c32); }
1237
1269
  }
1238
1270
  if (s1 !== peg$FAILED) {
1239
1271
  s2 = peg$parse_();
1240
1272
  if (s2 !== peg$FAILED) {
1241
1273
  s3 = peg$parsenumber();
1242
1274
  if (s3 !== peg$FAILED) {
1243
- peg$reportedPos = s0;
1244
- s1 = peg$c36(s3);
1275
+ peg$savedPos = s0;
1276
+ s1 = peg$c33(s3);
1245
1277
  s0 = s1;
1246
1278
  } else {
1247
1279
  peg$currPos = s0;
1248
- s0 = peg$c2;
1280
+ s0 = peg$FAILED;
1249
1281
  }
1250
1282
  } else {
1251
1283
  peg$currPos = s0;
1252
- s0 = peg$c2;
1284
+ s0 = peg$FAILED;
1253
1285
  }
1254
1286
  } else {
1255
1287
  peg$currPos = s0;
1256
- s0 = peg$c2;
1288
+ s0 = peg$FAILED;
1257
1289
  }
1258
1290
 
1259
1291
  return s0;
@@ -1265,7 +1297,7 @@
1265
1297
  s0 = peg$currPos;
1266
1298
  s1 = peg$parseoffset();
1267
1299
  if (s1 === peg$FAILED) {
1268
- s1 = peg$c9;
1300
+ s1 = null;
1269
1301
  }
1270
1302
  if (s1 !== peg$FAILED) {
1271
1303
  s2 = peg$parse_();
@@ -1278,23 +1310,23 @@
1278
1310
  s4 = peg$parseoptionalFormatPattern();
1279
1311
  }
1280
1312
  } else {
1281
- s3 = peg$c2;
1313
+ s3 = peg$FAILED;
1282
1314
  }
1283
1315
  if (s3 !== peg$FAILED) {
1284
- peg$reportedPos = s0;
1285
- s1 = peg$c37(s1, s3);
1316
+ peg$savedPos = s0;
1317
+ s1 = peg$c34(s1, s3);
1286
1318
  s0 = s1;
1287
1319
  } else {
1288
1320
  peg$currPos = s0;
1289
- s0 = peg$c2;
1321
+ s0 = peg$FAILED;
1290
1322
  }
1291
1323
  } else {
1292
1324
  peg$currPos = s0;
1293
- s0 = peg$c2;
1325
+ s0 = peg$FAILED;
1294
1326
  }
1295
1327
  } else {
1296
1328
  peg$currPos = s0;
1297
- s0 = peg$c2;
1329
+ s0 = peg$FAILED;
1298
1330
  }
1299
1331
 
1300
1332
  return s0;
@@ -1305,31 +1337,31 @@
1305
1337
 
1306
1338
  peg$silentFails++;
1307
1339
  s0 = [];
1308
- if (peg$c39.test(input.charAt(peg$currPos))) {
1340
+ if (peg$c36.test(input.charAt(peg$currPos))) {
1309
1341
  s1 = input.charAt(peg$currPos);
1310
1342
  peg$currPos++;
1311
1343
  } else {
1312
1344
  s1 = peg$FAILED;
1313
- if (peg$silentFails === 0) { peg$fail(peg$c40); }
1345
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
1314
1346
  }
1315
1347
  if (s1 !== peg$FAILED) {
1316
1348
  while (s1 !== peg$FAILED) {
1317
1349
  s0.push(s1);
1318
- if (peg$c39.test(input.charAt(peg$currPos))) {
1350
+ if (peg$c36.test(input.charAt(peg$currPos))) {
1319
1351
  s1 = input.charAt(peg$currPos);
1320
1352
  peg$currPos++;
1321
1353
  } else {
1322
1354
  s1 = peg$FAILED;
1323
- if (peg$silentFails === 0) { peg$fail(peg$c40); }
1355
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
1324
1356
  }
1325
1357
  }
1326
1358
  } else {
1327
- s0 = peg$c2;
1359
+ s0 = peg$FAILED;
1328
1360
  }
1329
1361
  peg$silentFails--;
1330
1362
  if (s0 === peg$FAILED) {
1331
1363
  s1 = peg$FAILED;
1332
- if (peg$silentFails === 0) { peg$fail(peg$c38); }
1364
+ if (peg$silentFails === 0) { peg$fail(peg$c35); }
1333
1365
  }
1334
1366
 
1335
1367
  return s0;
@@ -1347,13 +1379,14 @@
1347
1379
  s2 = peg$parsews();
1348
1380
  }
1349
1381
  if (s1 !== peg$FAILED) {
1350
- s1 = input.substring(s0, peg$currPos);
1382
+ s0 = input.substring(s0, peg$currPos);
1383
+ } else {
1384
+ s0 = s1;
1351
1385
  }
1352
- s0 = s1;
1353
1386
  peg$silentFails--;
1354
1387
  if (s0 === peg$FAILED) {
1355
1388
  s1 = peg$FAILED;
1356
- if (peg$silentFails === 0) { peg$fail(peg$c41); }
1389
+ if (peg$silentFails === 0) { peg$fail(peg$c38); }
1357
1390
  }
1358
1391
 
1359
1392
  return s0;
@@ -1362,12 +1395,12 @@
1362
1395
  function peg$parsedigit() {
1363
1396
  var s0;
1364
1397
 
1365
- if (peg$c42.test(input.charAt(peg$currPos))) {
1398
+ if (peg$c39.test(input.charAt(peg$currPos))) {
1366
1399
  s0 = input.charAt(peg$currPos);
1367
1400
  peg$currPos++;
1368
1401
  } else {
1369
1402
  s0 = peg$FAILED;
1370
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1403
+ if (peg$silentFails === 0) { peg$fail(peg$c40); }
1371
1404
  }
1372
1405
 
1373
1406
  return s0;
@@ -1376,12 +1409,12 @@
1376
1409
  function peg$parsehexDigit() {
1377
1410
  var s0;
1378
1411
 
1379
- if (peg$c44.test(input.charAt(peg$currPos))) {
1412
+ if (peg$c41.test(input.charAt(peg$currPos))) {
1380
1413
  s0 = input.charAt(peg$currPos);
1381
1414
  peg$currPos++;
1382
1415
  } else {
1383
1416
  s0 = peg$FAILED;
1384
- if (peg$silentFails === 0) { peg$fail(peg$c45); }
1417
+ if (peg$silentFails === 0) { peg$fail(peg$c42); }
1385
1418
  }
1386
1419
 
1387
1420
  return s0;
@@ -1392,21 +1425,21 @@
1392
1425
 
1393
1426
  s0 = peg$currPos;
1394
1427
  if (input.charCodeAt(peg$currPos) === 48) {
1395
- s1 = peg$c46;
1428
+ s1 = peg$c43;
1396
1429
  peg$currPos++;
1397
1430
  } else {
1398
1431
  s1 = peg$FAILED;
1399
- if (peg$silentFails === 0) { peg$fail(peg$c47); }
1432
+ if (peg$silentFails === 0) { peg$fail(peg$c44); }
1400
1433
  }
1401
1434
  if (s1 === peg$FAILED) {
1402
1435
  s1 = peg$currPos;
1403
1436
  s2 = peg$currPos;
1404
- if (peg$c48.test(input.charAt(peg$currPos))) {
1437
+ if (peg$c45.test(input.charAt(peg$currPos))) {
1405
1438
  s3 = input.charAt(peg$currPos);
1406
1439
  peg$currPos++;
1407
1440
  } else {
1408
1441
  s3 = peg$FAILED;
1409
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
1442
+ if (peg$silentFails === 0) { peg$fail(peg$c46); }
1410
1443
  }
1411
1444
  if (s3 !== peg$FAILED) {
1412
1445
  s4 = [];
@@ -1420,20 +1453,21 @@
1420
1453
  s2 = s3;
1421
1454
  } else {
1422
1455
  peg$currPos = s2;
1423
- s2 = peg$c2;
1456
+ s2 = peg$FAILED;
1424
1457
  }
1425
1458
  } else {
1426
1459
  peg$currPos = s2;
1427
- s2 = peg$c2;
1460
+ s2 = peg$FAILED;
1428
1461
  }
1429
1462
  if (s2 !== peg$FAILED) {
1430
- s2 = input.substring(s1, peg$currPos);
1463
+ s1 = input.substring(s1, peg$currPos);
1464
+ } else {
1465
+ s1 = s2;
1431
1466
  }
1432
- s1 = s2;
1433
1467
  }
1434
1468
  if (s1 !== peg$FAILED) {
1435
- peg$reportedPos = s0;
1436
- s1 = peg$c50(s1);
1469
+ peg$savedPos = s0;
1470
+ s1 = peg$c47(s1);
1437
1471
  }
1438
1472
  s0 = s1;
1439
1473
 
@@ -1443,77 +1477,77 @@
1443
1477
  function peg$parsechar() {
1444
1478
  var s0, s1, s2, s3, s4, s5, s6, s7;
1445
1479
 
1446
- if (peg$c51.test(input.charAt(peg$currPos))) {
1480
+ if (peg$c48.test(input.charAt(peg$currPos))) {
1447
1481
  s0 = input.charAt(peg$currPos);
1448
1482
  peg$currPos++;
1449
1483
  } else {
1450
1484
  s0 = peg$FAILED;
1451
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
1485
+ if (peg$silentFails === 0) { peg$fail(peg$c49); }
1452
1486
  }
1453
1487
  if (s0 === peg$FAILED) {
1454
1488
  s0 = peg$currPos;
1455
- if (input.substr(peg$currPos, 2) === peg$c53) {
1456
- s1 = peg$c53;
1489
+ if (input.substr(peg$currPos, 2) === peg$c50) {
1490
+ s1 = peg$c50;
1457
1491
  peg$currPos += 2;
1458
1492
  } else {
1459
1493
  s1 = peg$FAILED;
1460
- if (peg$silentFails === 0) { peg$fail(peg$c54); }
1494
+ if (peg$silentFails === 0) { peg$fail(peg$c51); }
1461
1495
  }
1462
1496
  if (s1 !== peg$FAILED) {
1463
- peg$reportedPos = s0;
1464
- s1 = peg$c55();
1497
+ peg$savedPos = s0;
1498
+ s1 = peg$c52();
1465
1499
  }
1466
1500
  s0 = s1;
1467
1501
  if (s0 === peg$FAILED) {
1468
1502
  s0 = peg$currPos;
1469
- if (input.substr(peg$currPos, 2) === peg$c56) {
1470
- s1 = peg$c56;
1503
+ if (input.substr(peg$currPos, 2) === peg$c53) {
1504
+ s1 = peg$c53;
1471
1505
  peg$currPos += 2;
1472
1506
  } else {
1473
1507
  s1 = peg$FAILED;
1474
- if (peg$silentFails === 0) { peg$fail(peg$c57); }
1508
+ if (peg$silentFails === 0) { peg$fail(peg$c54); }
1475
1509
  }
1476
1510
  if (s1 !== peg$FAILED) {
1477
- peg$reportedPos = s0;
1478
- s1 = peg$c58();
1511
+ peg$savedPos = s0;
1512
+ s1 = peg$c55();
1479
1513
  }
1480
1514
  s0 = s1;
1481
1515
  if (s0 === peg$FAILED) {
1482
1516
  s0 = peg$currPos;
1483
- if (input.substr(peg$currPos, 2) === peg$c59) {
1484
- s1 = peg$c59;
1517
+ if (input.substr(peg$currPos, 2) === peg$c56) {
1518
+ s1 = peg$c56;
1485
1519
  peg$currPos += 2;
1486
1520
  } else {
1487
1521
  s1 = peg$FAILED;
1488
- if (peg$silentFails === 0) { peg$fail(peg$c60); }
1522
+ if (peg$silentFails === 0) { peg$fail(peg$c57); }
1489
1523
  }
1490
1524
  if (s1 !== peg$FAILED) {
1491
- peg$reportedPos = s0;
1492
- s1 = peg$c61();
1525
+ peg$savedPos = s0;
1526
+ s1 = peg$c58();
1493
1527
  }
1494
1528
  s0 = s1;
1495
1529
  if (s0 === peg$FAILED) {
1496
1530
  s0 = peg$currPos;
1497
- if (input.substr(peg$currPos, 2) === peg$c62) {
1498
- s1 = peg$c62;
1531
+ if (input.substr(peg$currPos, 2) === peg$c59) {
1532
+ s1 = peg$c59;
1499
1533
  peg$currPos += 2;
1500
1534
  } else {
1501
1535
  s1 = peg$FAILED;
1502
- if (peg$silentFails === 0) { peg$fail(peg$c63); }
1536
+ if (peg$silentFails === 0) { peg$fail(peg$c60); }
1503
1537
  }
1504
1538
  if (s1 !== peg$FAILED) {
1505
- peg$reportedPos = s0;
1506
- s1 = peg$c64();
1539
+ peg$savedPos = s0;
1540
+ s1 = peg$c61();
1507
1541
  }
1508
1542
  s0 = s1;
1509
1543
  if (s0 === peg$FAILED) {
1510
1544
  s0 = peg$currPos;
1511
- if (input.substr(peg$currPos, 2) === peg$c65) {
1512
- s1 = peg$c65;
1545
+ if (input.substr(peg$currPos, 2) === peg$c62) {
1546
+ s1 = peg$c62;
1513
1547
  peg$currPos += 2;
1514
1548
  } else {
1515
1549
  s1 = peg$FAILED;
1516
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
1550
+ if (peg$silentFails === 0) { peg$fail(peg$c63); }
1517
1551
  }
1518
1552
  if (s1 !== peg$FAILED) {
1519
1553
  s2 = peg$currPos;
@@ -1530,35 +1564,36 @@
1530
1564
  s3 = s4;
1531
1565
  } else {
1532
1566
  peg$currPos = s3;
1533
- s3 = peg$c2;
1567
+ s3 = peg$FAILED;
1534
1568
  }
1535
1569
  } else {
1536
1570
  peg$currPos = s3;
1537
- s3 = peg$c2;
1571
+ s3 = peg$FAILED;
1538
1572
  }
1539
1573
  } else {
1540
1574
  peg$currPos = s3;
1541
- s3 = peg$c2;
1575
+ s3 = peg$FAILED;
1542
1576
  }
1543
1577
  } else {
1544
1578
  peg$currPos = s3;
1545
- s3 = peg$c2;
1579
+ s3 = peg$FAILED;
1546
1580
  }
1547
1581
  if (s3 !== peg$FAILED) {
1548
- s3 = input.substring(s2, peg$currPos);
1582
+ s2 = input.substring(s2, peg$currPos);
1583
+ } else {
1584
+ s2 = s3;
1549
1585
  }
1550
- s2 = s3;
1551
1586
  if (s2 !== peg$FAILED) {
1552
- peg$reportedPos = s0;
1553
- s1 = peg$c67(s2);
1587
+ peg$savedPos = s0;
1588
+ s1 = peg$c64(s2);
1554
1589
  s0 = s1;
1555
1590
  } else {
1556
1591
  peg$currPos = s0;
1557
- s0 = peg$c2;
1592
+ s0 = peg$FAILED;
1558
1593
  }
1559
1594
  } else {
1560
1595
  peg$currPos = s0;
1561
- s0 = peg$c2;
1596
+ s0 = peg$FAILED;
1562
1597
  }
1563
1598
  }
1564
1599
  }
@@ -1581,11 +1616,11 @@
1581
1616
  s2 = peg$parsechar();
1582
1617
  }
1583
1618
  } else {
1584
- s1 = peg$c2;
1619
+ s1 = peg$FAILED;
1585
1620
  }
1586
1621
  if (s1 !== peg$FAILED) {
1587
- peg$reportedPos = s0;
1588
- s1 = peg$c68(s1);
1622
+ peg$savedPos = s0;
1623
+ s1 = peg$c65(s1);
1589
1624
  }
1590
1625
  s0 = s1;
1591
1626
 
@@ -1601,13 +1636,20 @@
1601
1636
  peg$fail({ type: "end", description: "end of input" });
1602
1637
  }
1603
1638
 
1604
- throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
1639
+ throw peg$buildException(
1640
+ null,
1641
+ peg$maxFailExpected,
1642
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1643
+ peg$maxFailPos < input.length
1644
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1645
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1646
+ );
1605
1647
  }
1606
1648
  }
1607
1649
 
1608
1650
  return {
1609
- SyntaxError: SyntaxError,
1610
- parse: parse
1651
+ SyntaxError: peg$SyntaxError,
1652
+ parse: peg$parse
1611
1653
  };
1612
1654
  })();
1613
1655