intl-messageformat 1.2.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.
Files changed (229) hide show
  1. package/README.md +1 -1
  2. package/dist/intl-messageformat-with-locales.js +439 -579
  3. package/dist/intl-messageformat-with-locales.js.map +1 -1
  4. package/dist/intl-messageformat-with-locales.min.js +3 -3
  5. package/dist/intl-messageformat-with-locales.min.js.map +1 -1
  6. package/dist/intl-messageformat.js +381 -325
  7. package/dist/intl-messageformat.js.map +1 -1
  8. package/dist/intl-messageformat.min.js +1 -1
  9. package/dist/intl-messageformat.min.js.map +1 -1
  10. package/dist/locale-data/af.js +0 -1
  11. package/dist/locale-data/agq.js +0 -1
  12. package/dist/locale-data/ak.js +0 -1
  13. package/dist/locale-data/am.js +0 -1
  14. package/dist/locale-data/ar.js +0 -1
  15. package/dist/locale-data/as.js +1 -2
  16. package/dist/locale-data/asa.js +0 -1
  17. package/dist/locale-data/ast.js +0 -1
  18. package/dist/locale-data/az.js +1 -2
  19. package/dist/locale-data/bas.js +0 -1
  20. package/dist/locale-data/be.js +1 -2
  21. package/dist/locale-data/bem.js +0 -1
  22. package/dist/locale-data/bez.js +0 -1
  23. package/dist/locale-data/bg.js +0 -1
  24. package/dist/locale-data/bm.js +0 -2
  25. package/dist/locale-data/bn.js +0 -1
  26. package/dist/locale-data/bo.js +0 -1
  27. package/dist/locale-data/br.js +0 -1
  28. package/dist/locale-data/brx.js +0 -1
  29. package/dist/locale-data/bs.js +0 -2
  30. package/dist/locale-data/ca.js +1 -1
  31. package/dist/locale-data/ce.js +1 -0
  32. package/dist/locale-data/cgg.js +0 -1
  33. package/dist/locale-data/chr.js +0 -1
  34. package/dist/locale-data/ckb.js +1 -0
  35. package/dist/locale-data/cs.js +0 -1
  36. package/dist/locale-data/cu.js +1 -0
  37. package/dist/locale-data/cy.js +0 -1
  38. package/dist/locale-data/da.js +0 -1
  39. package/dist/locale-data/dav.js +0 -1
  40. package/dist/locale-data/de.js +0 -1
  41. package/dist/locale-data/dje.js +0 -1
  42. package/dist/locale-data/dsb.js +0 -1
  43. package/dist/locale-data/dua.js +0 -1
  44. package/dist/locale-data/dyo.js +0 -1
  45. package/dist/locale-data/dz.js +0 -1
  46. package/dist/locale-data/ebu.js +0 -1
  47. package/dist/locale-data/ee.js +0 -1
  48. package/dist/locale-data/el.js +0 -1
  49. package/dist/locale-data/en.js +34 -23
  50. package/dist/locale-data/eo.js +0 -1
  51. package/dist/locale-data/es.js +0 -1
  52. package/dist/locale-data/et.js +0 -1
  53. package/dist/locale-data/eu.js +0 -1
  54. package/dist/locale-data/ewo.js +0 -1
  55. package/dist/locale-data/fa.js +0 -1
  56. package/dist/locale-data/ff.js +0 -1
  57. package/dist/locale-data/fi.js +0 -1
  58. package/dist/locale-data/fil.js +0 -1
  59. package/dist/locale-data/fo.js +1 -1
  60. package/dist/locale-data/fr.js +0 -1
  61. package/dist/locale-data/fur.js +0 -1
  62. package/dist/locale-data/fy.js +0 -1
  63. package/dist/locale-data/ga.js +1 -2
  64. package/dist/locale-data/gd.js +0 -1
  65. package/dist/locale-data/gl.js +0 -1
  66. package/dist/locale-data/gsw.js +0 -1
  67. package/dist/locale-data/gu.js +0 -1
  68. package/dist/locale-data/guz.js +0 -1
  69. package/dist/locale-data/gv.js +0 -1
  70. package/dist/locale-data/ha.js +2 -4
  71. package/dist/locale-data/haw.js +0 -1
  72. package/dist/locale-data/he.js +0 -1
  73. package/dist/locale-data/hi.js +0 -1
  74. package/dist/locale-data/hr.js +0 -1
  75. package/dist/locale-data/hsb.js +0 -1
  76. package/dist/locale-data/hu.js +0 -1
  77. package/dist/locale-data/hy.js +0 -1
  78. package/dist/locale-data/id.js +0 -1
  79. package/dist/locale-data/ig.js +0 -1
  80. package/dist/locale-data/ii.js +0 -1
  81. package/dist/locale-data/is.js +0 -1
  82. package/dist/locale-data/it.js +0 -1
  83. package/dist/locale-data/iu.js +1 -0
  84. package/dist/locale-data/ja.js +0 -1
  85. package/dist/locale-data/jgo.js +0 -1
  86. package/dist/locale-data/jmc.js +0 -1
  87. package/dist/locale-data/ka.js +0 -1
  88. package/dist/locale-data/kab.js +0 -1
  89. package/dist/locale-data/kam.js +0 -1
  90. package/dist/locale-data/kde.js +0 -1
  91. package/dist/locale-data/kea.js +0 -1
  92. package/dist/locale-data/khq.js +0 -1
  93. package/dist/locale-data/ki.js +0 -1
  94. package/dist/locale-data/kk.js +0 -2
  95. package/dist/locale-data/kkj.js +0 -1
  96. package/dist/locale-data/kl.js +0 -1
  97. package/dist/locale-data/kln.js +0 -1
  98. package/dist/locale-data/km.js +0 -1
  99. package/dist/locale-data/kn.js +0 -1
  100. package/dist/locale-data/ko.js +0 -1
  101. package/dist/locale-data/kok.js +0 -1
  102. package/dist/locale-data/ks.js +0 -2
  103. package/dist/locale-data/ksb.js +0 -1
  104. package/dist/locale-data/ksf.js +0 -1
  105. package/dist/locale-data/ksh.js +0 -1
  106. package/dist/locale-data/kw.js +0 -1
  107. package/dist/locale-data/ky.js +0 -2
  108. package/dist/locale-data/lag.js +0 -1
  109. package/dist/locale-data/lb.js +0 -1
  110. package/dist/locale-data/lg.js +0 -1
  111. package/dist/locale-data/lkt.js +0 -1
  112. package/dist/locale-data/ln.js +0 -1
  113. package/dist/locale-data/lo.js +0 -1
  114. package/dist/locale-data/lrc.js +2 -0
  115. package/dist/locale-data/lt.js +0 -1
  116. package/dist/locale-data/lu.js +0 -1
  117. package/dist/locale-data/luo.js +0 -1
  118. package/dist/locale-data/luy.js +0 -1
  119. package/dist/locale-data/lv.js +0 -1
  120. package/dist/locale-data/mas.js +0 -1
  121. package/dist/locale-data/mer.js +0 -1
  122. package/dist/locale-data/mfe.js +0 -1
  123. package/dist/locale-data/mg.js +0 -1
  124. package/dist/locale-data/mgh.js +0 -1
  125. package/dist/locale-data/mgo.js +0 -1
  126. package/dist/locale-data/mk.js +0 -1
  127. package/dist/locale-data/ml.js +0 -1
  128. package/dist/locale-data/mn.js +0 -2
  129. package/dist/locale-data/mr.js +0 -1
  130. package/dist/locale-data/ms.js +2 -4
  131. package/dist/locale-data/mt.js +0 -1
  132. package/dist/locale-data/mua.js +0 -1
  133. package/dist/locale-data/my.js +0 -1
  134. package/dist/locale-data/mzn.js +1 -0
  135. package/dist/locale-data/naq.js +0 -1
  136. package/dist/locale-data/nb.js +0 -1
  137. package/dist/locale-data/nd.js +0 -1
  138. package/dist/locale-data/ne.js +0 -1
  139. package/dist/locale-data/nl.js +0 -1
  140. package/dist/locale-data/nmg.js +0 -1
  141. package/dist/locale-data/nn.js +0 -1
  142. package/dist/locale-data/nnh.js +0 -1
  143. package/dist/locale-data/nr.js +0 -1
  144. package/dist/locale-data/nso.js +0 -1
  145. package/dist/locale-data/nus.js +0 -1
  146. package/dist/locale-data/nyn.js +0 -1
  147. package/dist/locale-data/om.js +0 -1
  148. package/dist/locale-data/or.js +0 -1
  149. package/dist/locale-data/os.js +0 -1
  150. package/dist/locale-data/pa.js +0 -2
  151. package/dist/locale-data/pl.js +0 -1
  152. package/dist/locale-data/ps.js +0 -1
  153. package/dist/locale-data/pt.js +0 -1
  154. package/dist/locale-data/qu.js +0 -1
  155. package/dist/locale-data/rm.js +0 -1
  156. package/dist/locale-data/rn.js +0 -1
  157. package/dist/locale-data/ro.js +0 -1
  158. package/dist/locale-data/rof.js +0 -1
  159. package/dist/locale-data/ru.js +0 -1
  160. package/dist/locale-data/rw.js +0 -1
  161. package/dist/locale-data/rwk.js +0 -1
  162. package/dist/locale-data/sah.js +0 -1
  163. package/dist/locale-data/saq.js +0 -1
  164. package/dist/locale-data/sbp.js +0 -1
  165. package/dist/locale-data/sdh.js +1 -0
  166. package/dist/locale-data/se.js +0 -1
  167. package/dist/locale-data/seh.js +0 -1
  168. package/dist/locale-data/ses.js +0 -1
  169. package/dist/locale-data/sg.js +0 -1
  170. package/dist/locale-data/shi.js +0 -2
  171. package/dist/locale-data/si.js +0 -1
  172. package/dist/locale-data/sk.js +0 -1
  173. package/dist/locale-data/sl.js +0 -1
  174. package/dist/locale-data/smn.js +0 -1
  175. package/dist/locale-data/sn.js +0 -1
  176. package/dist/locale-data/so.js +0 -1
  177. package/dist/locale-data/sq.js +0 -1
  178. package/dist/locale-data/sr.js +0 -2
  179. package/dist/locale-data/ss.js +0 -2
  180. package/dist/locale-data/ssy.js +0 -1
  181. package/dist/locale-data/sv.js +0 -1
  182. package/dist/locale-data/sw.js +1 -1
  183. package/dist/locale-data/ta.js +0 -1
  184. package/dist/locale-data/te.js +0 -1
  185. package/dist/locale-data/teo.js +0 -1
  186. package/dist/locale-data/th.js +0 -1
  187. package/dist/locale-data/ti.js +0 -1
  188. package/dist/locale-data/tn.js +0 -2
  189. package/dist/locale-data/to.js +0 -1
  190. package/dist/locale-data/tr.js +0 -1
  191. package/dist/locale-data/ts.js +0 -1
  192. package/dist/locale-data/twq.js +0 -1
  193. package/dist/locale-data/tzm.js +0 -2
  194. package/dist/locale-data/ug.js +0 -2
  195. package/dist/locale-data/uk.js +0 -1
  196. package/dist/locale-data/ur.js +0 -1
  197. package/dist/locale-data/uz.js +0 -3
  198. package/dist/locale-data/vai.js +0 -2
  199. package/dist/locale-data/ve.js +0 -1
  200. package/dist/locale-data/vi.js +0 -1
  201. package/dist/locale-data/vo.js +0 -1
  202. package/dist/locale-data/vun.js +0 -1
  203. package/dist/locale-data/wae.js +0 -1
  204. package/dist/locale-data/xog.js +0 -1
  205. package/dist/locale-data/yav.js +0 -1
  206. package/dist/locale-data/yi.js +0 -1
  207. package/dist/locale-data/yo.js +0 -1
  208. package/dist/locale-data/zgh.js +0 -1
  209. package/dist/locale-data/zh.js +0 -2
  210. package/dist/locale-data/zu.js +0 -1
  211. package/index.d.ts +7 -0
  212. package/lib/compiler.js +1 -1
  213. package/lib/compiler.js.map +1 -0
  214. package/lib/core.js +15 -2
  215. package/lib/core.js.map +1 -0
  216. package/lib/en.js.map +1 -0
  217. package/lib/es5.js +1 -0
  218. package/lib/es5.js.map +1 -0
  219. package/lib/locales.js +53 -251
  220. package/lib/main.js.map +1 -0
  221. package/lib/utils.js.map +1 -0
  222. package/package.json +3 -3
  223. package/src/compiler.js +1 -1
  224. package/src/core.js +15 -2
  225. package/src/es5.js +2 -2
  226. package/yarn.lock +3665 -0
  227. package/dist/locale-data/aa.js +0 -4
  228. package/dist/locale-data/ia.js +0 -2
  229. package/dist/locale-data/swc.js +0 -2
@@ -55,6 +55,7 @@
55
55
 
56
56
  return obj;
57
57
  };
58
+
58
59
  var $$compiler$$default = $$compiler$$Compiler;
59
60
 
60
61
  function $$compiler$$Compiler(locales, formats, pluralFn) {
@@ -205,7 +206,7 @@
205
206
  }
206
207
 
207
208
  $$compiler$$StringFormat.prototype.format = function (value) {
208
- if (!value) {
209
+ if (!value && typeof value !== 'number') {
209
210
  return '';
210
211
  }
211
212
 
@@ -255,10 +256,12 @@
255
256
  };
256
257
 
257
258
  var intl$messageformat$parser$$default = (function() {
259
+ "use strict";
260
+
258
261
  /*
259
- * Generated by PEG.js 0.8.0.
262
+ * Generated by PEG.js 0.9.0.
260
263
  *
261
- * http://pegjs.majda.cz/
264
+ * http://pegjs.org/
262
265
  */
263
266
 
264
267
  function peg$subclass(child, parent) {
@@ -267,36 +270,37 @@
267
270
  child.prototype = new ctor();
268
271
  }
269
272
 
270
- function SyntaxError(message, expected, found, offset, line, column) {
273
+ function peg$SyntaxError(message, expected, found, location) {
271
274
  this.message = message;
272
275
  this.expected = expected;
273
276
  this.found = found;
274
- this.offset = offset;
275
- this.line = line;
276
- this.column = column;
277
-
277
+ this.location = location;
278
278
  this.name = "SyntaxError";
279
+
280
+ if (typeof Error.captureStackTrace === "function") {
281
+ Error.captureStackTrace(this, peg$SyntaxError);
282
+ }
279
283
  }
280
284
 
281
- peg$subclass(SyntaxError, Error);
285
+ peg$subclass(peg$SyntaxError, Error);
282
286
 
283
- function parse(input) {
287
+ function peg$parse(input) {
284
288
  var options = arguments.length > 1 ? arguments[1] : {},
289
+ parser = this,
285
290
 
286
291
  peg$FAILED = {},
287
292
 
288
293
  peg$startRuleFunctions = { start: peg$parsestart },
289
294
  peg$startRuleFunction = peg$parsestart,
290
295
 
291
- peg$c0 = [],
292
- peg$c1 = function(elements) {
296
+ peg$c0 = function(elements) {
293
297
  return {
294
298
  type : 'messageFormatPattern',
295
- elements: elements
299
+ elements: elements,
300
+ location: location()
296
301
  };
297
302
  },
298
- peg$c2 = peg$FAILED,
299
- peg$c3 = function(text) {
303
+ peg$c1 = function(text) {
300
304
  var string = '',
301
305
  i, j, outerLen, inner, innerLen;
302
306
 
@@ -310,129 +314,135 @@
310
314
 
311
315
  return string;
312
316
  },
313
- peg$c4 = function(messageText) {
317
+ peg$c2 = function(messageText) {
314
318
  return {
315
319
  type : 'messageTextElement',
316
- value: messageText
320
+ value: messageText,
321
+ location: location()
317
322
  };
318
323
  },
319
- peg$c5 = /^[^ \t\n\r,.+={}#]/,
320
- peg$c6 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
321
- peg$c7 = "{",
322
- peg$c8 = { type: "literal", value: "{", description: "\"{\"" },
323
- peg$c9 = null,
324
- peg$c10 = ",",
325
- peg$c11 = { type: "literal", value: ",", description: "\",\"" },
326
- peg$c12 = "}",
327
- peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
328
- 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) {
329
333
  return {
330
334
  type : 'argumentElement',
331
335
  id : id,
332
- format: format && format[2]
336
+ format: format && format[2],
337
+ location: location()
333
338
  };
334
339
  },
335
- peg$c15 = "number",
336
- peg$c16 = { type: "literal", value: "number", description: "\"number\"" },
337
- peg$c17 = "date",
338
- peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
339
- peg$c19 = "time",
340
- peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
341
- 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) {
342
347
  return {
343
348
  type : type + 'Format',
344
- style: style && style[2]
349
+ style: style && style[2],
350
+ location: location()
345
351
  };
346
352
  },
347
- peg$c22 = "plural",
348
- peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
349
- peg$c24 = function(pluralStyle) {
353
+ peg$c19 = "plural",
354
+ peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
355
+ peg$c21 = function(pluralStyle) {
350
356
  return {
351
357
  type : pluralStyle.type,
352
358
  ordinal: false,
353
359
  offset : pluralStyle.offset || 0,
354
- options: pluralStyle.options
360
+ options: pluralStyle.options,
361
+ location: location()
355
362
  };
356
363
  },
357
- peg$c25 = "selectordinal",
358
- peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
359
- peg$c27 = function(pluralStyle) {
364
+ peg$c22 = "selectordinal",
365
+ peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
366
+ peg$c24 = function(pluralStyle) {
360
367
  return {
361
368
  type : pluralStyle.type,
362
369
  ordinal: true,
363
370
  offset : pluralStyle.offset || 0,
364
- options: pluralStyle.options
371
+ options: pluralStyle.options,
372
+ location: location()
365
373
  }
366
374
  },
367
- peg$c28 = "select",
368
- peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
369
- peg$c30 = function(options) {
375
+ peg$c25 = "select",
376
+ peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
377
+ peg$c27 = function(options) {
370
378
  return {
371
379
  type : 'selectFormat',
372
- options: options
380
+ options: options,
381
+ location: location()
373
382
  };
374
383
  },
375
- peg$c31 = "=",
376
- peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
377
- peg$c33 = function(selector, pattern) {
384
+ peg$c28 = "=",
385
+ peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
386
+ peg$c30 = function(selector, pattern) {
378
387
  return {
379
388
  type : 'optionalFormatPattern',
380
389
  selector: selector,
381
- value : pattern
390
+ value : pattern,
391
+ location: location()
382
392
  };
383
393
  },
384
- peg$c34 = "offset:",
385
- peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
386
- peg$c36 = function(number) {
394
+ peg$c31 = "offset:",
395
+ peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
396
+ peg$c33 = function(number) {
387
397
  return number;
388
398
  },
389
- peg$c37 = function(offset, options) {
399
+ peg$c34 = function(offset, options) {
390
400
  return {
391
401
  type : 'pluralFormat',
392
402
  offset : offset,
393
- options: options
403
+ options: options,
404
+ location: location()
394
405
  };
395
406
  },
396
- peg$c38 = { type: "other", description: "whitespace" },
397
- peg$c39 = /^[ \t\n\r]/,
398
- peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
399
- peg$c41 = { type: "other", description: "optionalWhitespace" },
400
- peg$c42 = /^[0-9]/,
401
- peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
402
- peg$c44 = /^[0-9a-f]/i,
403
- peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
404
- peg$c46 = "0",
405
- peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
406
- peg$c48 = /^[1-9]/,
407
- peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
408
- 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) {
409
420
  return parseInt(digits, 10);
410
421
  },
411
- peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
412
- peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
413
- peg$c53 = "\\\\",
414
- peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
415
- peg$c55 = function() { return '\\'; },
416
- peg$c56 = "\\#",
417
- peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
418
- peg$c58 = function() { return '\\#'; },
419
- peg$c59 = "\\{",
420
- peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
421
- peg$c61 = function() { return '\u007B'; },
422
- peg$c62 = "\\}",
423
- peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
424
- peg$c64 = function() { return '\u007D'; },
425
- peg$c65 = "\\u",
426
- peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
427
- 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) {
428
439
  return String.fromCharCode(parseInt(digits, 16));
429
440
  },
430
- peg$c68 = function(chars) { return chars.join(''); },
441
+ peg$c65 = function(chars) { return chars.join(''); },
431
442
 
432
443
  peg$currPos = 0,
433
- peg$reportedPos = 0,
434
- peg$cachedPos = 0,
435
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
444
+ peg$savedPos = 0,
445
+ peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
436
446
  peg$maxFailPos = 0,
437
447
  peg$maxFailExpected = [],
438
448
  peg$silentFails = 0,
@@ -448,38 +458,51 @@
448
458
  }
449
459
 
450
460
  function text() {
451
- return input.substring(peg$reportedPos, peg$currPos);
452
- }
453
-
454
- function offset() {
455
- return peg$reportedPos;
461
+ return input.substring(peg$savedPos, peg$currPos);
456
462
  }
457
463
 
458
- function line() {
459
- return peg$computePosDetails(peg$reportedPos).line;
460
- }
461
-
462
- function column() {
463
- return peg$computePosDetails(peg$reportedPos).column;
464
+ function location() {
465
+ return peg$computeLocation(peg$savedPos, peg$currPos);
464
466
  }
465
467
 
466
468
  function expected(description) {
467
469
  throw peg$buildException(
468
470
  null,
469
471
  [{ type: "other", description: description }],
470
- peg$reportedPos
472
+ input.substring(peg$savedPos, peg$currPos),
473
+ peg$computeLocation(peg$savedPos, peg$currPos)
471
474
  );
472
475
  }
473
476
 
474
477
  function error(message) {
475
- 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
+ );
476
484
  }
477
485
 
478
486
  function peg$computePosDetails(pos) {
479
- function advance(details, startPos, endPos) {
480
- 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
+ };
481
504
 
482
- for (p = startPos; p < endPos; p++) {
505
+ while (p < pos) {
483
506
  ch = input.charAt(p);
484
507
  if (ch === "\n") {
485
508
  if (!details.seenCR) { details.line++; }
@@ -493,19 +516,31 @@
493
516
  details.column++;
494
517
  details.seenCR = false;
495
518
  }
496
- }
497
- }
498
519
 
499
- if (peg$cachedPos !== pos) {
500
- if (peg$cachedPos > pos) {
501
- peg$cachedPos = 0;
502
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
520
+ p++;
503
521
  }
504
- advance(peg$cachedPosDetails, peg$cachedPos, pos);
505
- peg$cachedPos = pos;
522
+
523
+ peg$posDetailsCache[pos] = details;
524
+ return details;
506
525
  }
526
+ }
527
+
528
+ function peg$computeLocation(startPos, endPos) {
529
+ var startPosDetails = peg$computePosDetails(startPos),
530
+ endPosDetails = peg$computePosDetails(endPos);
507
531
 
508
- return peg$cachedPosDetails;
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
+ };
509
544
  }
510
545
 
511
546
  function peg$fail(expected) {
@@ -519,7 +554,7 @@
519
554
  peg$maxFailExpected.push(expected);
520
555
  }
521
556
 
522
- function peg$buildException(message, expected, pos) {
557
+ function peg$buildException(message, expected, found, location) {
523
558
  function cleanupExpected(expected) {
524
559
  var i = 1;
525
560
 
@@ -556,8 +591,8 @@
556
591
  .replace(/\r/g, '\\r')
557
592
  .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
558
593
  .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
559
- .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
560
- .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); });
561
596
  }
562
597
 
563
598
  var expectedDescs = new Array(expected.length),
@@ -578,20 +613,15 @@
578
613
  return "Expected " + expectedDesc + " but " + foundDesc + " found.";
579
614
  }
580
615
 
581
- var posDetails = peg$computePosDetails(pos),
582
- found = pos < input.length ? input.charAt(pos) : null;
583
-
584
616
  if (expected !== null) {
585
617
  cleanupExpected(expected);
586
618
  }
587
619
 
588
- return new SyntaxError(
620
+ return new peg$SyntaxError(
589
621
  message !== null ? message : buildMessage(expected, found),
590
622
  expected,
591
623
  found,
592
- pos,
593
- posDetails.line,
594
- posDetails.column
624
+ location
595
625
  );
596
626
  }
597
627
 
@@ -614,8 +644,8 @@
614
644
  s2 = peg$parsemessageFormatElement();
615
645
  }
616
646
  if (s1 !== peg$FAILED) {
617
- peg$reportedPos = s0;
618
- s1 = peg$c1(s1);
647
+ peg$savedPos = s0;
648
+ s1 = peg$c0(s1);
619
649
  }
620
650
  s0 = s1;
621
651
 
@@ -649,15 +679,15 @@
649
679
  s2 = s3;
650
680
  } else {
651
681
  peg$currPos = s2;
652
- s2 = peg$c2;
682
+ s2 = peg$FAILED;
653
683
  }
654
684
  } else {
655
685
  peg$currPos = s2;
656
- s2 = peg$c2;
686
+ s2 = peg$FAILED;
657
687
  }
658
688
  } else {
659
689
  peg$currPos = s2;
660
- s2 = peg$c2;
690
+ s2 = peg$FAILED;
661
691
  }
662
692
  if (s2 !== peg$FAILED) {
663
693
  while (s2 !== peg$FAILED) {
@@ -673,32 +703,33 @@
673
703
  s2 = s3;
674
704
  } else {
675
705
  peg$currPos = s2;
676
- s2 = peg$c2;
706
+ s2 = peg$FAILED;
677
707
  }
678
708
  } else {
679
709
  peg$currPos = s2;
680
- s2 = peg$c2;
710
+ s2 = peg$FAILED;
681
711
  }
682
712
  } else {
683
713
  peg$currPos = s2;
684
- s2 = peg$c2;
714
+ s2 = peg$FAILED;
685
715
  }
686
716
  }
687
717
  } else {
688
- s1 = peg$c2;
718
+ s1 = peg$FAILED;
689
719
  }
690
720
  if (s1 !== peg$FAILED) {
691
- peg$reportedPos = s0;
692
- s1 = peg$c3(s1);
721
+ peg$savedPos = s0;
722
+ s1 = peg$c1(s1);
693
723
  }
694
724
  s0 = s1;
695
725
  if (s0 === peg$FAILED) {
696
726
  s0 = peg$currPos;
697
727
  s1 = peg$parsews();
698
728
  if (s1 !== peg$FAILED) {
699
- s1 = input.substring(s0, peg$currPos);
729
+ s0 = input.substring(s0, peg$currPos);
730
+ } else {
731
+ s0 = s1;
700
732
  }
701
- s0 = s1;
702
733
  }
703
734
 
704
735
  return s0;
@@ -710,8 +741,8 @@
710
741
  s0 = peg$currPos;
711
742
  s1 = peg$parsemessageText();
712
743
  if (s1 !== peg$FAILED) {
713
- peg$reportedPos = s0;
714
- s1 = peg$c4(s1);
744
+ peg$savedPos = s0;
745
+ s1 = peg$c2(s1);
715
746
  }
716
747
  s0 = s1;
717
748
 
@@ -725,31 +756,32 @@
725
756
  if (s0 === peg$FAILED) {
726
757
  s0 = peg$currPos;
727
758
  s1 = [];
728
- if (peg$c5.test(input.charAt(peg$currPos))) {
759
+ if (peg$c3.test(input.charAt(peg$currPos))) {
729
760
  s2 = input.charAt(peg$currPos);
730
761
  peg$currPos++;
731
762
  } else {
732
763
  s2 = peg$FAILED;
733
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
764
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
734
765
  }
735
766
  if (s2 !== peg$FAILED) {
736
767
  while (s2 !== peg$FAILED) {
737
768
  s1.push(s2);
738
- if (peg$c5.test(input.charAt(peg$currPos))) {
769
+ if (peg$c3.test(input.charAt(peg$currPos))) {
739
770
  s2 = input.charAt(peg$currPos);
740
771
  peg$currPos++;
741
772
  } else {
742
773
  s2 = peg$FAILED;
743
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
774
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
744
775
  }
745
776
  }
746
777
  } else {
747
- s1 = peg$c2;
778
+ s1 = peg$FAILED;
748
779
  }
749
780
  if (s1 !== peg$FAILED) {
750
- s1 = input.substring(s0, peg$currPos);
781
+ s0 = input.substring(s0, peg$currPos);
782
+ } else {
783
+ s0 = s1;
751
784
  }
752
- s0 = s1;
753
785
  }
754
786
 
755
787
  return s0;
@@ -760,11 +792,11 @@
760
792
 
761
793
  s0 = peg$currPos;
762
794
  if (input.charCodeAt(peg$currPos) === 123) {
763
- s1 = peg$c7;
795
+ s1 = peg$c5;
764
796
  peg$currPos++;
765
797
  } else {
766
798
  s1 = peg$FAILED;
767
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
799
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
768
800
  }
769
801
  if (s1 !== peg$FAILED) {
770
802
  s2 = peg$parse_();
@@ -775,11 +807,11 @@
775
807
  if (s4 !== peg$FAILED) {
776
808
  s5 = peg$currPos;
777
809
  if (input.charCodeAt(peg$currPos) === 44) {
778
- s6 = peg$c10;
810
+ s6 = peg$c7;
779
811
  peg$currPos++;
780
812
  } else {
781
813
  s6 = peg$FAILED;
782
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
814
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
783
815
  }
784
816
  if (s6 !== peg$FAILED) {
785
817
  s7 = peg$parse_();
@@ -790,60 +822,60 @@
790
822
  s5 = s6;
791
823
  } else {
792
824
  peg$currPos = s5;
793
- s5 = peg$c2;
825
+ s5 = peg$FAILED;
794
826
  }
795
827
  } else {
796
828
  peg$currPos = s5;
797
- s5 = peg$c2;
829
+ s5 = peg$FAILED;
798
830
  }
799
831
  } else {
800
832
  peg$currPos = s5;
801
- s5 = peg$c2;
833
+ s5 = peg$FAILED;
802
834
  }
803
835
  if (s5 === peg$FAILED) {
804
- s5 = peg$c9;
836
+ s5 = null;
805
837
  }
806
838
  if (s5 !== peg$FAILED) {
807
839
  s6 = peg$parse_();
808
840
  if (s6 !== peg$FAILED) {
809
841
  if (input.charCodeAt(peg$currPos) === 125) {
810
- s7 = peg$c12;
842
+ s7 = peg$c9;
811
843
  peg$currPos++;
812
844
  } else {
813
845
  s7 = peg$FAILED;
814
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
846
+ if (peg$silentFails === 0) { peg$fail(peg$c10); }
815
847
  }
816
848
  if (s7 !== peg$FAILED) {
817
- peg$reportedPos = s0;
818
- s1 = peg$c14(s3, s5);
849
+ peg$savedPos = s0;
850
+ s1 = peg$c11(s3, s5);
819
851
  s0 = s1;
820
852
  } else {
821
853
  peg$currPos = s0;
822
- s0 = peg$c2;
854
+ s0 = peg$FAILED;
823
855
  }
824
856
  } else {
825
857
  peg$currPos = s0;
826
- s0 = peg$c2;
858
+ s0 = peg$FAILED;
827
859
  }
828
860
  } else {
829
861
  peg$currPos = s0;
830
- s0 = peg$c2;
862
+ s0 = peg$FAILED;
831
863
  }
832
864
  } else {
833
865
  peg$currPos = s0;
834
- s0 = peg$c2;
866
+ s0 = peg$FAILED;
835
867
  }
836
868
  } else {
837
869
  peg$currPos = s0;
838
- s0 = peg$c2;
870
+ s0 = peg$FAILED;
839
871
  }
840
872
  } else {
841
873
  peg$currPos = s0;
842
- s0 = peg$c2;
874
+ s0 = peg$FAILED;
843
875
  }
844
876
  } else {
845
877
  peg$currPos = s0;
846
- s0 = peg$c2;
878
+ s0 = peg$FAILED;
847
879
  }
848
880
 
849
881
  return s0;
@@ -870,28 +902,28 @@
870
902
  var s0, s1, s2, s3, s4, s5, s6;
871
903
 
872
904
  s0 = peg$currPos;
873
- if (input.substr(peg$currPos, 6) === peg$c15) {
874
- s1 = peg$c15;
905
+ if (input.substr(peg$currPos, 6) === peg$c12) {
906
+ s1 = peg$c12;
875
907
  peg$currPos += 6;
876
908
  } else {
877
909
  s1 = peg$FAILED;
878
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
910
+ if (peg$silentFails === 0) { peg$fail(peg$c13); }
879
911
  }
880
912
  if (s1 === peg$FAILED) {
881
- if (input.substr(peg$currPos, 4) === peg$c17) {
882
- s1 = peg$c17;
913
+ if (input.substr(peg$currPos, 4) === peg$c14) {
914
+ s1 = peg$c14;
883
915
  peg$currPos += 4;
884
916
  } else {
885
917
  s1 = peg$FAILED;
886
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
918
+ if (peg$silentFails === 0) { peg$fail(peg$c15); }
887
919
  }
888
920
  if (s1 === peg$FAILED) {
889
- if (input.substr(peg$currPos, 4) === peg$c19) {
890
- s1 = peg$c19;
921
+ if (input.substr(peg$currPos, 4) === peg$c16) {
922
+ s1 = peg$c16;
891
923
  peg$currPos += 4;
892
924
  } else {
893
925
  s1 = peg$FAILED;
894
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
926
+ if (peg$silentFails === 0) { peg$fail(peg$c17); }
895
927
  }
896
928
  }
897
929
  }
@@ -900,11 +932,11 @@
900
932
  if (s2 !== peg$FAILED) {
901
933
  s3 = peg$currPos;
902
934
  if (input.charCodeAt(peg$currPos) === 44) {
903
- s4 = peg$c10;
935
+ s4 = peg$c7;
904
936
  peg$currPos++;
905
937
  } else {
906
938
  s4 = peg$FAILED;
907
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
939
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
908
940
  }
909
941
  if (s4 !== peg$FAILED) {
910
942
  s5 = peg$parse_();
@@ -915,34 +947,34 @@
915
947
  s3 = s4;
916
948
  } else {
917
949
  peg$currPos = s3;
918
- s3 = peg$c2;
950
+ s3 = peg$FAILED;
919
951
  }
920
952
  } else {
921
953
  peg$currPos = s3;
922
- s3 = peg$c2;
954
+ s3 = peg$FAILED;
923
955
  }
924
956
  } else {
925
957
  peg$currPos = s3;
926
- s3 = peg$c2;
958
+ s3 = peg$FAILED;
927
959
  }
928
960
  if (s3 === peg$FAILED) {
929
- s3 = peg$c9;
961
+ s3 = null;
930
962
  }
931
963
  if (s3 !== peg$FAILED) {
932
- peg$reportedPos = s0;
933
- s1 = peg$c21(s1, s3);
964
+ peg$savedPos = s0;
965
+ s1 = peg$c18(s1, s3);
934
966
  s0 = s1;
935
967
  } else {
936
968
  peg$currPos = s0;
937
- s0 = peg$c2;
969
+ s0 = peg$FAILED;
938
970
  }
939
971
  } else {
940
972
  peg$currPos = s0;
941
- s0 = peg$c2;
973
+ s0 = peg$FAILED;
942
974
  }
943
975
  } else {
944
976
  peg$currPos = s0;
945
- s0 = peg$c2;
977
+ s0 = peg$FAILED;
946
978
  }
947
979
 
948
980
  return s0;
@@ -952,50 +984,50 @@
952
984
  var s0, s1, s2, s3, s4, s5;
953
985
 
954
986
  s0 = peg$currPos;
955
- if (input.substr(peg$currPos, 6) === peg$c22) {
956
- s1 = peg$c22;
987
+ if (input.substr(peg$currPos, 6) === peg$c19) {
988
+ s1 = peg$c19;
957
989
  peg$currPos += 6;
958
990
  } else {
959
991
  s1 = peg$FAILED;
960
- if (peg$silentFails === 0) { peg$fail(peg$c23); }
992
+ if (peg$silentFails === 0) { peg$fail(peg$c20); }
961
993
  }
962
994
  if (s1 !== peg$FAILED) {
963
995
  s2 = peg$parse_();
964
996
  if (s2 !== peg$FAILED) {
965
997
  if (input.charCodeAt(peg$currPos) === 44) {
966
- s3 = peg$c10;
998
+ s3 = peg$c7;
967
999
  peg$currPos++;
968
1000
  } else {
969
1001
  s3 = peg$FAILED;
970
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1002
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
971
1003
  }
972
1004
  if (s3 !== peg$FAILED) {
973
1005
  s4 = peg$parse_();
974
1006
  if (s4 !== peg$FAILED) {
975
1007
  s5 = peg$parsepluralStyle();
976
1008
  if (s5 !== peg$FAILED) {
977
- peg$reportedPos = s0;
978
- s1 = peg$c24(s5);
1009
+ peg$savedPos = s0;
1010
+ s1 = peg$c21(s5);
979
1011
  s0 = s1;
980
1012
  } else {
981
1013
  peg$currPos = s0;
982
- s0 = peg$c2;
1014
+ s0 = peg$FAILED;
983
1015
  }
984
1016
  } else {
985
1017
  peg$currPos = s0;
986
- s0 = peg$c2;
1018
+ s0 = peg$FAILED;
987
1019
  }
988
1020
  } else {
989
1021
  peg$currPos = s0;
990
- s0 = peg$c2;
1022
+ s0 = peg$FAILED;
991
1023
  }
992
1024
  } else {
993
1025
  peg$currPos = s0;
994
- s0 = peg$c2;
1026
+ s0 = peg$FAILED;
995
1027
  }
996
1028
  } else {
997
1029
  peg$currPos = s0;
998
- s0 = peg$c2;
1030
+ s0 = peg$FAILED;
999
1031
  }
1000
1032
 
1001
1033
  return s0;
@@ -1005,50 +1037,50 @@
1005
1037
  var s0, s1, s2, s3, s4, s5;
1006
1038
 
1007
1039
  s0 = peg$currPos;
1008
- if (input.substr(peg$currPos, 13) === peg$c25) {
1009
- s1 = peg$c25;
1040
+ if (input.substr(peg$currPos, 13) === peg$c22) {
1041
+ s1 = peg$c22;
1010
1042
  peg$currPos += 13;
1011
1043
  } else {
1012
1044
  s1 = peg$FAILED;
1013
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
1045
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
1014
1046
  }
1015
1047
  if (s1 !== peg$FAILED) {
1016
1048
  s2 = peg$parse_();
1017
1049
  if (s2 !== peg$FAILED) {
1018
1050
  if (input.charCodeAt(peg$currPos) === 44) {
1019
- s3 = peg$c10;
1051
+ s3 = peg$c7;
1020
1052
  peg$currPos++;
1021
1053
  } else {
1022
1054
  s3 = peg$FAILED;
1023
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1055
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
1024
1056
  }
1025
1057
  if (s3 !== peg$FAILED) {
1026
1058
  s4 = peg$parse_();
1027
1059
  if (s4 !== peg$FAILED) {
1028
1060
  s5 = peg$parsepluralStyle();
1029
1061
  if (s5 !== peg$FAILED) {
1030
- peg$reportedPos = s0;
1031
- s1 = peg$c27(s5);
1062
+ peg$savedPos = s0;
1063
+ s1 = peg$c24(s5);
1032
1064
  s0 = s1;
1033
1065
  } else {
1034
1066
  peg$currPos = s0;
1035
- s0 = peg$c2;
1067
+ s0 = peg$FAILED;
1036
1068
  }
1037
1069
  } else {
1038
1070
  peg$currPos = s0;
1039
- s0 = peg$c2;
1071
+ s0 = peg$FAILED;
1040
1072
  }
1041
1073
  } else {
1042
1074
  peg$currPos = s0;
1043
- s0 = peg$c2;
1075
+ s0 = peg$FAILED;
1044
1076
  }
1045
1077
  } else {
1046
1078
  peg$currPos = s0;
1047
- s0 = peg$c2;
1079
+ s0 = peg$FAILED;
1048
1080
  }
1049
1081
  } else {
1050
1082
  peg$currPos = s0;
1051
- s0 = peg$c2;
1083
+ s0 = peg$FAILED;
1052
1084
  }
1053
1085
 
1054
1086
  return s0;
@@ -1058,22 +1090,22 @@
1058
1090
  var s0, s1, s2, s3, s4, s5, s6;
1059
1091
 
1060
1092
  s0 = peg$currPos;
1061
- if (input.substr(peg$currPos, 6) === peg$c28) {
1062
- s1 = peg$c28;
1093
+ if (input.substr(peg$currPos, 6) === peg$c25) {
1094
+ s1 = peg$c25;
1063
1095
  peg$currPos += 6;
1064
1096
  } else {
1065
1097
  s1 = peg$FAILED;
1066
- if (peg$silentFails === 0) { peg$fail(peg$c29); }
1098
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
1067
1099
  }
1068
1100
  if (s1 !== peg$FAILED) {
1069
1101
  s2 = peg$parse_();
1070
1102
  if (s2 !== peg$FAILED) {
1071
1103
  if (input.charCodeAt(peg$currPos) === 44) {
1072
- s3 = peg$c10;
1104
+ s3 = peg$c7;
1073
1105
  peg$currPos++;
1074
1106
  } else {
1075
1107
  s3 = peg$FAILED;
1076
- if (peg$silentFails === 0) { peg$fail(peg$c11); }
1108
+ if (peg$silentFails === 0) { peg$fail(peg$c8); }
1077
1109
  }
1078
1110
  if (s3 !== peg$FAILED) {
1079
1111
  s4 = peg$parse_();
@@ -1086,31 +1118,31 @@
1086
1118
  s6 = peg$parseoptionalFormatPattern();
1087
1119
  }
1088
1120
  } else {
1089
- s5 = peg$c2;
1121
+ s5 = peg$FAILED;
1090
1122
  }
1091
1123
  if (s5 !== peg$FAILED) {
1092
- peg$reportedPos = s0;
1093
- s1 = peg$c30(s5);
1124
+ peg$savedPos = s0;
1125
+ s1 = peg$c27(s5);
1094
1126
  s0 = s1;
1095
1127
  } else {
1096
1128
  peg$currPos = s0;
1097
- s0 = peg$c2;
1129
+ s0 = peg$FAILED;
1098
1130
  }
1099
1131
  } else {
1100
1132
  peg$currPos = s0;
1101
- s0 = peg$c2;
1133
+ s0 = peg$FAILED;
1102
1134
  }
1103
1135
  } else {
1104
1136
  peg$currPos = s0;
1105
- s0 = peg$c2;
1137
+ s0 = peg$FAILED;
1106
1138
  }
1107
1139
  } else {
1108
1140
  peg$currPos = s0;
1109
- s0 = peg$c2;
1141
+ s0 = peg$FAILED;
1110
1142
  }
1111
1143
  } else {
1112
1144
  peg$currPos = s0;
1113
- s0 = peg$c2;
1145
+ s0 = peg$FAILED;
1114
1146
  }
1115
1147
 
1116
1148
  return s0;
@@ -1122,11 +1154,11 @@
1122
1154
  s0 = peg$currPos;
1123
1155
  s1 = peg$currPos;
1124
1156
  if (input.charCodeAt(peg$currPos) === 61) {
1125
- s2 = peg$c31;
1157
+ s2 = peg$c28;
1126
1158
  peg$currPos++;
1127
1159
  } else {
1128
1160
  s2 = peg$FAILED;
1129
- if (peg$silentFails === 0) { peg$fail(peg$c32); }
1161
+ if (peg$silentFails === 0) { peg$fail(peg$c29); }
1130
1162
  }
1131
1163
  if (s2 !== peg$FAILED) {
1132
1164
  s3 = peg$parsenumber();
@@ -1135,16 +1167,17 @@
1135
1167
  s1 = s2;
1136
1168
  } else {
1137
1169
  peg$currPos = s1;
1138
- s1 = peg$c2;
1170
+ s1 = peg$FAILED;
1139
1171
  }
1140
1172
  } else {
1141
1173
  peg$currPos = s1;
1142
- s1 = peg$c2;
1174
+ s1 = peg$FAILED;
1143
1175
  }
1144
1176
  if (s1 !== peg$FAILED) {
1145
- s1 = input.substring(s0, peg$currPos);
1177
+ s0 = input.substring(s0, peg$currPos);
1178
+ } else {
1179
+ s0 = s1;
1146
1180
  }
1147
- s0 = s1;
1148
1181
  if (s0 === peg$FAILED) {
1149
1182
  s0 = peg$parsechars();
1150
1183
  }
@@ -1163,11 +1196,11 @@
1163
1196
  s3 = peg$parse_();
1164
1197
  if (s3 !== peg$FAILED) {
1165
1198
  if (input.charCodeAt(peg$currPos) === 123) {
1166
- s4 = peg$c7;
1199
+ s4 = peg$c5;
1167
1200
  peg$currPos++;
1168
1201
  } else {
1169
1202
  s4 = peg$FAILED;
1170
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
1203
+ if (peg$silentFails === 0) { peg$fail(peg$c6); }
1171
1204
  }
1172
1205
  if (s4 !== peg$FAILED) {
1173
1206
  s5 = peg$parse_();
@@ -1177,47 +1210,47 @@
1177
1210
  s7 = peg$parse_();
1178
1211
  if (s7 !== peg$FAILED) {
1179
1212
  if (input.charCodeAt(peg$currPos) === 125) {
1180
- s8 = peg$c12;
1213
+ s8 = peg$c9;
1181
1214
  peg$currPos++;
1182
1215
  } else {
1183
1216
  s8 = peg$FAILED;
1184
- if (peg$silentFails === 0) { peg$fail(peg$c13); }
1217
+ if (peg$silentFails === 0) { peg$fail(peg$c10); }
1185
1218
  }
1186
1219
  if (s8 !== peg$FAILED) {
1187
- peg$reportedPos = s0;
1188
- s1 = peg$c33(s2, s6);
1220
+ peg$savedPos = s0;
1221
+ s1 = peg$c30(s2, s6);
1189
1222
  s0 = s1;
1190
1223
  } else {
1191
1224
  peg$currPos = s0;
1192
- s0 = peg$c2;
1225
+ s0 = peg$FAILED;
1193
1226
  }
1194
1227
  } else {
1195
1228
  peg$currPos = s0;
1196
- s0 = peg$c2;
1229
+ s0 = peg$FAILED;
1197
1230
  }
1198
1231
  } else {
1199
1232
  peg$currPos = s0;
1200
- s0 = peg$c2;
1233
+ s0 = peg$FAILED;
1201
1234
  }
1202
1235
  } else {
1203
1236
  peg$currPos = s0;
1204
- s0 = peg$c2;
1237
+ s0 = peg$FAILED;
1205
1238
  }
1206
1239
  } else {
1207
1240
  peg$currPos = s0;
1208
- s0 = peg$c2;
1241
+ s0 = peg$FAILED;
1209
1242
  }
1210
1243
  } else {
1211
1244
  peg$currPos = s0;
1212
- s0 = peg$c2;
1245
+ s0 = peg$FAILED;
1213
1246
  }
1214
1247
  } else {
1215
1248
  peg$currPos = s0;
1216
- s0 = peg$c2;
1249
+ s0 = peg$FAILED;
1217
1250
  }
1218
1251
  } else {
1219
1252
  peg$currPos = s0;
1220
- s0 = peg$c2;
1253
+ s0 = peg$FAILED;
1221
1254
  }
1222
1255
 
1223
1256
  return s0;
@@ -1227,32 +1260,32 @@
1227
1260
  var s0, s1, s2, s3;
1228
1261
 
1229
1262
  s0 = peg$currPos;
1230
- if (input.substr(peg$currPos, 7) === peg$c34) {
1231
- s1 = peg$c34;
1263
+ if (input.substr(peg$currPos, 7) === peg$c31) {
1264
+ s1 = peg$c31;
1232
1265
  peg$currPos += 7;
1233
1266
  } else {
1234
1267
  s1 = peg$FAILED;
1235
- if (peg$silentFails === 0) { peg$fail(peg$c35); }
1268
+ if (peg$silentFails === 0) { peg$fail(peg$c32); }
1236
1269
  }
1237
1270
  if (s1 !== peg$FAILED) {
1238
1271
  s2 = peg$parse_();
1239
1272
  if (s2 !== peg$FAILED) {
1240
1273
  s3 = peg$parsenumber();
1241
1274
  if (s3 !== peg$FAILED) {
1242
- peg$reportedPos = s0;
1243
- s1 = peg$c36(s3);
1275
+ peg$savedPos = s0;
1276
+ s1 = peg$c33(s3);
1244
1277
  s0 = s1;
1245
1278
  } else {
1246
1279
  peg$currPos = s0;
1247
- s0 = peg$c2;
1280
+ s0 = peg$FAILED;
1248
1281
  }
1249
1282
  } else {
1250
1283
  peg$currPos = s0;
1251
- s0 = peg$c2;
1284
+ s0 = peg$FAILED;
1252
1285
  }
1253
1286
  } else {
1254
1287
  peg$currPos = s0;
1255
- s0 = peg$c2;
1288
+ s0 = peg$FAILED;
1256
1289
  }
1257
1290
 
1258
1291
  return s0;
@@ -1264,7 +1297,7 @@
1264
1297
  s0 = peg$currPos;
1265
1298
  s1 = peg$parseoffset();
1266
1299
  if (s1 === peg$FAILED) {
1267
- s1 = peg$c9;
1300
+ s1 = null;
1268
1301
  }
1269
1302
  if (s1 !== peg$FAILED) {
1270
1303
  s2 = peg$parse_();
@@ -1277,23 +1310,23 @@
1277
1310
  s4 = peg$parseoptionalFormatPattern();
1278
1311
  }
1279
1312
  } else {
1280
- s3 = peg$c2;
1313
+ s3 = peg$FAILED;
1281
1314
  }
1282
1315
  if (s3 !== peg$FAILED) {
1283
- peg$reportedPos = s0;
1284
- s1 = peg$c37(s1, s3);
1316
+ peg$savedPos = s0;
1317
+ s1 = peg$c34(s1, s3);
1285
1318
  s0 = s1;
1286
1319
  } else {
1287
1320
  peg$currPos = s0;
1288
- s0 = peg$c2;
1321
+ s0 = peg$FAILED;
1289
1322
  }
1290
1323
  } else {
1291
1324
  peg$currPos = s0;
1292
- s0 = peg$c2;
1325
+ s0 = peg$FAILED;
1293
1326
  }
1294
1327
  } else {
1295
1328
  peg$currPos = s0;
1296
- s0 = peg$c2;
1329
+ s0 = peg$FAILED;
1297
1330
  }
1298
1331
 
1299
1332
  return s0;
@@ -1304,31 +1337,31 @@
1304
1337
 
1305
1338
  peg$silentFails++;
1306
1339
  s0 = [];
1307
- if (peg$c39.test(input.charAt(peg$currPos))) {
1340
+ if (peg$c36.test(input.charAt(peg$currPos))) {
1308
1341
  s1 = input.charAt(peg$currPos);
1309
1342
  peg$currPos++;
1310
1343
  } else {
1311
1344
  s1 = peg$FAILED;
1312
- if (peg$silentFails === 0) { peg$fail(peg$c40); }
1345
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
1313
1346
  }
1314
1347
  if (s1 !== peg$FAILED) {
1315
1348
  while (s1 !== peg$FAILED) {
1316
1349
  s0.push(s1);
1317
- if (peg$c39.test(input.charAt(peg$currPos))) {
1350
+ if (peg$c36.test(input.charAt(peg$currPos))) {
1318
1351
  s1 = input.charAt(peg$currPos);
1319
1352
  peg$currPos++;
1320
1353
  } else {
1321
1354
  s1 = peg$FAILED;
1322
- if (peg$silentFails === 0) { peg$fail(peg$c40); }
1355
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
1323
1356
  }
1324
1357
  }
1325
1358
  } else {
1326
- s0 = peg$c2;
1359
+ s0 = peg$FAILED;
1327
1360
  }
1328
1361
  peg$silentFails--;
1329
1362
  if (s0 === peg$FAILED) {
1330
1363
  s1 = peg$FAILED;
1331
- if (peg$silentFails === 0) { peg$fail(peg$c38); }
1364
+ if (peg$silentFails === 0) { peg$fail(peg$c35); }
1332
1365
  }
1333
1366
 
1334
1367
  return s0;
@@ -1346,13 +1379,14 @@
1346
1379
  s2 = peg$parsews();
1347
1380
  }
1348
1381
  if (s1 !== peg$FAILED) {
1349
- s1 = input.substring(s0, peg$currPos);
1382
+ s0 = input.substring(s0, peg$currPos);
1383
+ } else {
1384
+ s0 = s1;
1350
1385
  }
1351
- s0 = s1;
1352
1386
  peg$silentFails--;
1353
1387
  if (s0 === peg$FAILED) {
1354
1388
  s1 = peg$FAILED;
1355
- if (peg$silentFails === 0) { peg$fail(peg$c41); }
1389
+ if (peg$silentFails === 0) { peg$fail(peg$c38); }
1356
1390
  }
1357
1391
 
1358
1392
  return s0;
@@ -1361,12 +1395,12 @@
1361
1395
  function peg$parsedigit() {
1362
1396
  var s0;
1363
1397
 
1364
- if (peg$c42.test(input.charAt(peg$currPos))) {
1398
+ if (peg$c39.test(input.charAt(peg$currPos))) {
1365
1399
  s0 = input.charAt(peg$currPos);
1366
1400
  peg$currPos++;
1367
1401
  } else {
1368
1402
  s0 = peg$FAILED;
1369
- if (peg$silentFails === 0) { peg$fail(peg$c43); }
1403
+ if (peg$silentFails === 0) { peg$fail(peg$c40); }
1370
1404
  }
1371
1405
 
1372
1406
  return s0;
@@ -1375,12 +1409,12 @@
1375
1409
  function peg$parsehexDigit() {
1376
1410
  var s0;
1377
1411
 
1378
- if (peg$c44.test(input.charAt(peg$currPos))) {
1412
+ if (peg$c41.test(input.charAt(peg$currPos))) {
1379
1413
  s0 = input.charAt(peg$currPos);
1380
1414
  peg$currPos++;
1381
1415
  } else {
1382
1416
  s0 = peg$FAILED;
1383
- if (peg$silentFails === 0) { peg$fail(peg$c45); }
1417
+ if (peg$silentFails === 0) { peg$fail(peg$c42); }
1384
1418
  }
1385
1419
 
1386
1420
  return s0;
@@ -1391,21 +1425,21 @@
1391
1425
 
1392
1426
  s0 = peg$currPos;
1393
1427
  if (input.charCodeAt(peg$currPos) === 48) {
1394
- s1 = peg$c46;
1428
+ s1 = peg$c43;
1395
1429
  peg$currPos++;
1396
1430
  } else {
1397
1431
  s1 = peg$FAILED;
1398
- if (peg$silentFails === 0) { peg$fail(peg$c47); }
1432
+ if (peg$silentFails === 0) { peg$fail(peg$c44); }
1399
1433
  }
1400
1434
  if (s1 === peg$FAILED) {
1401
1435
  s1 = peg$currPos;
1402
1436
  s2 = peg$currPos;
1403
- if (peg$c48.test(input.charAt(peg$currPos))) {
1437
+ if (peg$c45.test(input.charAt(peg$currPos))) {
1404
1438
  s3 = input.charAt(peg$currPos);
1405
1439
  peg$currPos++;
1406
1440
  } else {
1407
1441
  s3 = peg$FAILED;
1408
- if (peg$silentFails === 0) { peg$fail(peg$c49); }
1442
+ if (peg$silentFails === 0) { peg$fail(peg$c46); }
1409
1443
  }
1410
1444
  if (s3 !== peg$FAILED) {
1411
1445
  s4 = [];
@@ -1419,20 +1453,21 @@
1419
1453
  s2 = s3;
1420
1454
  } else {
1421
1455
  peg$currPos = s2;
1422
- s2 = peg$c2;
1456
+ s2 = peg$FAILED;
1423
1457
  }
1424
1458
  } else {
1425
1459
  peg$currPos = s2;
1426
- s2 = peg$c2;
1460
+ s2 = peg$FAILED;
1427
1461
  }
1428
1462
  if (s2 !== peg$FAILED) {
1429
- s2 = input.substring(s1, peg$currPos);
1463
+ s1 = input.substring(s1, peg$currPos);
1464
+ } else {
1465
+ s1 = s2;
1430
1466
  }
1431
- s1 = s2;
1432
1467
  }
1433
1468
  if (s1 !== peg$FAILED) {
1434
- peg$reportedPos = s0;
1435
- s1 = peg$c50(s1);
1469
+ peg$savedPos = s0;
1470
+ s1 = peg$c47(s1);
1436
1471
  }
1437
1472
  s0 = s1;
1438
1473
 
@@ -1442,77 +1477,77 @@
1442
1477
  function peg$parsechar() {
1443
1478
  var s0, s1, s2, s3, s4, s5, s6, s7;
1444
1479
 
1445
- if (peg$c51.test(input.charAt(peg$currPos))) {
1480
+ if (peg$c48.test(input.charAt(peg$currPos))) {
1446
1481
  s0 = input.charAt(peg$currPos);
1447
1482
  peg$currPos++;
1448
1483
  } else {
1449
1484
  s0 = peg$FAILED;
1450
- if (peg$silentFails === 0) { peg$fail(peg$c52); }
1485
+ if (peg$silentFails === 0) { peg$fail(peg$c49); }
1451
1486
  }
1452
1487
  if (s0 === peg$FAILED) {
1453
1488
  s0 = peg$currPos;
1454
- if (input.substr(peg$currPos, 2) === peg$c53) {
1455
- s1 = peg$c53;
1489
+ if (input.substr(peg$currPos, 2) === peg$c50) {
1490
+ s1 = peg$c50;
1456
1491
  peg$currPos += 2;
1457
1492
  } else {
1458
1493
  s1 = peg$FAILED;
1459
- if (peg$silentFails === 0) { peg$fail(peg$c54); }
1494
+ if (peg$silentFails === 0) { peg$fail(peg$c51); }
1460
1495
  }
1461
1496
  if (s1 !== peg$FAILED) {
1462
- peg$reportedPos = s0;
1463
- s1 = peg$c55();
1497
+ peg$savedPos = s0;
1498
+ s1 = peg$c52();
1464
1499
  }
1465
1500
  s0 = s1;
1466
1501
  if (s0 === peg$FAILED) {
1467
1502
  s0 = peg$currPos;
1468
- if (input.substr(peg$currPos, 2) === peg$c56) {
1469
- s1 = peg$c56;
1503
+ if (input.substr(peg$currPos, 2) === peg$c53) {
1504
+ s1 = peg$c53;
1470
1505
  peg$currPos += 2;
1471
1506
  } else {
1472
1507
  s1 = peg$FAILED;
1473
- if (peg$silentFails === 0) { peg$fail(peg$c57); }
1508
+ if (peg$silentFails === 0) { peg$fail(peg$c54); }
1474
1509
  }
1475
1510
  if (s1 !== peg$FAILED) {
1476
- peg$reportedPos = s0;
1477
- s1 = peg$c58();
1511
+ peg$savedPos = s0;
1512
+ s1 = peg$c55();
1478
1513
  }
1479
1514
  s0 = s1;
1480
1515
  if (s0 === peg$FAILED) {
1481
1516
  s0 = peg$currPos;
1482
- if (input.substr(peg$currPos, 2) === peg$c59) {
1483
- s1 = peg$c59;
1517
+ if (input.substr(peg$currPos, 2) === peg$c56) {
1518
+ s1 = peg$c56;
1484
1519
  peg$currPos += 2;
1485
1520
  } else {
1486
1521
  s1 = peg$FAILED;
1487
- if (peg$silentFails === 0) { peg$fail(peg$c60); }
1522
+ if (peg$silentFails === 0) { peg$fail(peg$c57); }
1488
1523
  }
1489
1524
  if (s1 !== peg$FAILED) {
1490
- peg$reportedPos = s0;
1491
- s1 = peg$c61();
1525
+ peg$savedPos = s0;
1526
+ s1 = peg$c58();
1492
1527
  }
1493
1528
  s0 = s1;
1494
1529
  if (s0 === peg$FAILED) {
1495
1530
  s0 = peg$currPos;
1496
- if (input.substr(peg$currPos, 2) === peg$c62) {
1497
- s1 = peg$c62;
1531
+ if (input.substr(peg$currPos, 2) === peg$c59) {
1532
+ s1 = peg$c59;
1498
1533
  peg$currPos += 2;
1499
1534
  } else {
1500
1535
  s1 = peg$FAILED;
1501
- if (peg$silentFails === 0) { peg$fail(peg$c63); }
1536
+ if (peg$silentFails === 0) { peg$fail(peg$c60); }
1502
1537
  }
1503
1538
  if (s1 !== peg$FAILED) {
1504
- peg$reportedPos = s0;
1505
- s1 = peg$c64();
1539
+ peg$savedPos = s0;
1540
+ s1 = peg$c61();
1506
1541
  }
1507
1542
  s0 = s1;
1508
1543
  if (s0 === peg$FAILED) {
1509
1544
  s0 = peg$currPos;
1510
- if (input.substr(peg$currPos, 2) === peg$c65) {
1511
- s1 = peg$c65;
1545
+ if (input.substr(peg$currPos, 2) === peg$c62) {
1546
+ s1 = peg$c62;
1512
1547
  peg$currPos += 2;
1513
1548
  } else {
1514
1549
  s1 = peg$FAILED;
1515
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
1550
+ if (peg$silentFails === 0) { peg$fail(peg$c63); }
1516
1551
  }
1517
1552
  if (s1 !== peg$FAILED) {
1518
1553
  s2 = peg$currPos;
@@ -1529,35 +1564,36 @@
1529
1564
  s3 = s4;
1530
1565
  } else {
1531
1566
  peg$currPos = s3;
1532
- s3 = peg$c2;
1567
+ s3 = peg$FAILED;
1533
1568
  }
1534
1569
  } else {
1535
1570
  peg$currPos = s3;
1536
- s3 = peg$c2;
1571
+ s3 = peg$FAILED;
1537
1572
  }
1538
1573
  } else {
1539
1574
  peg$currPos = s3;
1540
- s3 = peg$c2;
1575
+ s3 = peg$FAILED;
1541
1576
  }
1542
1577
  } else {
1543
1578
  peg$currPos = s3;
1544
- s3 = peg$c2;
1579
+ s3 = peg$FAILED;
1545
1580
  }
1546
1581
  if (s3 !== peg$FAILED) {
1547
- s3 = input.substring(s2, peg$currPos);
1582
+ s2 = input.substring(s2, peg$currPos);
1583
+ } else {
1584
+ s2 = s3;
1548
1585
  }
1549
- s2 = s3;
1550
1586
  if (s2 !== peg$FAILED) {
1551
- peg$reportedPos = s0;
1552
- s1 = peg$c67(s2);
1587
+ peg$savedPos = s0;
1588
+ s1 = peg$c64(s2);
1553
1589
  s0 = s1;
1554
1590
  } else {
1555
1591
  peg$currPos = s0;
1556
- s0 = peg$c2;
1592
+ s0 = peg$FAILED;
1557
1593
  }
1558
1594
  } else {
1559
1595
  peg$currPos = s0;
1560
- s0 = peg$c2;
1596
+ s0 = peg$FAILED;
1561
1597
  }
1562
1598
  }
1563
1599
  }
@@ -1580,11 +1616,11 @@
1580
1616
  s2 = peg$parsechar();
1581
1617
  }
1582
1618
  } else {
1583
- s1 = peg$c2;
1619
+ s1 = peg$FAILED;
1584
1620
  }
1585
1621
  if (s1 !== peg$FAILED) {
1586
- peg$reportedPos = s0;
1587
- s1 = peg$c68(s1);
1622
+ peg$savedPos = s0;
1623
+ s1 = peg$c65(s1);
1588
1624
  }
1589
1625
  s0 = s1;
1590
1626
 
@@ -1600,13 +1636,20 @@
1600
1636
  peg$fail({ type: "end", description: "end of input" });
1601
1637
  }
1602
1638
 
1603
- 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
+ );
1604
1647
  }
1605
1648
  }
1606
1649
 
1607
1650
  return {
1608
- SyntaxError: SyntaxError,
1609
- parse: parse
1651
+ SyntaxError: peg$SyntaxError,
1652
+ parse: peg$parse
1610
1653
  };
1611
1654
  })();
1612
1655
 
@@ -1640,7 +1683,18 @@
1640
1683
  // the other `Intl` APIs.
1641
1684
  var messageFormat = this;
1642
1685
  this.format = function (values) {
1686
+ try {
1643
1687
  return messageFormat._format(pattern, values);
1688
+ } catch (e) {
1689
+ if (e.variableId) {
1690
+ throw new Error(
1691
+ 'The intl string context variable \'' + e.variableId + '\'' +
1692
+ ' was not provided to the string \'' + message + '\''
1693
+ );
1694
+ } else {
1695
+ throw e;
1696
+ }
1697
+ }
1644
1698
  };
1645
1699
  }
1646
1700
 
@@ -1775,7 +1829,7 @@
1775
1829
 
1776
1830
  $$core$$MessageFormat.prototype._format = function (pattern, values) {
1777
1831
  var result = '',
1778
- i, len, part, id, value;
1832
+ i, len, part, id, value, err;
1779
1833
 
1780
1834
  for (i = 0, len = pattern.length; i < len; i += 1) {
1781
1835
  part = pattern[i];
@@ -1790,7 +1844,9 @@
1790
1844
 
1791
1845
  // Enforce that all required values are provided by the caller.
1792
1846
  if (!(values && $$utils$$hop.call(values, id))) {
1793
- throw new Error('A value must be provided for: ' + id);
1847
+ err = new Error('A value must be provided for: ' + id);
1848
+ err.variableId = id;
1849
+ throw err;
1794
1850
  }
1795
1851
 
1796
1852
  value = values[id];