intl-messageformat-parser
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -96,20 +96,31 @@ (function() { | ||
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" }, | ||
peg$c24 = function(offset, options) { | ||
peg$c24 = function(pluralStyle) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset || 0, | ||
options: options | ||
type : pluralStyle.type, | ||
ordinal: false, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
}; | ||
}, | ||
peg$c25 = "selectordinal", | ||
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" }, | ||
peg$c27 = function(pluralStyle) { | ||
return { | ||
type : pluralStyle.type, | ||
ordinal: true, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
} | ||
}, | ||
peg$c25 = "select", | ||
peg$c26 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c27 = function(options) { | ||
peg$c28 = "select", | ||
peg$c29 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c30 = function(options) { | ||
return { | ||
type : 'selectFormat', | ||
options: options | ||
} | ||
}; | ||
}, | ||
peg$c28 = "=", | ||
peg$c29 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c30 = function(selector, pattern) { | ||
peg$c31 = "=", | ||
peg$c32 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c33 = function(selector, pattern) { | ||
return { | ||
@@ -121,39 +132,46 @@ type : 'optionalFormatPattern', | ||
}, | ||
peg$c31 = "offset:", | ||
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c33 = function(number) { | ||
peg$c34 = "offset:", | ||
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c36 = function(number) { | ||
return number; | ||
}, | ||
peg$c34 = { type: "other", description: "whitespace" }, | ||
peg$c35 = /^[ \t\n\r]/, | ||
peg$c36 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, | ||
peg$c37 = { type: "other", description: "optionalWhitespace" }, | ||
peg$c38 = /^[0-9]/, | ||
peg$c39 = { type: "class", value: "[0-9]", description: "[0-9]" }, | ||
peg$c40 = /^[0-9a-f]/i, | ||
peg$c41 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, | ||
peg$c42 = "0", | ||
peg$c43 = { type: "literal", value: "0", description: "\"0\"" }, | ||
peg$c44 = /^[1-9]/, | ||
peg$c45 = { type: "class", value: "[1-9]", description: "[1-9]" }, | ||
peg$c46 = function(digits) { | ||
peg$c37 = function(offset, options) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset, | ||
options: options | ||
}; | ||
}, | ||
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) { | ||
return parseInt(digits, 10); | ||
}, | ||
peg$c47 = /^[^{}\\\0-\x1F \t\n\r]/, | ||
peg$c48 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" }, | ||
peg$c49 = "\\#", | ||
peg$c50 = { type: "literal", value: "\\#", description: "\"\\\\#\"" }, | ||
peg$c51 = function() { return '\\#'; }, | ||
peg$c52 = "\\{", | ||
peg$c53 = { type: "literal", value: "\\{", description: "\"\\\\{\"" }, | ||
peg$c54 = function() { return '\u007B'; }, | ||
peg$c55 = "\\}", | ||
peg$c56 = { type: "literal", value: "\\}", description: "\"\\\\}\"" }, | ||
peg$c57 = function() { return '\u007D'; }, | ||
peg$c58 = "\\u", | ||
peg$c59 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, | ||
peg$c60 = function(digits) { | ||
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 '\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$c61 = function(chars) { return chars.join(''); }, | ||
peg$c65 = function(chars) { return chars.join(''); }, | ||
@@ -587,3 +605,6 @@ peg$currPos = 0, | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
s0 = peg$parseselectOrdinalFormat(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
} | ||
} | ||
@@ -678,3 +699,3 @@ } | ||
function peg$parsepluralFormat() { | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
var s0, s1, s2, s3, s4, s5; | ||
@@ -702,31 +723,60 @@ s0 = peg$currPos; | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseoffset(); | ||
if (s5 === peg$FAILED) { | ||
s5 = peg$c9; | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parseselectOrdinalFormat() { | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 13) === peg$c25) { | ||
s1 = peg$c25; | ||
peg$currPos += 13; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s3 = peg$c10; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parse_(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parse_(); | ||
if (s6 !== peg$FAILED) { | ||
s7 = []; | ||
s8 = peg$parseoptionalFormatPattern(); | ||
if (s8 !== peg$FAILED) { | ||
while (s8 !== peg$FAILED) { | ||
s7.push(s8); | ||
s8 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s7 = peg$c2; | ||
} | ||
if (s7 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5, s7); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s0 = s1; | ||
} else { | ||
@@ -760,8 +810,8 @@ peg$currPos = s0; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 6) === peg$c25) { | ||
s1 = peg$c25; | ||
if (input.substr(peg$currPos, 6) === peg$c28) { | ||
s1 = peg$c28; | ||
peg$currPos += 6; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
} | ||
@@ -793,3 +843,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s1 = peg$c30(s5); | ||
s0 = s1; | ||
@@ -826,7 +876,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 61) { | ||
s2 = peg$c28; | ||
s2 = peg$c31; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
@@ -890,3 +940,3 @@ if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c30(s2, s6); | ||
s1 = peg$c33(s2, s6); | ||
s0 = s1; | ||
@@ -933,8 +983,8 @@ } else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7) === peg$c31) { | ||
s1 = peg$c31; | ||
if (input.substr(peg$currPos, 7) === peg$c34) { | ||
s1 = peg$c34; | ||
peg$currPos += 7; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
@@ -947,3 +997,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c33(s3); | ||
s1 = peg$c36(s3); | ||
s0 = s1; | ||
@@ -966,2 +1016,43 @@ } else { | ||
function peg$parsepluralStyle() { | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = peg$parseoffset(); | ||
if (s1 === peg$FAILED) { | ||
s1 = peg$c9; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseoptionalFormatPattern(); | ||
if (s4 !== peg$FAILED) { | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
s4 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s3 = peg$c2; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c37(s1, s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parsews() { | ||
@@ -972,3 +1063,3 @@ var s0, s1; | ||
s0 = []; | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -978,3 +1069,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -984,3 +1075,3 @@ if (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -990,3 +1081,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -1000,3 +1091,3 @@ } | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
} | ||
@@ -1025,3 +1116,3 @@ | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
} | ||
@@ -1035,3 +1126,3 @@ | ||
if (peg$c38.test(input.charAt(peg$currPos))) { | ||
if (peg$c42.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1041,3 +1132,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
} | ||
@@ -1051,3 +1142,3 @@ | ||
if (peg$c40.test(input.charAt(peg$currPos))) { | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1057,3 +1148,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
@@ -1069,7 +1160,7 @@ | ||
if (input.charCodeAt(peg$currPos) === 48) { | ||
s1 = peg$c42; | ||
s1 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
@@ -1079,3 +1170,3 @@ if (s1 === peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
if (peg$c48.test(input.charAt(peg$currPos))) { | ||
s3 = input.charAt(peg$currPos); | ||
@@ -1085,3 +1176,3 @@ peg$currPos++; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1113,3 +1204,3 @@ if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c50(s1); | ||
} | ||
@@ -1124,3 +1215,3 @@ s0 = s1; | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
if (peg$c51.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1130,16 +1221,16 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c49) { | ||
s1 = peg$c49; | ||
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$c50); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c51(); | ||
s1 = peg$c55(); | ||
} | ||
@@ -1149,12 +1240,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c52) { | ||
s1 = peg$c52; | ||
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$c53); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c54(); | ||
s1 = peg$c58(); | ||
} | ||
@@ -1164,12 +1255,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c55) { | ||
s1 = peg$c55; | ||
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$c56); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c57(); | ||
s1 = peg$c61(); | ||
} | ||
@@ -1179,8 +1270,8 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c58) { | ||
s1 = peg$c58; | ||
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$c59); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c63); } | ||
} | ||
@@ -1222,3 +1313,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c60(s2); | ||
s1 = peg$c64(s2); | ||
s0 = s1; | ||
@@ -1257,3 +1348,3 @@ } else { | ||
peg$reportedPos = s0; | ||
s1 = peg$c61(s1); | ||
s1 = peg$c65(s1); | ||
} | ||
@@ -1260,0 +1351,0 @@ s0 = s1; |
@@ -95,20 +95,31 @@ "use strict"; | ||
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" }, | ||
peg$c24 = function(offset, options) { | ||
peg$c24 = function(pluralStyle) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset || 0, | ||
options: options | ||
type : pluralStyle.type, | ||
ordinal: false, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
}; | ||
}, | ||
peg$c25 = "selectordinal", | ||
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" }, | ||
peg$c27 = function(pluralStyle) { | ||
return { | ||
type : pluralStyle.type, | ||
ordinal: true, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
} | ||
}, | ||
peg$c25 = "select", | ||
peg$c26 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c27 = function(options) { | ||
peg$c28 = "select", | ||
peg$c29 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c30 = function(options) { | ||
return { | ||
type : 'selectFormat', | ||
options: options | ||
} | ||
}; | ||
}, | ||
peg$c28 = "=", | ||
peg$c29 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c30 = function(selector, pattern) { | ||
peg$c31 = "=", | ||
peg$c32 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c33 = function(selector, pattern) { | ||
return { | ||
@@ -120,39 +131,46 @@ type : 'optionalFormatPattern', | ||
}, | ||
peg$c31 = "offset:", | ||
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c33 = function(number) { | ||
peg$c34 = "offset:", | ||
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c36 = function(number) { | ||
return number; | ||
}, | ||
peg$c34 = { type: "other", description: "whitespace" }, | ||
peg$c35 = /^[ \t\n\r]/, | ||
peg$c36 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, | ||
peg$c37 = { type: "other", description: "optionalWhitespace" }, | ||
peg$c38 = /^[0-9]/, | ||
peg$c39 = { type: "class", value: "[0-9]", description: "[0-9]" }, | ||
peg$c40 = /^[0-9a-f]/i, | ||
peg$c41 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, | ||
peg$c42 = "0", | ||
peg$c43 = { type: "literal", value: "0", description: "\"0\"" }, | ||
peg$c44 = /^[1-9]/, | ||
peg$c45 = { type: "class", value: "[1-9]", description: "[1-9]" }, | ||
peg$c46 = function(digits) { | ||
peg$c37 = function(offset, options) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset, | ||
options: options | ||
}; | ||
}, | ||
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) { | ||
return parseInt(digits, 10); | ||
}, | ||
peg$c47 = /^[^{}\\\0-\x1F \t\n\r]/, | ||
peg$c48 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" }, | ||
peg$c49 = "\\#", | ||
peg$c50 = { type: "literal", value: "\\#", description: "\"\\\\#\"" }, | ||
peg$c51 = function() { return '\\#'; }, | ||
peg$c52 = "\\{", | ||
peg$c53 = { type: "literal", value: "\\{", description: "\"\\\\{\"" }, | ||
peg$c54 = function() { return '\u007B'; }, | ||
peg$c55 = "\\}", | ||
peg$c56 = { type: "literal", value: "\\}", description: "\"\\\\}\"" }, | ||
peg$c57 = function() { return '\u007D'; }, | ||
peg$c58 = "\\u", | ||
peg$c59 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, | ||
peg$c60 = function(digits) { | ||
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 '\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$c61 = function(chars) { return chars.join(''); }, | ||
peg$c65 = function(chars) { return chars.join(''); }, | ||
@@ -586,3 +604,6 @@ peg$currPos = 0, | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
s0 = peg$parseselectOrdinalFormat(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
} | ||
} | ||
@@ -677,3 +698,3 @@ } | ||
function peg$parsepluralFormat() { | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
var s0, s1, s2, s3, s4, s5; | ||
@@ -701,31 +722,60 @@ s0 = peg$currPos; | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseoffset(); | ||
if (s5 === peg$FAILED) { | ||
s5 = peg$c9; | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parseselectOrdinalFormat() { | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 13) === peg$c25) { | ||
s1 = peg$c25; | ||
peg$currPos += 13; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s3 = peg$c10; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parse_(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parse_(); | ||
if (s6 !== peg$FAILED) { | ||
s7 = []; | ||
s8 = peg$parseoptionalFormatPattern(); | ||
if (s8 !== peg$FAILED) { | ||
while (s8 !== peg$FAILED) { | ||
s7.push(s8); | ||
s8 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s7 = peg$c2; | ||
} | ||
if (s7 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5, s7); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s0 = s1; | ||
} else { | ||
@@ -759,8 +809,8 @@ peg$currPos = s0; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 6) === peg$c25) { | ||
s1 = peg$c25; | ||
if (input.substr(peg$currPos, 6) === peg$c28) { | ||
s1 = peg$c28; | ||
peg$currPos += 6; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
} | ||
@@ -792,3 +842,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s1 = peg$c30(s5); | ||
s0 = s1; | ||
@@ -825,7 +875,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 61) { | ||
s2 = peg$c28; | ||
s2 = peg$c31; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
@@ -889,3 +939,3 @@ if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c30(s2, s6); | ||
s1 = peg$c33(s2, s6); | ||
s0 = s1; | ||
@@ -932,8 +982,8 @@ } else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7) === peg$c31) { | ||
s1 = peg$c31; | ||
if (input.substr(peg$currPos, 7) === peg$c34) { | ||
s1 = peg$c34; | ||
peg$currPos += 7; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
@@ -946,3 +996,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c33(s3); | ||
s1 = peg$c36(s3); | ||
s0 = s1; | ||
@@ -965,2 +1015,43 @@ } else { | ||
function peg$parsepluralStyle() { | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = peg$parseoffset(); | ||
if (s1 === peg$FAILED) { | ||
s1 = peg$c9; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseoptionalFormatPattern(); | ||
if (s4 !== peg$FAILED) { | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
s4 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s3 = peg$c2; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c37(s1, s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parsews() { | ||
@@ -971,3 +1062,3 @@ var s0, s1; | ||
s0 = []; | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -977,3 +1068,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -983,3 +1074,3 @@ if (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -989,3 +1080,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -999,3 +1090,3 @@ } | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
} | ||
@@ -1024,3 +1115,3 @@ | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
} | ||
@@ -1034,3 +1125,3 @@ | ||
if (peg$c38.test(input.charAt(peg$currPos))) { | ||
if (peg$c42.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1040,3 +1131,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
} | ||
@@ -1050,3 +1141,3 @@ | ||
if (peg$c40.test(input.charAt(peg$currPos))) { | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1056,3 +1147,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
@@ -1068,7 +1159,7 @@ | ||
if (input.charCodeAt(peg$currPos) === 48) { | ||
s1 = peg$c42; | ||
s1 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
@@ -1078,3 +1169,3 @@ if (s1 === peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
if (peg$c48.test(input.charAt(peg$currPos))) { | ||
s3 = input.charAt(peg$currPos); | ||
@@ -1084,3 +1175,3 @@ peg$currPos++; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1112,3 +1203,3 @@ if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c50(s1); | ||
} | ||
@@ -1123,3 +1214,3 @@ s0 = s1; | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
if (peg$c51.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1129,16 +1220,16 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c49) { | ||
s1 = peg$c49; | ||
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$c50); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c51(); | ||
s1 = peg$c55(); | ||
} | ||
@@ -1148,12 +1239,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c52) { | ||
s1 = peg$c52; | ||
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$c53); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c54(); | ||
s1 = peg$c58(); | ||
} | ||
@@ -1163,12 +1254,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c55) { | ||
s1 = peg$c55; | ||
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$c56); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c57(); | ||
s1 = peg$c61(); | ||
} | ||
@@ -1178,8 +1269,8 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c58) { | ||
s1 = peg$c58; | ||
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$c59); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c63); } | ||
} | ||
@@ -1221,3 +1312,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c60(s2); | ||
s1 = peg$c64(s2); | ||
s0 = s1; | ||
@@ -1256,3 +1347,3 @@ } else { | ||
peg$reportedPos = s0; | ||
s1 = peg$c61(s1); | ||
s1 = peg$c65(s1); | ||
} | ||
@@ -1259,0 +1350,0 @@ s0 = s1; |
{ | ||
"name": "intl-messageformat-parser", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Parses ICU Message strings into an AST via JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -93,20 +93,31 @@ export default (function() { | ||
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" }, | ||
peg$c24 = function(offset, options) { | ||
peg$c24 = function(pluralStyle) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset || 0, | ||
options: options | ||
type : pluralStyle.type, | ||
ordinal: false, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
}; | ||
}, | ||
peg$c25 = "selectordinal", | ||
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" }, | ||
peg$c27 = function(pluralStyle) { | ||
return { | ||
type : pluralStyle.type, | ||
ordinal: true, | ||
offset : pluralStyle.offset || 0, | ||
options: pluralStyle.options | ||
} | ||
}, | ||
peg$c25 = "select", | ||
peg$c26 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c27 = function(options) { | ||
peg$c28 = "select", | ||
peg$c29 = { type: "literal", value: "select", description: "\"select\"" }, | ||
peg$c30 = function(options) { | ||
return { | ||
type : 'selectFormat', | ||
options: options | ||
} | ||
}; | ||
}, | ||
peg$c28 = "=", | ||
peg$c29 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c30 = function(selector, pattern) { | ||
peg$c31 = "=", | ||
peg$c32 = { type: "literal", value: "=", description: "\"=\"" }, | ||
peg$c33 = function(selector, pattern) { | ||
return { | ||
@@ -118,39 +129,46 @@ type : 'optionalFormatPattern', | ||
}, | ||
peg$c31 = "offset:", | ||
peg$c32 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c33 = function(number) { | ||
peg$c34 = "offset:", | ||
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" }, | ||
peg$c36 = function(number) { | ||
return number; | ||
}, | ||
peg$c34 = { type: "other", description: "whitespace" }, | ||
peg$c35 = /^[ \t\n\r]/, | ||
peg$c36 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, | ||
peg$c37 = { type: "other", description: "optionalWhitespace" }, | ||
peg$c38 = /^[0-9]/, | ||
peg$c39 = { type: "class", value: "[0-9]", description: "[0-9]" }, | ||
peg$c40 = /^[0-9a-f]/i, | ||
peg$c41 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, | ||
peg$c42 = "0", | ||
peg$c43 = { type: "literal", value: "0", description: "\"0\"" }, | ||
peg$c44 = /^[1-9]/, | ||
peg$c45 = { type: "class", value: "[1-9]", description: "[1-9]" }, | ||
peg$c46 = function(digits) { | ||
peg$c37 = function(offset, options) { | ||
return { | ||
type : 'pluralFormat', | ||
offset : offset, | ||
options: options | ||
}; | ||
}, | ||
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) { | ||
return parseInt(digits, 10); | ||
}, | ||
peg$c47 = /^[^{}\\\0-\x1F \t\n\r]/, | ||
peg$c48 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" }, | ||
peg$c49 = "\\#", | ||
peg$c50 = { type: "literal", value: "\\#", description: "\"\\\\#\"" }, | ||
peg$c51 = function() { return '\\#'; }, | ||
peg$c52 = "\\{", | ||
peg$c53 = { type: "literal", value: "\\{", description: "\"\\\\{\"" }, | ||
peg$c54 = function() { return '\u007B'; }, | ||
peg$c55 = "\\}", | ||
peg$c56 = { type: "literal", value: "\\}", description: "\"\\\\}\"" }, | ||
peg$c57 = function() { return '\u007D'; }, | ||
peg$c58 = "\\u", | ||
peg$c59 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, | ||
peg$c60 = function(digits) { | ||
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 '\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$c61 = function(chars) { return chars.join(''); }, | ||
peg$c65 = function(chars) { return chars.join(''); }, | ||
@@ -584,3 +602,6 @@ peg$currPos = 0, | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
s0 = peg$parseselectOrdinalFormat(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseselectFormat(); | ||
} | ||
} | ||
@@ -675,3 +696,3 @@ } | ||
function peg$parsepluralFormat() { | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
var s0, s1, s2, s3, s4, s5; | ||
@@ -699,31 +720,60 @@ s0 = peg$currPos; | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseoffset(); | ||
if (s5 === peg$FAILED) { | ||
s5 = peg$c9; | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parseselectOrdinalFormat() { | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 13) === peg$c25) { | ||
s1 = peg$c25; | ||
peg$currPos += 13; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s3 = peg$c10; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parse_(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parsepluralStyle(); | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parse_(); | ||
if (s6 !== peg$FAILED) { | ||
s7 = []; | ||
s8 = peg$parseoptionalFormatPattern(); | ||
if (s8 !== peg$FAILED) { | ||
while (s8 !== peg$FAILED) { | ||
s7.push(s8); | ||
s8 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s7 = peg$c2; | ||
} | ||
if (s7 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s5, s7); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s0 = s1; | ||
} else { | ||
@@ -757,8 +807,8 @@ peg$currPos = s0; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 6) === peg$c25) { | ||
s1 = peg$c25; | ||
if (input.substr(peg$currPos, 6) === peg$c28) { | ||
s1 = peg$c28; | ||
peg$currPos += 6; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
} | ||
@@ -790,3 +840,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c27(s5); | ||
s1 = peg$c30(s5); | ||
s0 = s1; | ||
@@ -823,7 +873,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 61) { | ||
s2 = peg$c28; | ||
s2 = peg$c31; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
@@ -887,3 +937,3 @@ if (s2 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c30(s2, s6); | ||
s1 = peg$c33(s2, s6); | ||
s0 = s1; | ||
@@ -930,8 +980,8 @@ } else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7) === peg$c31) { | ||
s1 = peg$c31; | ||
if (input.substr(peg$currPos, 7) === peg$c34) { | ||
s1 = peg$c34; | ||
peg$currPos += 7; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
@@ -944,3 +994,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c33(s3); | ||
s1 = peg$c36(s3); | ||
s0 = s1; | ||
@@ -963,2 +1013,43 @@ } else { | ||
function peg$parsepluralStyle() { | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = peg$parseoffset(); | ||
if (s1 === peg$FAILED) { | ||
s1 = peg$c9; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parse_(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseoptionalFormatPattern(); | ||
if (s4 !== peg$FAILED) { | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
s4 = peg$parseoptionalFormatPattern(); | ||
} | ||
} else { | ||
s3 = peg$c2; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c37(s1, s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$c2; | ||
} | ||
return s0; | ||
} | ||
function peg$parsews() { | ||
@@ -969,3 +1060,3 @@ var s0, s1; | ||
s0 = []; | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -975,3 +1066,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -981,3 +1072,3 @@ if (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c35.test(input.charAt(peg$currPos))) { | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -987,3 +1078,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
@@ -997,3 +1088,3 @@ } | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
} | ||
@@ -1022,3 +1113,3 @@ | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
} | ||
@@ -1032,3 +1123,3 @@ | ||
if (peg$c38.test(input.charAt(peg$currPos))) { | ||
if (peg$c42.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1038,3 +1129,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
} | ||
@@ -1048,3 +1139,3 @@ | ||
if (peg$c40.test(input.charAt(peg$currPos))) { | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1054,3 +1145,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
@@ -1066,7 +1157,7 @@ | ||
if (input.charCodeAt(peg$currPos) === 48) { | ||
s1 = peg$c42; | ||
s1 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
@@ -1076,3 +1167,3 @@ if (s1 === peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (peg$c44.test(input.charAt(peg$currPos))) { | ||
if (peg$c48.test(input.charAt(peg$currPos))) { | ||
s3 = input.charAt(peg$currPos); | ||
@@ -1082,3 +1173,3 @@ peg$currPos++; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1110,3 +1201,3 @@ if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c50(s1); | ||
} | ||
@@ -1121,3 +1212,3 @@ s0 = s1; | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
if (peg$c51.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1127,16 +1218,16 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c49) { | ||
s1 = peg$c49; | ||
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$c50); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c51(); | ||
s1 = peg$c55(); | ||
} | ||
@@ -1146,12 +1237,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c52) { | ||
s1 = peg$c52; | ||
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$c53); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c54(); | ||
s1 = peg$c58(); | ||
} | ||
@@ -1161,12 +1252,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c55) { | ||
s1 = peg$c55; | ||
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$c56); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c57(); | ||
s1 = peg$c61(); | ||
} | ||
@@ -1176,8 +1267,8 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c58) { | ||
s1 = peg$c58; | ||
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$c59); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c63); } | ||
} | ||
@@ -1219,3 +1310,3 @@ if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c60(s2); | ||
s1 = peg$c64(s2); | ||
s0 = s1; | ||
@@ -1254,3 +1345,3 @@ } else { | ||
peg$reportedPos = s0; | ||
s1 = peg$c61(s1); | ||
s1 = peg$c65(s1); | ||
} | ||
@@ -1257,0 +1348,0 @@ s0 = s1; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268332
3676