Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

intl-messageformat-parser

Package Overview
Dependencies
Maintainers
2
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intl-messageformat-parser - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

686

dist/parser.js

@@ -5,6 +5,8 @@ (function() {

var src$parser$$default = (function() {
"use strict";
/*
* Generated by PEG.js 0.8.0.
* Generated by PEG.js 0.9.0.
*
* http://pegjs.majda.cz/
* http://pegjs.org/
*/

@@ -18,17 +20,19 @@

function SyntaxError(message, expected, found, offset, line, column) {
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.location = location;
this.name = "SyntaxError";
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(SyntaxError, Error);
peg$subclass(peg$SyntaxError, Error);
function parse(input) {
function peg$parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
parser = this,

@@ -40,11 +44,10 @@ peg$FAILED = {},

peg$c0 = [],
peg$c1 = function(elements) {
peg$c0 = function(elements) {
return {
type : 'messageFormatPattern',
elements: elements
elements: elements,
location: location()
};
},
peg$c2 = peg$FAILED,
peg$c3 = function(text) {
peg$c1 = function(text) {
var string = '',

@@ -63,39 +66,41 @@ i, j, outerLen, inner, innerLen;

},
peg$c4 = function(messageText) {
peg$c2 = function(messageText) {
return {
type : 'messageTextElement',
value: messageText
value: messageText,
location: location()
};
},
peg$c5 = /^[^ \t\n\r,.+={}#]/,
peg$c6 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c7 = "{",
peg$c8 = { type: "literal", value: "{", description: "\"{\"" },
peg$c9 = null,
peg$c10 = ",",
peg$c11 = { type: "literal", value: ",", description: "\",\"" },
peg$c12 = "}",
peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
peg$c14 = function(id, format) {
peg$c3 = /^[^ \t\n\r,.+={}#]/,
peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c5 = "{",
peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
peg$c7 = ",",
peg$c8 = { type: "literal", value: ",", description: "\",\"" },
peg$c9 = "}",
peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
peg$c11 = function(id, format) {
return {
type : 'argumentElement',
id : id,
format: format && format[2]
format: format && format[2],
location: location()
};
},
peg$c15 = "number",
peg$c16 = { type: "literal", value: "number", description: "\"number\"" },
peg$c17 = "date",
peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
peg$c19 = "time",
peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
peg$c21 = function(type, style) {
peg$c12 = "number",
peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
peg$c14 = "date",
peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
peg$c16 = "time",
peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
peg$c18 = function(type, style) {
return {
type : type + 'Format',
style: style && style[2]
style: style && style[2],
location: location()
};
},
peg$c22 = "plural",
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c24 = function(pluralStyle) {
peg$c19 = "plural",
peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c21 = function(pluralStyle) {
return {

@@ -105,8 +110,9 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
};
},
peg$c25 = "selectordinal",
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c27 = function(pluralStyle) {
peg$c22 = "selectordinal",
peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c24 = function(pluralStyle) {
return {

@@ -116,74 +122,77 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
}
},
peg$c28 = "select",
peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
peg$c30 = function(options) {
peg$c25 = "select",
peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
peg$c27 = function(options) {
return {
type : 'selectFormat',
options: options
options: options,
location: location()
};
},
peg$c31 = "=",
peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
peg$c33 = function(selector, pattern) {
peg$c28 = "=",
peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
peg$c30 = function(selector, pattern) {
return {
type : 'optionalFormatPattern',
selector: selector,
value : pattern
value : pattern,
location: location()
};
},
peg$c34 = "offset:",
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c36 = function(number) {
peg$c31 = "offset:",
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c33 = function(number) {
return number;
},
peg$c37 = function(offset, options) {
peg$c34 = function(offset, options) {
return {
type : 'pluralFormat',
offset : offset,
options: options
options: options,
location: location()
};
},
peg$c38 = { type: "other", description: "whitespace" },
peg$c39 = /^[ \t\n\r]/,
peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c41 = { type: "other", description: "optionalWhitespace" },
peg$c42 = /^[0-9]/,
peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c44 = /^[0-9a-f]/i,
peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c46 = "0",
peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
peg$c48 = /^[1-9]/,
peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c50 = function(digits) {
peg$c35 = { type: "other", description: "whitespace" },
peg$c36 = /^[ \t\n\r]/,
peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c38 = { type: "other", description: "optionalWhitespace" },
peg$c39 = /^[0-9]/,
peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c41 = /^[0-9a-f]/i,
peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c43 = "0",
peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
peg$c45 = /^[1-9]/,
peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c47 = function(digits) {
return parseInt(digits, 10);
},
peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
peg$c53 = "\\\\",
peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c55 = function() { return '\\'; },
peg$c56 = "\\#",
peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c58 = function() { return '\\#'; },
peg$c59 = "\\{",
peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c61 = function() { return '\u007B'; },
peg$c62 = "\\}",
peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c64 = function() { return '\u007D'; },
peg$c65 = "\\u",
peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c67 = function(digits) {
peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
peg$c50 = "\\\\",
peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c52 = function() { return '\\'; },
peg$c53 = "\\#",
peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c55 = function() { return '\\#'; },
peg$c56 = "\\{",
peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c58 = function() { return '\u007B'; },
peg$c59 = "\\}",
peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c61 = function() { return '\u007D'; },
peg$c62 = "\\u",
peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c64 = function(digits) {
return String.fromCharCode(parseInt(digits, 16));
},
peg$c68 = function(chars) { return chars.join(''); },
peg$c65 = function(chars) { return chars.join(''); },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
peg$maxFailPos = 0,

@@ -204,17 +213,9 @@ peg$maxFailExpected = [],

function text() {
return input.substring(peg$reportedPos, peg$currPos);
return input.substring(peg$savedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {

@@ -224,3 +225,4 @@ throw peg$buildException(

[{ type: "other", description: description }],
peg$reportedPos
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);

@@ -230,10 +232,30 @@ }

function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
throw peg$buildException(
message,
null,
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
var details = peg$posDetailsCache[pos],
p, ch;
for (p = startPos; p < endPos; p++) {
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column,
seenCR: details.seenCR
};
while (p < pos) {
ch = input.charAt(p);

@@ -252,15 +274,27 @@ if (ch === "\n") {

}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
return peg$cachedPosDetails;
};
}

@@ -279,3 +313,3 @@

function peg$buildException(message, expected, pos) {
function peg$buildException(message, expected, found, location) {
function cleanupExpected(expected) {

@@ -317,4 +351,4 @@ var i = 1;

.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
.replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}

@@ -340,5 +374,2 @@

var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {

@@ -348,9 +379,7 @@ cleanupExpected(expected);

return new SyntaxError(
return new peg$SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
location
);

@@ -378,4 +407,4 @@ }

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c1(s1);
peg$savedPos = s0;
s1 = peg$c0(s1);
}

@@ -414,11 +443,11 @@ s0 = s1;

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}

@@ -439,19 +468,19 @@ if (s2 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c3(s1);
peg$savedPos = s0;
s1 = peg$c1(s1);
}

@@ -463,5 +492,6 @@ s0 = s1;

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -478,4 +508,4 @@

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c4(s1);
peg$savedPos = s0;
s1 = peg$c2(s1);
}

@@ -494,3 +524,3 @@ s0 = s1;

s1 = [];
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -500,3 +530,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}

@@ -506,3 +536,3 @@ if (s2 !== peg$FAILED) {

s1.push(s2);
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -512,12 +542,13 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -533,7 +564,7 @@

if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c7;
s1 = peg$c5;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -549,7 +580,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s6 = peg$c10;
s6 = peg$c7;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -565,14 +596,14 @@ if (s6 !== peg$FAILED) {

peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = peg$c9;
s5 = null;
}

@@ -583,39 +614,39 @@ if (s5 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s7 = peg$c12;
s7 = peg$c9;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c14(s3, s5);
peg$savedPos = s0;
s1 = peg$c11(s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -647,24 +678,24 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c15) {
s1 = peg$c15;
if (input.substr(peg$currPos, 6) === peg$c12) {
s1 = peg$c12;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
if (peg$silentFails === 0) { peg$fail(peg$c13); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c17) {
s1 = peg$c17;
if (input.substr(peg$currPos, 4) === peg$c14) {
s1 = peg$c14;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c19) {
s1 = peg$c19;
if (input.substr(peg$currPos, 4) === peg$c16) {
s1 = peg$c16;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}

@@ -678,7 +709,7 @@ }

if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c10;
s4 = peg$c7;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -694,30 +725,30 @@ if (s4 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = peg$c9;
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c21(s1, s3);
peg$savedPos = s0;
s1 = peg$c18(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -732,8 +763,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c22) {
s1 = peg$c22;
if (input.substr(peg$currPos, 6) === peg$c19) {
s1 = peg$c19;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}

@@ -744,7 +775,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -756,24 +787,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c24(s5);
peg$savedPos = s0;
s1 = peg$c21(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -788,8 +819,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 13) === peg$c25) {
s1 = peg$c25;
if (input.substr(peg$currPos, 13) === peg$c22) {
s1 = peg$c22;
peg$currPos += 13;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}

@@ -800,7 +831,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -812,24 +843,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c27(s5);
peg$savedPos = s0;
s1 = peg$c24(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -844,8 +875,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c28) {
s1 = peg$c28;
if (input.substr(peg$currPos, 6) === peg$c25) {
s1 = peg$c25;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}

@@ -856,7 +887,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -874,27 +905,27 @@ if (s3 !== peg$FAILED) {

} else {
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c30(s5);
peg$savedPos = s0;
s1 = peg$c27(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -911,7 +942,7 @@

if (input.charCodeAt(peg$currPos) === 61) {
s2 = peg$c31;
s2 = peg$c28;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}

@@ -925,12 +956,13 @@ if (s2 !== peg$FAILED) {

peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
if (s0 === peg$FAILED) {

@@ -954,7 +986,7 @@ s0 = peg$parsechars();

if (input.charCodeAt(peg$currPos) === 123) {
s4 = peg$c7;
s4 = peg$c5;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -969,43 +1001,43 @@ if (s4 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s8 = peg$c12;
s8 = peg$c9;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s8 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c33(s2, s6);
peg$savedPos = s0;
s1 = peg$c30(s2, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1020,8 +1052,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c34) {
s1 = peg$c34;
if (input.substr(peg$currPos, 7) === peg$c31) {
s1 = peg$c31;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}

@@ -1033,16 +1065,16 @@ if (s1 !== peg$FAILED) {

if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c36(s3);
peg$savedPos = s0;
s1 = peg$c33(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1059,3 +1091,3 @@

if (s1 === peg$FAILED) {
s1 = peg$c9;
s1 = null;
}

@@ -1073,19 +1105,19 @@ if (s1 !== peg$FAILED) {

} else {
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c37(s1, s3);
peg$savedPos = s0;
s1 = peg$c34(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1101,3 +1133,3 @@

s0 = [];
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1107,3 +1139,3 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}

@@ -1113,3 +1145,3 @@ if (s1 !== peg$FAILED) {

s0.push(s1);
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1119,7 +1151,7 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
}
} else {
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1129,3 +1161,3 @@ peg$silentFails--;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}

@@ -1148,9 +1180,10 @@

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c41); }
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}

@@ -1164,3 +1197,3 @@

if (peg$c42.test(input.charAt(peg$currPos))) {
if (peg$c39.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1170,3 +1203,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}

@@ -1180,3 +1213,3 @@

if (peg$c44.test(input.charAt(peg$currPos))) {
if (peg$c41.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1186,3 +1219,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}

@@ -1198,7 +1231,7 @@

if (input.charCodeAt(peg$currPos) === 48) {
s1 = peg$c46;
s1 = peg$c43;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}

@@ -1208,3 +1241,3 @@ if (s1 === peg$FAILED) {

s2 = peg$currPos;
if (peg$c48.test(input.charAt(peg$currPos))) {
if (peg$c45.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -1214,3 +1247,3 @@ peg$currPos++;

s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}

@@ -1229,16 +1262,17 @@ if (s3 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s2 = input.substring(s1, peg$currPos);
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c50(s1);
peg$savedPos = s0;
s1 = peg$c47(s1);
}

@@ -1253,3 +1287,3 @@ s0 = s1;

if (peg$c51.test(input.charAt(peg$currPos))) {
if (peg$c48.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1259,16 +1293,16 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
if (input.substr(peg$currPos, 2) === peg$c50) {
s1 = peg$c50;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c55();
peg$savedPos = s0;
s1 = peg$c52();
}

@@ -1278,12 +1312,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c58();
peg$savedPos = s0;
s1 = peg$c55();
}

@@ -1293,12 +1327,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c57); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c61();
peg$savedPos = s0;
s1 = peg$c58();
}

@@ -1308,12 +1342,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c64();
peg$savedPos = s0;
s1 = peg$c61();
}

@@ -1323,8 +1357,8 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c65) {
s1 = peg$c65;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}

@@ -1346,31 +1380,32 @@ if (s1 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s3 = input.substring(s2, peg$currPos);
s2 = input.substring(s2, peg$currPos);
} else {
s2 = s3;
}
s2 = s3;
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c67(s2);
peg$savedPos = s0;
s1 = peg$c64(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1398,7 +1433,7 @@ }

} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c68(s1);
peg$savedPos = s0;
s1 = peg$c65(s1);
}

@@ -1419,3 +1454,10 @@ s0 = s1;

throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
throw peg$buildException(
null,
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}

@@ -1425,4 +1467,4 @@ }

return {
SyntaxError: SyntaxError,
parse: parse
SyntaxError: peg$SyntaxError,
parse: peg$parse
};

@@ -1429,0 +1471,0 @@ })();

"use strict";
exports["default"] = (function() {
"use strict";
/*
* Generated by PEG.js 0.8.0.
* Generated by PEG.js 0.9.0.
*
* http://pegjs.majda.cz/
* http://pegjs.org/
*/

@@ -16,17 +18,19 @@

function SyntaxError(message, expected, found, offset, line, column) {
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.location = location;
this.name = "SyntaxError";
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(SyntaxError, Error);
peg$subclass(peg$SyntaxError, Error);
function parse(input) {
function peg$parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
parser = this,

@@ -38,11 +42,10 @@ peg$FAILED = {},

peg$c0 = [],
peg$c1 = function(elements) {
peg$c0 = function(elements) {
return {
type : 'messageFormatPattern',
elements: elements
elements: elements,
location: location()
};
},
peg$c2 = peg$FAILED,
peg$c3 = function(text) {
peg$c1 = function(text) {
var string = '',

@@ -61,39 +64,41 @@ i, j, outerLen, inner, innerLen;

},
peg$c4 = function(messageText) {
peg$c2 = function(messageText) {
return {
type : 'messageTextElement',
value: messageText
value: messageText,
location: location()
};
},
peg$c5 = /^[^ \t\n\r,.+={}#]/,
peg$c6 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c7 = "{",
peg$c8 = { type: "literal", value: "{", description: "\"{\"" },
peg$c9 = null,
peg$c10 = ",",
peg$c11 = { type: "literal", value: ",", description: "\",\"" },
peg$c12 = "}",
peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
peg$c14 = function(id, format) {
peg$c3 = /^[^ \t\n\r,.+={}#]/,
peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c5 = "{",
peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
peg$c7 = ",",
peg$c8 = { type: "literal", value: ",", description: "\",\"" },
peg$c9 = "}",
peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
peg$c11 = function(id, format) {
return {
type : 'argumentElement',
id : id,
format: format && format[2]
format: format && format[2],
location: location()
};
},
peg$c15 = "number",
peg$c16 = { type: "literal", value: "number", description: "\"number\"" },
peg$c17 = "date",
peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
peg$c19 = "time",
peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
peg$c21 = function(type, style) {
peg$c12 = "number",
peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
peg$c14 = "date",
peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
peg$c16 = "time",
peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
peg$c18 = function(type, style) {
return {
type : type + 'Format',
style: style && style[2]
style: style && style[2],
location: location()
};
},
peg$c22 = "plural",
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c24 = function(pluralStyle) {
peg$c19 = "plural",
peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c21 = function(pluralStyle) {
return {

@@ -103,8 +108,9 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
};
},
peg$c25 = "selectordinal",
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c27 = function(pluralStyle) {
peg$c22 = "selectordinal",
peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c24 = function(pluralStyle) {
return {

@@ -114,74 +120,77 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
}
},
peg$c28 = "select",
peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
peg$c30 = function(options) {
peg$c25 = "select",
peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
peg$c27 = function(options) {
return {
type : 'selectFormat',
options: options
options: options,
location: location()
};
},
peg$c31 = "=",
peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
peg$c33 = function(selector, pattern) {
peg$c28 = "=",
peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
peg$c30 = function(selector, pattern) {
return {
type : 'optionalFormatPattern',
selector: selector,
value : pattern
value : pattern,
location: location()
};
},
peg$c34 = "offset:",
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c36 = function(number) {
peg$c31 = "offset:",
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c33 = function(number) {
return number;
},
peg$c37 = function(offset, options) {
peg$c34 = function(offset, options) {
return {
type : 'pluralFormat',
offset : offset,
options: options
options: options,
location: location()
};
},
peg$c38 = { type: "other", description: "whitespace" },
peg$c39 = /^[ \t\n\r]/,
peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c41 = { type: "other", description: "optionalWhitespace" },
peg$c42 = /^[0-9]/,
peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c44 = /^[0-9a-f]/i,
peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c46 = "0",
peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
peg$c48 = /^[1-9]/,
peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c50 = function(digits) {
peg$c35 = { type: "other", description: "whitespace" },
peg$c36 = /^[ \t\n\r]/,
peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c38 = { type: "other", description: "optionalWhitespace" },
peg$c39 = /^[0-9]/,
peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c41 = /^[0-9a-f]/i,
peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c43 = "0",
peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
peg$c45 = /^[1-9]/,
peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c47 = function(digits) {
return parseInt(digits, 10);
},
peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
peg$c53 = "\\\\",
peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c55 = function() { return '\\'; },
peg$c56 = "\\#",
peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c58 = function() { return '\\#'; },
peg$c59 = "\\{",
peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c61 = function() { return '\u007B'; },
peg$c62 = "\\}",
peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c64 = function() { return '\u007D'; },
peg$c65 = "\\u",
peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c67 = function(digits) {
peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
peg$c50 = "\\\\",
peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c52 = function() { return '\\'; },
peg$c53 = "\\#",
peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c55 = function() { return '\\#'; },
peg$c56 = "\\{",
peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c58 = function() { return '\u007B'; },
peg$c59 = "\\}",
peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c61 = function() { return '\u007D'; },
peg$c62 = "\\u",
peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c64 = function(digits) {
return String.fromCharCode(parseInt(digits, 16));
},
peg$c68 = function(chars) { return chars.join(''); },
peg$c65 = function(chars) { return chars.join(''); },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
peg$maxFailPos = 0,

@@ -202,17 +211,9 @@ peg$maxFailExpected = [],

function text() {
return input.substring(peg$reportedPos, peg$currPos);
return input.substring(peg$savedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {

@@ -222,3 +223,4 @@ throw peg$buildException(

[{ type: "other", description: description }],
peg$reportedPos
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);

@@ -228,10 +230,30 @@ }

function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
throw peg$buildException(
message,
null,
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
var details = peg$posDetailsCache[pos],
p, ch;
for (p = startPos; p < endPos; p++) {
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column,
seenCR: details.seenCR
};
while (p < pos) {
ch = input.charAt(p);

@@ -250,15 +272,27 @@ if (ch === "\n") {

}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
return peg$cachedPosDetails;
};
}

@@ -277,3 +311,3 @@

function peg$buildException(message, expected, pos) {
function peg$buildException(message, expected, found, location) {
function cleanupExpected(expected) {

@@ -315,4 +349,4 @@ var i = 1;

.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
.replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}

@@ -338,5 +372,2 @@

var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {

@@ -346,9 +377,7 @@ cleanupExpected(expected);

return new SyntaxError(
return new peg$SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
location
);

@@ -376,4 +405,4 @@ }

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c1(s1);
peg$savedPos = s0;
s1 = peg$c0(s1);
}

@@ -412,11 +441,11 @@ s0 = s1;

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}

@@ -437,19 +466,19 @@ if (s2 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c3(s1);
peg$savedPos = s0;
s1 = peg$c1(s1);
}

@@ -461,5 +490,6 @@ s0 = s1;

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -476,4 +506,4 @@

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c4(s1);
peg$savedPos = s0;
s1 = peg$c2(s1);
}

@@ -492,3 +522,3 @@ s0 = s1;

s1 = [];
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -498,3 +528,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}

@@ -504,3 +534,3 @@ if (s2 !== peg$FAILED) {

s1.push(s2);
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -510,12 +540,13 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -531,7 +562,7 @@

if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c7;
s1 = peg$c5;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -547,7 +578,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s6 = peg$c10;
s6 = peg$c7;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -563,14 +594,14 @@ if (s6 !== peg$FAILED) {

peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = peg$c9;
s5 = null;
}

@@ -581,39 +612,39 @@ if (s5 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s7 = peg$c12;
s7 = peg$c9;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c14(s3, s5);
peg$savedPos = s0;
s1 = peg$c11(s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -645,24 +676,24 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c15) {
s1 = peg$c15;
if (input.substr(peg$currPos, 6) === peg$c12) {
s1 = peg$c12;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
if (peg$silentFails === 0) { peg$fail(peg$c13); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c17) {
s1 = peg$c17;
if (input.substr(peg$currPos, 4) === peg$c14) {
s1 = peg$c14;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c19) {
s1 = peg$c19;
if (input.substr(peg$currPos, 4) === peg$c16) {
s1 = peg$c16;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}

@@ -676,7 +707,7 @@ }

if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c10;
s4 = peg$c7;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -692,30 +723,30 @@ if (s4 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = peg$c9;
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c21(s1, s3);
peg$savedPos = s0;
s1 = peg$c18(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -730,8 +761,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c22) {
s1 = peg$c22;
if (input.substr(peg$currPos, 6) === peg$c19) {
s1 = peg$c19;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}

@@ -742,7 +773,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -754,24 +785,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c24(s5);
peg$savedPos = s0;
s1 = peg$c21(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -786,8 +817,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 13) === peg$c25) {
s1 = peg$c25;
if (input.substr(peg$currPos, 13) === peg$c22) {
s1 = peg$c22;
peg$currPos += 13;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}

@@ -798,7 +829,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -810,24 +841,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c27(s5);
peg$savedPos = s0;
s1 = peg$c24(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -842,8 +873,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c28) {
s1 = peg$c28;
if (input.substr(peg$currPos, 6) === peg$c25) {
s1 = peg$c25;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}

@@ -854,7 +885,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -872,27 +903,27 @@ if (s3 !== peg$FAILED) {

} else {
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c30(s5);
peg$savedPos = s0;
s1 = peg$c27(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -909,7 +940,7 @@

if (input.charCodeAt(peg$currPos) === 61) {
s2 = peg$c31;
s2 = peg$c28;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}

@@ -923,12 +954,13 @@ if (s2 !== peg$FAILED) {

peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
if (s0 === peg$FAILED) {

@@ -952,7 +984,7 @@ s0 = peg$parsechars();

if (input.charCodeAt(peg$currPos) === 123) {
s4 = peg$c7;
s4 = peg$c5;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -967,43 +999,43 @@ if (s4 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s8 = peg$c12;
s8 = peg$c9;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s8 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c33(s2, s6);
peg$savedPos = s0;
s1 = peg$c30(s2, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1018,8 +1050,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c34) {
s1 = peg$c34;
if (input.substr(peg$currPos, 7) === peg$c31) {
s1 = peg$c31;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}

@@ -1031,16 +1063,16 @@ if (s1 !== peg$FAILED) {

if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c36(s3);
peg$savedPos = s0;
s1 = peg$c33(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1057,3 +1089,3 @@

if (s1 === peg$FAILED) {
s1 = peg$c9;
s1 = null;
}

@@ -1071,19 +1103,19 @@ if (s1 !== peg$FAILED) {

} else {
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c37(s1, s3);
peg$savedPos = s0;
s1 = peg$c34(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1099,3 +1131,3 @@

s0 = [];
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1105,3 +1137,3 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}

@@ -1111,3 +1143,3 @@ if (s1 !== peg$FAILED) {

s0.push(s1);
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1117,7 +1149,7 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
}
} else {
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1127,3 +1159,3 @@ peg$silentFails--;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}

@@ -1146,9 +1178,10 @@

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c41); }
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}

@@ -1162,3 +1195,3 @@

if (peg$c42.test(input.charAt(peg$currPos))) {
if (peg$c39.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1168,3 +1201,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}

@@ -1178,3 +1211,3 @@

if (peg$c44.test(input.charAt(peg$currPos))) {
if (peg$c41.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1184,3 +1217,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}

@@ -1196,7 +1229,7 @@

if (input.charCodeAt(peg$currPos) === 48) {
s1 = peg$c46;
s1 = peg$c43;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}

@@ -1206,3 +1239,3 @@ if (s1 === peg$FAILED) {

s2 = peg$currPos;
if (peg$c48.test(input.charAt(peg$currPos))) {
if (peg$c45.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -1212,3 +1245,3 @@ peg$currPos++;

s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}

@@ -1227,16 +1260,17 @@ if (s3 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s2 = input.substring(s1, peg$currPos);
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c50(s1);
peg$savedPos = s0;
s1 = peg$c47(s1);
}

@@ -1251,3 +1285,3 @@ s0 = s1;

if (peg$c51.test(input.charAt(peg$currPos))) {
if (peg$c48.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1257,16 +1291,16 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
if (input.substr(peg$currPos, 2) === peg$c50) {
s1 = peg$c50;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c55();
peg$savedPos = s0;
s1 = peg$c52();
}

@@ -1276,12 +1310,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c58();
peg$savedPos = s0;
s1 = peg$c55();
}

@@ -1291,12 +1325,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c57); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c61();
peg$savedPos = s0;
s1 = peg$c58();
}

@@ -1306,12 +1340,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c64();
peg$savedPos = s0;
s1 = peg$c61();
}

@@ -1321,8 +1355,8 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c65) {
s1 = peg$c65;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}

@@ -1344,31 +1378,32 @@ if (s1 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s3 = input.substring(s2, peg$currPos);
s2 = input.substring(s2, peg$currPos);
} else {
s2 = s3;
}
s2 = s3;
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c67(s2);
peg$savedPos = s0;
s1 = peg$c64(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1396,7 +1431,7 @@ }

} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c68(s1);
peg$savedPos = s0;
s1 = peg$c65(s1);
}

@@ -1417,3 +1452,10 @@ s0 = s1;

throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
throw peg$buildException(
null,
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}

@@ -1423,4 +1465,4 @@ }

return {
SyntaxError: SyntaxError,
parse: parse
SyntaxError: peg$SyntaxError,
parse: peg$parse
};

@@ -1427,0 +1469,0 @@ })();

{
"name": "intl-messageformat-parser",
"version": "1.2.0",
"version": "1.3.0",
"description": "Parses ICU Message strings into an AST via JavaScript.",

@@ -40,3 +40,3 @@ "main": "index.js",

"grunt-contrib-copy": "^0.7.0",
"grunt-peg": "^1.5.0",
"grunt-peg": "^2.0.1",
"istanbul": "^0.3.2",

@@ -43,0 +43,0 @@ "mocha": "^2.0.1",

export default (function() {
"use strict";
/*
* Generated by PEG.js 0.8.0.
* Generated by PEG.js 0.9.0.
*
* http://pegjs.majda.cz/
* http://pegjs.org/
*/

@@ -14,17 +16,19 @@

function SyntaxError(message, expected, found, offset, line, column) {
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.location = location;
this.name = "SyntaxError";
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(SyntaxError, Error);
peg$subclass(peg$SyntaxError, Error);
function parse(input) {
function peg$parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
parser = this,

@@ -36,11 +40,10 @@ peg$FAILED = {},

peg$c0 = [],
peg$c1 = function(elements) {
peg$c0 = function(elements) {
return {
type : 'messageFormatPattern',
elements: elements
elements: elements,
location: location()
};
},
peg$c2 = peg$FAILED,
peg$c3 = function(text) {
peg$c1 = function(text) {
var string = '',

@@ -59,39 +62,41 @@ i, j, outerLen, inner, innerLen;

},
peg$c4 = function(messageText) {
peg$c2 = function(messageText) {
return {
type : 'messageTextElement',
value: messageText
value: messageText,
location: location()
};
},
peg$c5 = /^[^ \t\n\r,.+={}#]/,
peg$c6 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c7 = "{",
peg$c8 = { type: "literal", value: "{", description: "\"{\"" },
peg$c9 = null,
peg$c10 = ",",
peg$c11 = { type: "literal", value: ",", description: "\",\"" },
peg$c12 = "}",
peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
peg$c14 = function(id, format) {
peg$c3 = /^[^ \t\n\r,.+={}#]/,
peg$c4 = { type: "class", value: "[^ \\t\\n\\r,.+={}#]", description: "[^ \\t\\n\\r,.+={}#]" },
peg$c5 = "{",
peg$c6 = { type: "literal", value: "{", description: "\"{\"" },
peg$c7 = ",",
peg$c8 = { type: "literal", value: ",", description: "\",\"" },
peg$c9 = "}",
peg$c10 = { type: "literal", value: "}", description: "\"}\"" },
peg$c11 = function(id, format) {
return {
type : 'argumentElement',
id : id,
format: format && format[2]
format: format && format[2],
location: location()
};
},
peg$c15 = "number",
peg$c16 = { type: "literal", value: "number", description: "\"number\"" },
peg$c17 = "date",
peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
peg$c19 = "time",
peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
peg$c21 = function(type, style) {
peg$c12 = "number",
peg$c13 = { type: "literal", value: "number", description: "\"number\"" },
peg$c14 = "date",
peg$c15 = { type: "literal", value: "date", description: "\"date\"" },
peg$c16 = "time",
peg$c17 = { type: "literal", value: "time", description: "\"time\"" },
peg$c18 = function(type, style) {
return {
type : type + 'Format',
style: style && style[2]
style: style && style[2],
location: location()
};
},
peg$c22 = "plural",
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c24 = function(pluralStyle) {
peg$c19 = "plural",
peg$c20 = { type: "literal", value: "plural", description: "\"plural\"" },
peg$c21 = function(pluralStyle) {
return {

@@ -101,8 +106,9 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
};
},
peg$c25 = "selectordinal",
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c27 = function(pluralStyle) {
peg$c22 = "selectordinal",
peg$c23 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
peg$c24 = function(pluralStyle) {
return {

@@ -112,74 +118,77 @@ type : pluralStyle.type,

offset : pluralStyle.offset || 0,
options: pluralStyle.options
options: pluralStyle.options,
location: location()
}
},
peg$c28 = "select",
peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
peg$c30 = function(options) {
peg$c25 = "select",
peg$c26 = { type: "literal", value: "select", description: "\"select\"" },
peg$c27 = function(options) {
return {
type : 'selectFormat',
options: options
options: options,
location: location()
};
},
peg$c31 = "=",
peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
peg$c33 = function(selector, pattern) {
peg$c28 = "=",
peg$c29 = { type: "literal", value: "=", description: "\"=\"" },
peg$c30 = function(selector, pattern) {
return {
type : 'optionalFormatPattern',
selector: selector,
value : pattern
value : pattern,
location: location()
};
},
peg$c34 = "offset:",
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c36 = function(number) {
peg$c31 = "offset:",
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" },
peg$c33 = function(number) {
return number;
},
peg$c37 = function(offset, options) {
peg$c34 = function(offset, options) {
return {
type : 'pluralFormat',
offset : offset,
options: options
options: options,
location: location()
};
},
peg$c38 = { type: "other", description: "whitespace" },
peg$c39 = /^[ \t\n\r]/,
peg$c40 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c41 = { type: "other", description: "optionalWhitespace" },
peg$c42 = /^[0-9]/,
peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c44 = /^[0-9a-f]/i,
peg$c45 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c46 = "0",
peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
peg$c48 = /^[1-9]/,
peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c50 = function(digits) {
peg$c35 = { type: "other", description: "whitespace" },
peg$c36 = /^[ \t\n\r]/,
peg$c37 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c38 = { type: "other", description: "optionalWhitespace" },
peg$c39 = /^[0-9]/,
peg$c40 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c41 = /^[0-9a-f]/i,
peg$c42 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
peg$c43 = "0",
peg$c44 = { type: "literal", value: "0", description: "\"0\"" },
peg$c45 = /^[1-9]/,
peg$c46 = { type: "class", value: "[1-9]", description: "[1-9]" },
peg$c47 = function(digits) {
return parseInt(digits, 10);
},
peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
peg$c53 = "\\\\",
peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c55 = function() { return '\\'; },
peg$c56 = "\\#",
peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c58 = function() { return '\\#'; },
peg$c59 = "\\{",
peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c61 = function() { return '\u007B'; },
peg$c62 = "\\}",
peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c64 = function() { return '\u007D'; },
peg$c65 = "\\u",
peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c67 = function(digits) {
peg$c48 = /^[^{}\\\0-\x1F \t\n\r]/,
peg$c49 = { type: "class", value: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]" },
peg$c50 = "\\\\",
peg$c51 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
peg$c52 = function() { return '\\'; },
peg$c53 = "\\#",
peg$c54 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
peg$c55 = function() { return '\\#'; },
peg$c56 = "\\{",
peg$c57 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
peg$c58 = function() { return '\u007B'; },
peg$c59 = "\\}",
peg$c60 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
peg$c61 = function() { return '\u007D'; },
peg$c62 = "\\u",
peg$c63 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
peg$c64 = function(digits) {
return String.fromCharCode(parseInt(digits, 16));
},
peg$c68 = function(chars) { return chars.join(''); },
peg$c65 = function(chars) { return chars.join(''); },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
peg$maxFailPos = 0,

@@ -200,17 +209,9 @@ peg$maxFailExpected = [],

function text() {
return input.substring(peg$reportedPos, peg$currPos);
return input.substring(peg$savedPos, peg$currPos);
}
function offset() {
return peg$reportedPos;
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function line() {
return peg$computePosDetails(peg$reportedPos).line;
}
function column() {
return peg$computePosDetails(peg$reportedPos).column;
}
function expected(description) {

@@ -220,3 +221,4 @@ throw peg$buildException(

[{ type: "other", description: description }],
peg$reportedPos
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);

@@ -226,10 +228,30 @@ }

function error(message) {
throw peg$buildException(message, null, peg$reportedPos);
throw peg$buildException(
message,
null,
input.substring(peg$savedPos, peg$currPos),
peg$computeLocation(peg$savedPos, peg$currPos)
);
}
function peg$computePosDetails(pos) {
function advance(details, startPos, endPos) {
var p, ch;
var details = peg$posDetailsCache[pos],
p, ch;
for (p = startPos; p < endPos; p++) {
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column,
seenCR: details.seenCR
};
while (p < pos) {
ch = input.charAt(p);

@@ -248,15 +270,27 @@ if (ch === "\n") {

}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
if (peg$cachedPos !== pos) {
if (peg$cachedPos > pos) {
peg$cachedPos = 0;
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
advance(peg$cachedPosDetails, peg$cachedPos, pos);
peg$cachedPos = pos;
}
return peg$cachedPosDetails;
};
}

@@ -275,3 +309,3 @@

function peg$buildException(message, expected, pos) {
function peg$buildException(message, expected, found, location) {
function cleanupExpected(expected) {

@@ -313,4 +347,4 @@ var i = 1;

.replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
.replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
.replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
.replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
}

@@ -336,5 +370,2 @@

var posDetails = peg$computePosDetails(pos),
found = pos < input.length ? input.charAt(pos) : null;
if (expected !== null) {

@@ -344,9 +375,7 @@ cleanupExpected(expected);

return new SyntaxError(
return new peg$SyntaxError(
message !== null ? message : buildMessage(expected, found),
expected,
found,
pos,
posDetails.line,
posDetails.column
location
);

@@ -374,4 +403,4 @@ }

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c1(s1);
peg$savedPos = s0;
s1 = peg$c0(s1);
}

@@ -410,11 +439,11 @@ s0 = s1;

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}

@@ -435,19 +464,19 @@ if (s2 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c3(s1);
peg$savedPos = s0;
s1 = peg$c1(s1);
}

@@ -459,5 +488,6 @@ s0 = s1;

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -474,4 +504,4 @@

if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c4(s1);
peg$savedPos = s0;
s1 = peg$c2(s1);
}

@@ -490,3 +520,3 @@ s0 = s1;

s1 = [];
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -496,3 +526,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}

@@ -502,3 +532,3 @@ if (s2 !== peg$FAILED) {

s1.push(s2);
if (peg$c5.test(input.charAt(peg$currPos))) {
if (peg$c3.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -508,12 +538,13 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c6); }
if (peg$silentFails === 0) { peg$fail(peg$c4); }
}
}
} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
}

@@ -529,7 +560,7 @@

if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c7;
s1 = peg$c5;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -545,7 +576,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s6 = peg$c10;
s6 = peg$c7;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -561,14 +592,14 @@ if (s6 !== peg$FAILED) {

peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = peg$c9;
s5 = null;
}

@@ -579,39 +610,39 @@ if (s5 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s7 = peg$c12;
s7 = peg$c9;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s7 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c14(s3, s5);
peg$savedPos = s0;
s1 = peg$c11(s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -643,24 +674,24 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c15) {
s1 = peg$c15;
if (input.substr(peg$currPos, 6) === peg$c12) {
s1 = peg$c12;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
if (peg$silentFails === 0) { peg$fail(peg$c13); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c17) {
s1 = peg$c17;
if (input.substr(peg$currPos, 4) === peg$c14) {
s1 = peg$c14;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c19) {
s1 = peg$c19;
if (input.substr(peg$currPos, 4) === peg$c16) {
s1 = peg$c16;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}

@@ -674,7 +705,7 @@ }

if (input.charCodeAt(peg$currPos) === 44) {
s4 = peg$c10;
s4 = peg$c7;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -690,30 +721,30 @@ if (s4 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = peg$c9;
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c21(s1, s3);
peg$savedPos = s0;
s1 = peg$c18(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -728,8 +759,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c22) {
s1 = peg$c22;
if (input.substr(peg$currPos, 6) === peg$c19) {
s1 = peg$c19;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}

@@ -740,7 +771,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -752,24 +783,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c24(s5);
peg$savedPos = s0;
s1 = peg$c21(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -784,8 +815,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 13) === peg$c25) {
s1 = peg$c25;
if (input.substr(peg$currPos, 13) === peg$c22) {
s1 = peg$c22;
peg$currPos += 13;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}

@@ -796,7 +827,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -808,24 +839,24 @@ if (s3 !== peg$FAILED) {

if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c27(s5);
peg$savedPos = s0;
s1 = peg$c24(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -840,8 +871,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c28) {
s1 = peg$c28;
if (input.substr(peg$currPos, 6) === peg$c25) {
s1 = peg$c25;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c29); }
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}

@@ -852,7 +883,7 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 44) {
s3 = peg$c10;
s3 = peg$c7;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c11); }
if (peg$silentFails === 0) { peg$fail(peg$c8); }
}

@@ -870,27 +901,27 @@ if (s3 !== peg$FAILED) {

} else {
s5 = peg$c2;
s5 = peg$FAILED;
}
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c30(s5);
peg$savedPos = s0;
s1 = peg$c27(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -907,7 +938,7 @@

if (input.charCodeAt(peg$currPos) === 61) {
s2 = peg$c31;
s2 = peg$c28;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
if (peg$silentFails === 0) { peg$fail(peg$c29); }
}

@@ -921,12 +952,13 @@ if (s2 !== peg$FAILED) {

peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
if (s0 === peg$FAILED) {

@@ -950,7 +982,7 @@ s0 = peg$parsechars();

if (input.charCodeAt(peg$currPos) === 123) {
s4 = peg$c7;
s4 = peg$c5;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c6); }
}

@@ -965,43 +997,43 @@ if (s4 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 125) {
s8 = peg$c12;
s8 = peg$c9;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c13); }
if (peg$silentFails === 0) { peg$fail(peg$c10); }
}
if (s8 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c33(s2, s6);
peg$savedPos = s0;
s1 = peg$c30(s2, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1016,8 +1048,8 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c34) {
s1 = peg$c34;
if (input.substr(peg$currPos, 7) === peg$c31) {
s1 = peg$c31;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}

@@ -1029,16 +1061,16 @@ if (s1 !== peg$FAILED) {

if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c36(s3);
peg$savedPos = s0;
s1 = peg$c33(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1055,3 +1087,3 @@

if (s1 === peg$FAILED) {
s1 = peg$c9;
s1 = null;
}

@@ -1069,19 +1101,19 @@ if (s1 !== peg$FAILED) {

} else {
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c37(s1, s3);
peg$savedPos = s0;
s1 = peg$c34(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1097,3 +1129,3 @@

s0 = [];
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1103,3 +1135,3 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}

@@ -1109,3 +1141,3 @@ if (s1 !== peg$FAILED) {

s0.push(s1);
if (peg$c39.test(input.charAt(peg$currPos))) {
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1115,7 +1147,7 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c40); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
}
} else {
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1125,3 +1157,3 @@ peg$silentFails--;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}

@@ -1144,9 +1176,10 @@

if (s1 !== peg$FAILED) {
s1 = input.substring(s0, peg$currPos);
s0 = input.substring(s0, peg$currPos);
} else {
s0 = s1;
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c41); }
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}

@@ -1160,3 +1193,3 @@

if (peg$c42.test(input.charAt(peg$currPos))) {
if (peg$c39.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1166,3 +1199,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}

@@ -1176,3 +1209,3 @@

if (peg$c44.test(input.charAt(peg$currPos))) {
if (peg$c41.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1182,3 +1215,3 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
if (peg$silentFails === 0) { peg$fail(peg$c42); }
}

@@ -1194,7 +1227,7 @@

if (input.charCodeAt(peg$currPos) === 48) {
s1 = peg$c46;
s1 = peg$c43;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}

@@ -1204,3 +1237,3 @@ if (s1 === peg$FAILED) {

s2 = peg$currPos;
if (peg$c48.test(input.charAt(peg$currPos))) {
if (peg$c45.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -1210,3 +1243,3 @@ peg$currPos++;

s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c49); }
if (peg$silentFails === 0) { peg$fail(peg$c46); }
}

@@ -1225,16 +1258,17 @@ if (s3 !== peg$FAILED) {

peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$c2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s2 = input.substring(s1, peg$currPos);
s1 = input.substring(s1, peg$currPos);
} else {
s1 = s2;
}
s1 = s2;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c50(s1);
peg$savedPos = s0;
s1 = peg$c47(s1);
}

@@ -1249,3 +1283,3 @@ s0 = s1;

if (peg$c51.test(input.charAt(peg$currPos))) {
if (peg$c48.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);

@@ -1255,16 +1289,16 @@ peg$currPos++;

s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
if (input.substr(peg$currPos, 2) === peg$c50) {
s1 = peg$c50;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c55();
peg$savedPos = s0;
s1 = peg$c52();
}

@@ -1274,12 +1308,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c58();
peg$savedPos = s0;
s1 = peg$c55();
}

@@ -1289,12 +1323,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c57); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c61();
peg$savedPos = s0;
s1 = peg$c58();
}

@@ -1304,12 +1338,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
if (peg$silentFails === 0) { peg$fail(peg$c60); }
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c64();
peg$savedPos = s0;
s1 = peg$c61();
}

@@ -1319,8 +1353,8 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c65) {
s1 = peg$c65;
if (input.substr(peg$currPos, 2) === peg$c62) {
s1 = peg$c62;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
if (peg$silentFails === 0) { peg$fail(peg$c63); }
}

@@ -1342,31 +1376,32 @@ if (s1 !== peg$FAILED) {

peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$c2;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s3 = input.substring(s2, peg$currPos);
s2 = input.substring(s2, peg$currPos);
} else {
s2 = s3;
}
s2 = s3;
if (s2 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c67(s2);
peg$savedPos = s0;
s1 = peg$c64(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$c2;
s0 = peg$FAILED;
}

@@ -1394,7 +1429,7 @@ }

} else {
s1 = peg$c2;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$reportedPos = s0;
s1 = peg$c68(s1);
peg$savedPos = s0;
s1 = peg$c65(s1);
}

@@ -1415,3 +1450,10 @@ s0 = s1;

throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
throw peg$buildException(
null,
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}

@@ -1421,5 +1463,5 @@ }

return {
SyntaxError: SyntaxError,
parse: parse
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
})();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc