messageformat-parser
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "messageformat-parser", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A PEG.js parser for ICU MessageFormat strings -- part of messageformat.js", | ||
@@ -13,2 +13,3 @@ "keywords": [ | ||
"Eemeli Aro <eemeli@gmail.com>", | ||
"Nikola Kovacs <nikola.kovacs@gmail.com>", | ||
"Adrian Vogelsgesang <adrian.vogelsgesang@tum.de>" | ||
@@ -15,0 +16,0 @@ ], |
535
parser.js
@@ -210,28 +210,47 @@ /* | ||
peg$c32 = peg$literalExpectation("=", false), | ||
peg$c33 = function(p) { return p; }, | ||
peg$c34 = /^[^{}#\\\0-\x08\x0E-\x1F\x7F]/, | ||
peg$c35 = peg$classExpectation(["{", "}", "#", "\\", ["\0", "\b"], ["\x0E", "\x1F"], "\x7F"], true, false), | ||
peg$c36 = "\\\\", | ||
peg$c37 = peg$literalExpectation("\\\\", false), | ||
peg$c38 = function() { return '\\'; }, | ||
peg$c39 = "\\#", | ||
peg$c40 = peg$literalExpectation("\\#", false), | ||
peg$c41 = function() { return '#'; }, | ||
peg$c42 = "\\{", | ||
peg$c43 = peg$literalExpectation("\\{", false), | ||
peg$c44 = function() { return '\u007B'; }, | ||
peg$c45 = "\\}", | ||
peg$c46 = peg$literalExpectation("\\}", false), | ||
peg$c47 = function() { return '\u007D'; }, | ||
peg$c48 = "\\u", | ||
peg$c49 = peg$literalExpectation("\\u", false), | ||
peg$c50 = function(h1, h2, h3, h4) { | ||
peg$c33 = function(p) { return options.strictFunctionParams; }, | ||
peg$c34 = function(p) { return p; }, | ||
peg$c35 = function(p) { return p.replace(/^[ \t\n\r]*|[ \t\n\r]*$/g, ''); }, | ||
peg$c36 = "''", | ||
peg$c37 = peg$literalExpectation("''", false), | ||
peg$c38 = function() { return "'"; }, | ||
peg$c39 = /^[^']/, | ||
peg$c40 = peg$classExpectation(["'"], true, false), | ||
peg$c41 = "'{", | ||
peg$c42 = peg$literalExpectation("'{", false), | ||
peg$c43 = "'", | ||
peg$c44 = peg$literalExpectation("'", false), | ||
peg$c45 = function(str) { return '\u007B'+str.join(''); }, | ||
peg$c46 = "'}", | ||
peg$c47 = peg$literalExpectation("'}", false), | ||
peg$c48 = function(str) { return '\u007D'+str.join(''); }, | ||
peg$c49 = /^[^{}#\\\0-\x08\x0E-\x1F\x7F]/, | ||
peg$c50 = peg$classExpectation(["{", "}", "#", "\\", ["\0", "\b"], ["\x0E", "\x1F"], "\x7F"], true, false), | ||
peg$c51 = "\\\\", | ||
peg$c52 = peg$literalExpectation("\\\\", false), | ||
peg$c53 = function() { return '\\'; }, | ||
peg$c54 = "\\#", | ||
peg$c55 = peg$literalExpectation("\\#", false), | ||
peg$c56 = function() { return '#'; }, | ||
peg$c57 = "\\{", | ||
peg$c58 = peg$literalExpectation("\\{", false), | ||
peg$c59 = function() { return '\u007B'; }, | ||
peg$c60 = "\\}", | ||
peg$c61 = peg$literalExpectation("\\}", false), | ||
peg$c62 = function() { return '\u007D'; }, | ||
peg$c63 = "\\u", | ||
peg$c64 = peg$literalExpectation("\\u", false), | ||
peg$c65 = function(h1, h2, h3, h4) { | ||
return String.fromCharCode(parseInt('0x' + h1 + h2 + h3 + h4)); | ||
}, | ||
peg$c51 = /^[0-9]/, | ||
peg$c52 = peg$classExpectation([["0", "9"]], false, false), | ||
peg$c53 = /^[0-9a-fA-F]/, | ||
peg$c54 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), | ||
peg$c55 = /^[ \t\n\r]/, | ||
peg$c56 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), | ||
peg$c66 = /^[^',}]/, | ||
peg$c67 = peg$classExpectation(["'", ",", "}"], true, false), | ||
peg$c68 = /^[^'}]/, | ||
peg$c69 = peg$classExpectation(["'", "}"], true, false), | ||
peg$c70 = /^[0-9]/, | ||
peg$c71 = peg$classExpectation([["0", "9"]], false, false), | ||
peg$c72 = /^[0-9a-fA-F]/, | ||
peg$c73 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), | ||
peg$c74 = /^[ \t\n\r]/, | ||
peg$c75 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), | ||
@@ -796,8 +815,3 @@ peg$currPos = 0, | ||
if (s8 !== peg$FAILED) { | ||
s9 = []; | ||
s10 = peg$parsefunctionParams(); | ||
while (s10 !== peg$FAILED) { | ||
s9.push(s10); | ||
s10 = peg$parsefunctionParams(); | ||
} | ||
s9 = peg$parsefunctionParams(); | ||
if (s9 !== peg$FAILED) { | ||
@@ -910,2 +924,48 @@ if (input.charCodeAt(peg$currPos) === 125) { | ||
function peg$parseparamDefault() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseparamcharsDefault(); | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parseparamcharsDefault(); | ||
} | ||
} else { | ||
s1 = peg$FAILED; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c3(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseparamStrict() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseparamcharsStrict(); | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parseparamcharsStrict(); | ||
} | ||
} else { | ||
s1 = peg$FAILED; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c3(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseselectCase() { | ||
@@ -1169,2 +1229,100 @@ var s0, s1, s2, s3, s4; | ||
function peg$parsefunctionParams() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsefunctionParamsDefault(); | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parsefunctionParamsDefault(); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = peg$currPos; | ||
s2 = peg$c33(s1); | ||
if (s2) { | ||
s2 = peg$FAILED; | ||
} else { | ||
s2 = void 0; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c34(s1); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsefunctionParamsStrict(); | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parsefunctionParamsStrict(); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = peg$currPos; | ||
s2 = peg$c33(s1); | ||
if (s2) { | ||
s2 = void 0; | ||
} else { | ||
s2 = peg$FAILED; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c34(s1); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} | ||
return s0; | ||
} | ||
function peg$parsefunctionParamsStrict() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
s1 = peg$parse_(); | ||
if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s2 = peg$c9; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseparamStrict(); | ||
if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c34(s3); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
return s0; | ||
} | ||
function peg$parsefunctionParamsDefault() { | ||
var s0, s1, s2, s3, s4, s5; | ||
@@ -1185,3 +1343,3 @@ | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseid(); | ||
s4 = peg$parseparamDefault(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -1191,3 +1349,3 @@ s5 = peg$parse_(); | ||
peg$savedPos = s0; | ||
s1 = peg$c33(s4); | ||
s1 = peg$c35(s4); | ||
s0 = s1; | ||
@@ -1218,6 +1376,168 @@ } else { | ||
function peg$parsedoubleapos() { | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c36) { | ||
s1 = peg$c36; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c38(); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseinapos() { | ||
var s0, s1, s2; | ||
s0 = peg$parsedoubleapos(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c39.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
} | ||
} else { | ||
s1 = peg$FAILED; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c3(s1); | ||
} | ||
s0 = s1; | ||
} | ||
return s0; | ||
} | ||
function peg$parsequotedCurly() { | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c41) { | ||
s1 = peg$c41; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseinapos(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parseinapos(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s3 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c45(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c46) { | ||
s1 = peg$c46; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseinapos(); | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parseinapos(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s3 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c48(s2); | ||
s0 = s1; | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} else { | ||
peg$currPos = s0; | ||
s0 = peg$FAILED; | ||
} | ||
} | ||
return s0; | ||
} | ||
function peg$parsequotedFunctionParams() { | ||
var s0; | ||
s0 = peg$parsequotedCurly(); | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
s0 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
} | ||
return s0; | ||
} | ||
function peg$parsechar() { | ||
var s0, s1, s2, s3, s4, s5; | ||
if (peg$c34.test(input.charAt(peg$currPos))) { | ||
if (peg$c49.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1227,16 +1547,16 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c50); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c36) { | ||
s1 = peg$c36; | ||
if (input.substr(peg$currPos, 2) === peg$c51) { | ||
s1 = peg$c51; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c38(); | ||
s1 = peg$c53(); | ||
} | ||
@@ -1246,12 +1566,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c39) { | ||
s1 = peg$c39; | ||
if (input.substr(peg$currPos, 2) === peg$c54) { | ||
s1 = peg$c54; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c41(); | ||
s1 = peg$c56(); | ||
} | ||
@@ -1261,12 +1581,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c42) { | ||
s1 = peg$c42; | ||
if (input.substr(peg$currPos, 2) === peg$c57) { | ||
s1 = peg$c57; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c58); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c44(); | ||
s1 = peg$c59(); | ||
} | ||
@@ -1276,12 +1596,12 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c45) { | ||
s1 = peg$c45; | ||
if (input.substr(peg$currPos, 2) === peg$c60) { | ||
s1 = peg$c60; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c46); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c61); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c47(); | ||
s1 = peg$c62(); | ||
} | ||
@@ -1291,8 +1611,8 @@ s0 = s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c48) { | ||
s1 = peg$c48; | ||
if (input.substr(peg$currPos, 2) === peg$c63) { | ||
s1 = peg$c63; | ||
peg$currPos += 2; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c64); } | ||
} | ||
@@ -1309,3 +1629,3 @@ if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c50(s2, s3, s4, s5); | ||
s1 = peg$c65(s2, s3, s4, s5); | ||
s0 = s1; | ||
@@ -1341,2 +1661,89 @@ } else { | ||
function peg$parseparamcharsCommon() { | ||
var s0; | ||
s0 = peg$parsedoubleapos(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsequotedFunctionParams(); | ||
} | ||
return s0; | ||
} | ||
function peg$parseparamcharsDefault() { | ||
var s0, s1, s2; | ||
s0 = peg$parseparamcharsCommon(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c66.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c67); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c66.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c67); } | ||
} | ||
} | ||
} else { | ||
s1 = peg$FAILED; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c3(s1); | ||
} | ||
s0 = s1; | ||
} | ||
return s0; | ||
} | ||
function peg$parseparamcharsStrict() { | ||
var s0, s1, s2; | ||
s0 = peg$parseparamcharsCommon(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c68.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c69); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c68.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c69); } | ||
} | ||
} | ||
} else { | ||
s1 = peg$FAILED; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c3(s1); | ||
} | ||
s0 = s1; | ||
} | ||
return s0; | ||
} | ||
function peg$parsedigits() { | ||
@@ -1347,3 +1754,3 @@ var s0, s1, s2; | ||
s1 = []; | ||
if (peg$c51.test(input.charAt(peg$currPos))) { | ||
if (peg$c70.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1353,3 +1760,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c71); } | ||
} | ||
@@ -1359,3 +1766,3 @@ if (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c51.test(input.charAt(peg$currPos))) { | ||
if (peg$c70.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1365,3 +1772,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c71); } | ||
} | ||
@@ -1384,3 +1791,3 @@ } | ||
if (peg$c53.test(input.charAt(peg$currPos))) { | ||
if (peg$c72.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1390,3 +1797,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c73); } | ||
} | ||
@@ -1402,3 +1809,3 @@ | ||
s1 = []; | ||
if (peg$c55.test(input.charAt(peg$currPos))) { | ||
if (peg$c74.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1408,7 +1815,7 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c75); } | ||
} | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c55.test(input.charAt(peg$currPos))) { | ||
if (peg$c74.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1418,3 +1825,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c75); } | ||
} | ||
@@ -1421,0 +1828,0 @@ } |
@@ -7,9 +7,17 @@ # messageformat-parser <a href="http://travis-ci.org/messageformat/parser"><img align="right" alt="Build Status" src="https://secure.travis-ci.org/messageformat/parser.png"></a> | ||
The generated parser function takes two parameters, first the string to be | ||
parsed, and a second optional parameter `options`, an object containing arrays | ||
of keywords for `cardinal` and `ordinal` rules for the current locale – these | ||
are used to validate plural and selectordinal keys. If `options` or its fields | ||
are missing or set to false, the full set of valid [Unicode CLDR] keys is used: | ||
`'zero', 'one', 'two', 'few', 'many', 'other'`. To disable this check, pass in | ||
an empty array. | ||
parsed, and a second optional parameter `options`, an object with the following | ||
possible keys: | ||
- `cardinal` and `ordinal` – Arrays of valid plural categories for the current | ||
locale, used to validate plural and selectordinal keys. If these are missing | ||
or set to false, the full set of valid [Unicode CLDR] keys is used: `'zero', | ||
'one', 'two', 'few', 'many', 'other'`. To disable this check, pass in an empty | ||
array. | ||
- `strictFunctionParams` – By default, function parameters are split on commas | ||
and trimmed, so the parameters in `{x,fn, a, b }` are parsed as | ||
`['a','b']`. Setting `strictFunctionParams` to true will make the parser | ||
follow the ICU MessageFormat spec more closely, and result in a params array | ||
with a single element: `[' a, b ']`. | ||
[ICU MessageFormat]: https://messageformat.github.io/guide/ | ||
@@ -84,1 +92,6 @@ [messageformat.js]: https://messageformat.github.io/ | ||
``` | ||
#### Contributor License Agreement | ||
See the [messageformat.js README][CLA] for details. | ||
[CLA]: https://github.com/messageformat/messageformat.js#contributor-license-agreement |
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
57960
1692
96