Socket
Socket
Sign inDemoInstall

messageformat-parser

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

messageformat-parser - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

CHANGELOG.md

56

codemod-fix-backslash-escapes.js

@@ -24,35 +24,37 @@ /**

let doubleSingleQuotes = false
let doubleSingleQuotes = false;
const fixEscapes = (node) => {
if (node.type !== 'Literal' || typeof node.value !== 'string') return
if (doubleSingleQuotes) node.value = node.value.replace(/''+/g, '$&$&')
node.value = node.value.replace(/('*)\\([#{}\\]|u[0-9a-f]{4})('*)/g, (_, start, char, end) => {
switch (char[0]) {
case 'u':
const code = parseInt(char.slice(1), 16)
return start + String.fromCharCode(code) + end
case '\\':
return `${start}\\${end}`
default:
// Assume multiple ' are already escaped
if (start === "'") start = "''"
if (end === "'") end = "''"
return `'${start}${char}${end}'`
const fixEscapes = node => {
if (node.type !== 'Literal' || typeof node.value !== 'string') return;
if (doubleSingleQuotes) node.value = node.value.replace(/''+/g, '$&$&');
node.value = node.value.replace(
/('*)\\([#{}\\]|u[0-9a-f]{4})('*)/g,
(_, start, char, end) => {
switch (char[0]) {
case 'u': {
const code = parseInt(char.slice(1), 16);
return start + String.fromCharCode(code) + end;
}
case '\\':
return `${start}\\${end}`;
default:
// Assume multiple ' are already escaped
if (start === "'") start = "''";
if (end === "'") end = "''";
return `'${start}${char}${end}'`;
}
}
})
}
);
};
module.exports = ({ source }, { jscodeshift: j }, options) => {
if (options.doubleSingleQuotes) doubleSingleQuotes = true
const ast = j(source)
if (options.doubleSingleQuotes) doubleSingleQuotes = true;
const ast = j(source);
ast.find(j.Property).forEach(({ value: { value } }) => fixEscapes(value));
ast
.find(j.Property)
.forEach(({ value: { value } }) => fixEscapes(value))
ast
.find(j.ArrayExpression)
.forEach(({ value: { elements }}) => elements.forEach(fixEscapes))
return ast.toSource()
}
.forEach(({ value: { elements } }) => elements.forEach(fixEscapes));
return ast.toSource();
};
module.exports.parser = require('json-estree-ast')
module.exports.parser = require('json-estree-ast');
{
"name": "messageformat-parser",
"version": "4.0.0",
"version": "4.1.0",
"description": "A PEG.js parser for ICU MessageFormat strings",

@@ -18,6 +18,3 @@ "keywords": [

"homepage": "https://messageformat.github.io/",
"repository": {
"type": "git",
"url": "https://github.com/messageformat/parser.git"
},
"repository": "messageformat/messageformat",
"main": "parser.js",

@@ -28,12 +25,32 @@ "files": [

],
"eslintConfig": {
"env": {
"commonjs": true,
"es6": true
},
"overrides": [
{
"files": [
"test.js"
],
"env": {
"mocha": true
},
"rules": {
"no-unused-vars": 0
}
}
]
},
"devDependencies": {
"expect.js": "^0.3.1",
"mocha": "^4.1.0",
"mocha": "^5.2.0",
"pegjs": "^0.10.0"
},
"scripts": {
"prepare": "pegjs parser.pegjs",
"build": "pegjs parser.pegjs",
"prepublishOnly": "npm test",
"test": "mocha"
}
},
"gitHead": "7594c61df39236cfa19268ae28a87099034fe5ea"
}

@@ -146,3 +146,3 @@ /*

peg$c1 = peg$literalExpectation("#", false),
peg$c2 = function() { return inPlural; },
peg$c2 = function() { return inPlural[0]; },
peg$c3 = function() { return { type: 'octothorpe' }; },

@@ -164,4 +164,5 @@ peg$c4 = function(str) { return str.join(''); },

peg$c13 = peg$literalExpectation("select", false),
peg$c14 = function(arg, m) { if (options.strict) { inPlural = false; } return m; },
peg$c14 = function(arg, m) { if (options.strict) { inPlural.unshift(false); } return m; },
peg$c15 = function(arg, cases) {
if (options.strict) inPlural.shift()
return {

@@ -177,3 +178,3 @@ type: 'select',

peg$c19 = peg$literalExpectation("selectordinal", false),
peg$c20 = function(arg, m) { inPlural = true; return m; },
peg$c20 = function(arg, m) { inPlural.unshift(true); return m; },
peg$c21 = function(arg, type, offset, cases) {

@@ -188,3 +189,3 @@ var ls = ((type === 'selectordinal') ? options.ordinal : options.cardinal)

});
inPlural = false;
inPlural.shift()
return {

@@ -205,60 +206,68 @@ type: type,

},
peg$c23 = /^[^\t-\r \x85\u200E\u200F\u2028\u2029!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,
peg$c24 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029", ["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], true, false),
peg$c25 = function(key, tokens) { return { key: key, tokens: tokens }; },
peg$c26 = function(tokens) { return tokens; },
peg$c27 = "offset",
peg$c28 = peg$literalExpectation("offset", false),
peg$c29 = ":",
peg$c30 = peg$literalExpectation(":", false),
peg$c31 = function(d) { return d; },
peg$c32 = "=",
peg$c33 = peg$literalExpectation("=", false),
peg$c34 = "number",
peg$c35 = peg$literalExpectation("number", false),
peg$c36 = "date",
peg$c37 = peg$literalExpectation("date", false),
peg$c38 = "time",
peg$c39 = peg$literalExpectation("time", false),
peg$c40 = "spellout",
peg$c41 = peg$literalExpectation("spellout", false),
peg$c42 = "ordinal",
peg$c43 = peg$literalExpectation("ordinal", false),
peg$c44 = "duration",
peg$c45 = peg$literalExpectation("duration", false),
peg$c46 = function(key) { return !options.strict && key.toLowerCase() === key && !/^\d/.test(key) },
peg$c47 = function(key) { return key },
peg$c48 = function(tokens) { return !options.strict },
peg$c49 = function(tokens) { return { tokens: tokens } },
peg$c50 = function(parts) { return { tokens: [parts.join('')] } },
peg$c51 = /^[^'{}]/,
peg$c52 = peg$classExpectation(["'", "{", "}"], true, false),
peg$c53 = function(p) { return p.join('') },
peg$c54 = "'",
peg$c55 = peg$literalExpectation("'", false),
peg$c56 = function(quoted) { return quoted },
peg$c57 = function(p) { return '{' + p.join('') + '}' },
peg$c58 = "''",
peg$c59 = peg$literalExpectation("''", false),
peg$c60 = function() { return "'"; },
peg$c61 = /^[^']/,
peg$c62 = peg$classExpectation(["'"], true, false),
peg$c63 = "'{",
peg$c64 = peg$literalExpectation("'{", false),
peg$c65 = function(str) { return '\u007B'+str.join(''); },
peg$c66 = "'}",
peg$c67 = peg$literalExpectation("'}", false),
peg$c68 = function(str) { return '\u007D'+str.join(''); },
peg$c69 = "'#",
peg$c70 = peg$literalExpectation("'#", false),
peg$c71 = function(str) { return "#"+str.join(''); },
peg$c72 = function(quotedOcto) { return quotedOcto[0]; },
peg$c73 = function(octo) { return !inPlural; },
peg$c74 = function(octo) { return octo; },
peg$c75 = /^[^{}#\0-\x08\x0E-\x1F\x7F]/,
peg$c76 = peg$classExpectation(["{", "}", "#", ["\0", "\b"], ["\x0E", "\x1F"], "\x7F"], true, false),
peg$c77 = /^[0-9]/,
peg$c78 = peg$classExpectation([["0", "9"]], false, false),
peg$c79 = /^[\t-\r \x85\u200E\u200F\u2028\u2029]/,
peg$c80 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029"], false, false),
peg$c23 = peg$otherExpectation("identifier"),
peg$c24 = /^[^\t-\r \x85\u200E\u200F\u2028\u2029!-\/:-@[-\^`{-~\xA1-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u2010-\u2027\u2030-\u203E\u2041-\u2053\u2055-\u205E\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3001-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]/,
peg$c25 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029", ["!", "/"], [":", "@"], ["[", "^"], "`", ["{", "~"], ["\xA1", "\xA7"], "\xA9", "\xAB", "\xAC", "\xAE", "\xB0", "\xB1", "\xB6", "\xBB", "\xBF", "\xD7", "\xF7", ["\u2010", "\u2027"], ["\u2030", "\u203E"], ["\u2041", "\u2053"], ["\u2055", "\u205E"], ["\u2190", "\u245F"], ["\u2500", "\u2775"], ["\u2794", "\u2BFF"], ["\u2E00", "\u2E7F"], ["\u3001", "\u3003"], ["\u3008", "\u3020"], "\u3030", "\uFD3E", "\uFD3F", "\uFE45", "\uFE46"], true, false),
peg$c26 = function(key, tokens) { return { key: key, tokens: tokens }; },
peg$c27 = function(tokens) { return tokens; },
peg$c28 = peg$otherExpectation("plural offset"),
peg$c29 = "offset",
peg$c30 = peg$literalExpectation("offset", false),
peg$c31 = ":",
peg$c32 = peg$literalExpectation(":", false),
peg$c33 = function(d) { return d; },
peg$c34 = "=",
peg$c35 = peg$literalExpectation("=", false),
peg$c36 = "number",
peg$c37 = peg$literalExpectation("number", false),
peg$c38 = "date",
peg$c39 = peg$literalExpectation("date", false),
peg$c40 = "time",
peg$c41 = peg$literalExpectation("time", false),
peg$c42 = "spellout",
peg$c43 = peg$literalExpectation("spellout", false),
peg$c44 = "ordinal",
peg$c45 = peg$literalExpectation("ordinal", false),
peg$c46 = "duration",
peg$c47 = peg$literalExpectation("duration", false),
peg$c48 = function(key) { return !options.strict && key.toLowerCase() === key && !/^\d/.test(key) },
peg$c49 = function(key) { return key },
peg$c50 = function(tokens) { return !options.strict },
peg$c51 = function(tokens) { return { tokens: tokens } },
peg$c52 = function(parts) { return { tokens: [parts.join('')] } },
peg$c53 = peg$otherExpectation("a valid (strict) function parameter"),
peg$c54 = /^[^'{}]/,
peg$c55 = peg$classExpectation(["'", "{", "}"], true, false),
peg$c56 = function(p) { return p.join('') },
peg$c57 = "'",
peg$c58 = peg$literalExpectation("'", false),
peg$c59 = function(quoted) { return quoted },
peg$c60 = function(p) { return '{' + p.join('') + '}' },
peg$c61 = peg$otherExpectation("doubled apostrophe"),
peg$c62 = "''",
peg$c63 = peg$literalExpectation("''", false),
peg$c64 = function() { return "'"; },
peg$c65 = /^[^']/,
peg$c66 = peg$classExpectation(["'"], true, false),
peg$c67 = "'{",
peg$c68 = peg$literalExpectation("'{", false),
peg$c69 = function(str) { return '\u007B'+str.join(''); },
peg$c70 = "'}",
peg$c71 = peg$literalExpectation("'}", false),
peg$c72 = function(str) { return '\u007D'+str.join(''); },
peg$c73 = peg$otherExpectation("escaped string"),
peg$c74 = "'#",
peg$c75 = peg$literalExpectation("'#", false),
peg$c76 = function(str) { return "#"+str.join(''); },
peg$c77 = function(quotedOcto) { return quotedOcto[0]; },
peg$c78 = peg$otherExpectation("plain char"),
peg$c79 = /^[^{}#\0-\x08\x0E-\x1F\x7F]/,
peg$c80 = peg$classExpectation(["{", "}", "#", ["\0", "\b"], ["\x0E", "\x1F"], "\x7F"], true, false),
peg$c81 = function(octo) { return !inPlural[0]; },
peg$c82 = function(octo) { return octo; },
peg$c83 = peg$otherExpectation("integer"),
peg$c84 = /^[0-9]/,
peg$c85 = peg$classExpectation([["0", "9"]], false, false),
peg$c86 = peg$otherExpectation("white space"),
peg$c87 = /^[\t-\r \x85\u200E\u200F\u2028\u2029]/,
peg$c88 = peg$classExpectation([["\t", "\r"], " ", "\x85", "\u200E", "\u200F", "\u2028", "\u2029"], false, false),

@@ -913,5 +922,6 @@ peg$currPos = 0,

peg$silentFails++;
s0 = peg$currPos;
s1 = [];
if (peg$c23.test(input.charAt(peg$currPos))) {
if (peg$c24.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -921,3 +931,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}

@@ -927,3 +937,3 @@ if (s2 !== peg$FAILED) {

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

@@ -933,3 +943,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
if (peg$silentFails === 0) { peg$fail(peg$c25); }
}

@@ -945,2 +955,7 @@ }

}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c23); }
}

@@ -963,3 +978,3 @@ return s0;

peg$savedPos = s0;
s1 = peg$c25(s2, s4);
s1 = peg$c26(s2, s4);
s0 = s1;

@@ -999,3 +1014,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c25(s2, s4);
s1 = peg$c26(s2, s4);
s0 = s1;

@@ -1086,3 +1101,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c26(s3);
s1 = peg$c27(s3);
s0 = s1;

@@ -1116,11 +1131,12 @@ } else {

peg$silentFails++;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c27) {
s2 = peg$c27;
if (input.substr(peg$currPos, 6) === peg$c29) {
s2 = peg$c29;
peg$currPos += 6;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
if (peg$silentFails === 0) { peg$fail(peg$c30); }
}

@@ -1131,7 +1147,7 @@ if (s2 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c29;
s4 = peg$c31;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c30); }
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}

@@ -1146,3 +1162,3 @@ if (s4 !== peg$FAILED) {

peg$savedPos = s0;
s1 = peg$c31(s6);
s1 = peg$c33(s6);
s0 = s1;

@@ -1177,2 +1193,7 @@ } else {

}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}

@@ -1189,7 +1210,7 @@ return s0;

if (input.charCodeAt(peg$currPos) === 61) {
s1 = peg$c32;
s1 = peg$c34;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}

@@ -1200,3 +1221,3 @@ if (s1 !== peg$FAILED) {

peg$savedPos = s0;
s1 = peg$c31(s2);
s1 = peg$c33(s2);
s0 = s1;

@@ -1219,48 +1240,48 @@ } else {

if (input.substr(peg$currPos, 6) === peg$c34) {
s0 = peg$c34;
if (input.substr(peg$currPos, 6) === peg$c36) {
s0 = peg$c36;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c36) {
s0 = peg$c36;
if (input.substr(peg$currPos, 4) === peg$c38) {
s0 = peg$c38;
peg$currPos += 4;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
if (peg$silentFails === 0) { peg$fail(peg$c39); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c38) {
s0 = peg$c38;
if (input.substr(peg$currPos, 4) === peg$c40) {
s0 = peg$c40;
peg$currPos += 4;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c39); }
if (peg$silentFails === 0) { peg$fail(peg$c41); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c40) {
s0 = peg$c40;
if (input.substr(peg$currPos, 8) === peg$c42) {
s0 = peg$c42;
peg$currPos += 8;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c41); }
if (peg$silentFails === 0) { peg$fail(peg$c43); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c42) {
s0 = peg$c42;
if (input.substr(peg$currPos, 7) === peg$c44) {
s0 = peg$c44;
peg$currPos += 7;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c45); }
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c44) {
s0 = peg$c44;
if (input.substr(peg$currPos, 8) === peg$c46) {
s0 = peg$c46;
peg$currPos += 8;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c45); }
if (peg$silentFails === 0) { peg$fail(peg$c47); }
}

@@ -1323,3 +1344,3 @@ if (s0 === peg$FAILED) {

peg$savedPos = peg$currPos;
s5 = peg$c46(s4);
s5 = peg$c48(s4);
if (s5) {

@@ -1332,3 +1353,3 @@ s5 = void 0;

peg$savedPos = s0;
s1 = peg$c47(s4);
s1 = peg$c49(s4);
s0 = s1;

@@ -1387,3 +1408,3 @@ } else {

peg$savedPos = peg$currPos;
s4 = peg$c48(s3);
s4 = peg$c50(s3);
if (s4) {

@@ -1396,3 +1417,3 @@ s4 = void 0;

peg$savedPos = s0;
s1 = peg$c49(s3);
s1 = peg$c51(s3);
s0 = s1;

@@ -1435,3 +1456,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c50(s3);
s1 = peg$c52(s3);
s0 = s1;

@@ -1458,5 +1479,6 @@ } else {

peg$silentFails++;
s0 = peg$currPos;
s1 = [];
if (peg$c51.test(input.charAt(peg$currPos))) {
if (peg$c54.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1466,3 +1488,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}

@@ -1472,3 +1494,3 @@ if (s2 !== peg$FAILED) {

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

@@ -1478,3 +1500,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}

@@ -1487,3 +1509,3 @@ }

peg$savedPos = s0;
s1 = peg$c53(s1);
s1 = peg$c56(s1);
}

@@ -1496,7 +1518,7 @@ s0 = s1;

if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c54;
s1 = peg$c57;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}

@@ -1507,11 +1529,11 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c54;
s3 = peg$c57;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c56(s2);
s1 = peg$c59(s2);
s0 = s1;

@@ -1556,3 +1578,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c57(s2);
s1 = peg$c60(s2);
s0 = s1;

@@ -1574,2 +1596,7 @@ } else {

}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c53); }
}

@@ -1582,15 +1609,21 @@ return s0;

peg$silentFails++;
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); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c60();
s1 = peg$c64();
}
s0 = s1;
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}

@@ -1607,3 +1640,3 @@ return s0;

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

@@ -1613,3 +1646,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}

@@ -1619,3 +1652,3 @@ if (s2 !== peg$FAILED) {

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

@@ -1625,3 +1658,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c62); }
if (peg$silentFails === 0) { peg$fail(peg$c66); }
}

@@ -1646,8 +1679,8 @@ }

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

@@ -1663,11 +1696,11 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c54;
s3 = peg$c57;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c65(s2);
s1 = peg$c69(s2);
s0 = s1;

@@ -1688,8 +1721,8 @@ } else {

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

@@ -1705,11 +1738,11 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c54;
s3 = peg$c57;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c68(s2);
s1 = peg$c72(s2);
s0 = s1;

@@ -1736,2 +1769,3 @@ } else {

peg$silentFails++;
s0 = peg$parsequotedCurly();

@@ -1742,8 +1776,8 @@ if (s0 === peg$FAILED) {

s2 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c69) {
s3 = peg$c69;
if (input.substr(peg$currPos, 2) === peg$c74) {
s3 = peg$c74;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c70); }
if (peg$silentFails === 0) { peg$fail(peg$c75); }
}

@@ -1759,11 +1793,11 @@ if (s3 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 39) {
s5 = peg$c54;
s5 = peg$c57;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s5 !== peg$FAILED) {
peg$savedPos = s2;
s3 = peg$c71(s4);
s3 = peg$c76(s4);
s2 = s3;

@@ -1803,3 +1837,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c72(s1);
s1 = peg$c77(s1);
}

@@ -1809,10 +1843,15 @@ s0 = s1;

if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c54;
s0 = peg$c57;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c55); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c73); }
}

@@ -1822,2 +1861,22 @@ return s0;

function peg$parseplainChar() {
var s0, s1;
peg$silentFails++;
if (peg$c79.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c80); }
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c78); }
}
return s0;
}
function peg$parsechar() {

@@ -1840,3 +1899,3 @@ var s0, s1, s2;

peg$savedPos = peg$currPos;
s2 = peg$c73(s1);
s2 = peg$c81(s1);
if (s2) {

@@ -1849,3 +1908,3 @@ s2 = void 0;

peg$savedPos = s0;
s1 = peg$c74(s1);
s1 = peg$c82(s1);
s0 = s1;

@@ -1861,9 +1920,3 @@ } else {

if (s0 === peg$FAILED) {
if (peg$c75.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c76); }
}
s0 = peg$parseplainChar();
}

@@ -1879,5 +1932,6 @@ }

peg$silentFails++;
s0 = peg$currPos;
s1 = [];
if (peg$c77.test(input.charAt(peg$currPos))) {
if (peg$c84.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1887,3 +1941,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c78); }
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}

@@ -1893,3 +1947,3 @@ if (s2 !== peg$FAILED) {

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

@@ -1899,3 +1953,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c78); }
if (peg$silentFails === 0) { peg$fail(peg$c85); }
}

@@ -1911,2 +1965,7 @@ }

}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c83); }
}

@@ -1919,5 +1978,6 @@ return s0;

peg$silentFails++;
s0 = peg$currPos;
s1 = [];
if (peg$c79.test(input.charAt(peg$currPos))) {
if (peg$c87.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1927,7 +1987,7 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c80); }
if (peg$silentFails === 0) { peg$fail(peg$c88); }
}
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c79.test(input.charAt(peg$currPos))) {
if (peg$c87.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);

@@ -1937,3 +1997,3 @@ peg$currPos++;

s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c80); }
if (peg$silentFails === 0) { peg$fail(peg$c88); }
}

@@ -1946,2 +2006,7 @@ }

}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c86); }
}

@@ -1952,3 +2017,3 @@ return s0;

var inPlural = false;
var inPlural = [false];

@@ -1955,0 +2020,0 @@

@@ -1,2 +0,2 @@

# 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>
# 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>

@@ -39,10 +39,9 @@ A [PEG.js] parser for [ICU MessageFormat] strings – part of [messageformat].

[ICU MessageFormat]: https://messageformat.github.io/guide/
[icu messageformat]: https://messageformat.github.io/guide/
[messageformat]: https://messageformat.github.io/
[parser.pegjs]: ./parser.pegjs
[PEG.js]: http://pegjs.org/
[Unicode CLDR]: http://cldr.unicode.org/index/cldr-spec/plural-rules
[peg.js]: http://pegjs.org/
[unicode cldr]: http://cldr.unicode.org/index/cldr-spec/plural-rules
[apostrophe mode]: http://www.icu-project.org/apiref/icu4c/messagepattern_8h.html#af6e0757e0eb81c980b01ee5d68a9978b
## Installation

@@ -54,3 +53,2 @@

## Usage

@@ -114,3 +112,2 @@

## Structure

@@ -167,6 +164,6 @@

## License & Contributor License Agreement
Released under the MIT license. See the [messageformat README][CLA] for details.
[CLA]: https://github.com/messageformat/messageformat.js#contributor-license-agreement
Released under the MIT license. See the [messageformat README][cla] for details.
[cla]: https://github.com/messageformat/messageformat.js#contributor-license-agreement
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