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

@fullstackio/cq

Package Overview
Dependencies
Maintainers
3
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullstackio/cq - npm Package Compare versions

Comparing version 5.0.1 to 5.0.3

345

dist/query-parser.js

@@ -40,3 +40,6 @@ "use strict";

peg$startRuleFunction = peg$parsestart,
peg$c0 = function peg$c0(head, tail) {
peg$c0 = function peg$c0(selExps) {
return selExps;
},
peg$c1 = function peg$c1(head, tail) {
// TODO: potentially use this for identifying the discontinuous queries

@@ -46,3 +49,3 @@ // head.queryType = QueryResultTypes.SELECTION_EXPRESSION;

},
peg$c1 = function peg$c1(head, tail) {
peg$c2 = function peg$c2(head, tail) {
var result = head;

@@ -61,3 +64,3 @@ var i = void 0;

},
peg$c2 = function peg$c2(start, end) {
peg$c3 = function peg$c3(start, end) {
return {

@@ -69,3 +72,3 @@ type: NodeTypes.RANGE,

},
peg$c3 = function peg$c3(number) {
peg$c4 = function peg$c4(number) {
return {

@@ -76,6 +79,6 @@ type: NodeTypes.LINE_NUMBER,

},
peg$c4 = function peg$c4(node) {
peg$c5 = function peg$c5(node) {
return node;
},
peg$c5 = function peg$c5(str) {
peg$c6 = function peg$c6(str) {
return {

@@ -86,3 +89,3 @@ type: NodeTypes.STRING,

},
peg$c6 = function peg$c6(chars) {
peg$c7 = function peg$c7(chars) {
return {

@@ -93,13 +96,13 @@ type: NodeTypes.IDENTIFIER,

},
peg$c7 = "(",
peg$c8 = { type: "literal", value: "(", description: "\"(\"" },
peg$c9 = ")",
peg$c10 = { type: "literal", value: ")", description: "\")\"" },
peg$c11 = function peg$c11(args) {
peg$c8 = "(",
peg$c9 = { type: "literal", value: "(", description: "\"(\"" },
peg$c10 = ")",
peg$c11 = { type: "literal", value: ")", description: "\")\"" },
peg$c12 = function peg$c12(args) {
return optionalList(extractOptional(args, 0));
},
peg$c12 = function peg$c12(head, tail) {
peg$c13 = function peg$c13(head, tail) {
return buildList(head, tail, 3);
},
peg$c13 = function peg$c13(callee, args) {
peg$c14 = function peg$c14(callee, args) {
return {

@@ -111,38 +114,38 @@ type: "CALL_EXPRESSION",

},
peg$c14 = { type: "other", description: "integer" },
peg$c15 = /^[0-9]/,
peg$c16 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c17 = function peg$c17() {
peg$c15 = { type: "other", description: "integer" },
peg$c16 = /^[0-9]/,
peg$c17 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c18 = function peg$c18() {
return parseInt(text(), 10);
},
peg$c18 = { type: "other", description: "boolean" },
peg$c19 = ".",
peg$c20 = { type: "literal", value: ".", description: "\".\"" },
peg$c21 = "-",
peg$c22 = { type: "literal", value: "-", description: "\"-\"" },
peg$c23 = ":",
peg$c24 = { type: "literal", value: ":", description: "\":\"" },
peg$c25 = ",",
peg$c26 = { type: "literal", value: ",", description: "\",\"" },
peg$c27 = "EOF",
peg$c28 = { type: "literal", value: "EOF", description: "\"EOF\"" },
peg$c29 = "true",
peg$c30 = { type: "literal", value: "true", description: "\"true\"" },
peg$c31 = function peg$c31() {
peg$c19 = { type: "other", description: "boolean" },
peg$c20 = { type: "other", description: "whitespace" },
peg$c21 = /^[ \t\n\r]/,
peg$c22 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c23 = ".",
peg$c24 = { type: "literal", value: ".", description: "\".\"" },
peg$c25 = "-",
peg$c26 = { type: "literal", value: "-", description: "\"-\"" },
peg$c27 = ":",
peg$c28 = { type: "literal", value: ":", description: "\":\"" },
peg$c29 = ",",
peg$c30 = { type: "literal", value: ",", description: "\",\"" },
peg$c31 = "EOF",
peg$c32 = { type: "literal", value: "EOF", description: "\"EOF\"" },
peg$c33 = "true",
peg$c34 = { type: "literal", value: "true", description: "\"true\"" },
peg$c35 = function peg$c35() {
return true;
},
peg$c32 = "false",
peg$c33 = { type: "literal", value: "false", description: "\"false\"" },
peg$c34 = function peg$c34() {
peg$c36 = "false",
peg$c37 = { type: "literal", value: "false", description: "\"false\"" },
peg$c38 = function peg$c38() {
return false;
},
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 = "'",
peg$c39 = { type: "literal", value: "'", description: "\"'\"" },
peg$c40 = /^[A-Za-z0-9_$]/,
peg$c41 = { type: "class", value: "[A-Za-z0-9_$]", description: "[A-Za-z0-9_$]" },
peg$c42 = /^[^\n']/,
peg$c43 = { type: "class", value: "[^\\n\\']", description: "[^\\n\\']" },
peg$c39 = "'",
peg$c40 = { type: "literal", value: "'", description: "\"'\"" },
peg$c41 = /^[A-Za-z0-9_$]/,
peg$c42 = { type: "class", value: "[A-Za-z0-9_$]", description: "[A-Za-z0-9_$]" },
peg$c43 = /^[^\n']/,
peg$c44 = { type: "class", value: "[^\\n\\']", description: "[^\\n\\']" },
peg$currPos = 0,

@@ -320,5 +323,29 @@ peg$savedPos = 0,

function peg$parsestart() {
var s0;
var s0, s1, s2, s3;
s0 = peg$parseSelectionExpressions();
s0 = peg$currPos;
s1 = peg$parseopenParenWs();
if (s1 !== peg$FAILED) {
s2 = peg$parseSelectionExpressions();
if (s2 !== peg$FAILED) {
s3 = peg$parsecloseParenWs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(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$parseSelectionExpressions();
}

@@ -394,3 +421,3 @@ return s0;

peg$savedPos = s0;
s1 = peg$c0(s1, s2);
s1 = peg$c1(s1, s2);
s0 = s1;

@@ -451,3 +478,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c1(s1, s2);
s1 = peg$c2(s1, s2);
s0 = s1;

@@ -488,3 +515,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c2(s1, s3);
s1 = peg$c3(s1, s3);
s0 = s1;

@@ -516,3 +543,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c3(s1);
s1 = peg$c4(s1);
}

@@ -538,10 +565,10 @@ s0 = s1;

s0 = peg$currPos;
s1 = peg$parseopenParen();
s1 = peg$parseopenParenWs();
if (s1 !== peg$FAILED) {
s2 = peg$parseSelectionExpression();
if (s2 !== peg$FAILED) {
s3 = peg$parsecloseParen();
s3 = peg$parsecloseParenWs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s1 = peg$c5(s2);
s0 = s1;

@@ -575,3 +602,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c5(s2);
s1 = peg$c6(s2);
s0 = s1;

@@ -612,3 +639,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c6(s2);
s1 = peg$c7(s2);
s0 = s1;

@@ -632,3 +659,3 @@ } else {

if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c7;
s1 = peg$c8;
peg$currPos++;

@@ -638,3 +665,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c8);
peg$fail(peg$c9);
}

@@ -665,3 +692,3 @@ }

if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c9;
s4 = peg$c10;
peg$currPos++;

@@ -671,3 +698,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c10);
peg$fail(peg$c11);
}

@@ -677,3 +704,3 @@ }

peg$savedPos = s0;
s1 = peg$c11(s3);
s1 = peg$c12(s3);
s0 = s1;

@@ -766,3 +793,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c12(s1, s2);
s1 = peg$c13(s1, s2);
s0 = s1;

@@ -813,3 +840,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c13(s1, s2);
s1 = peg$c14(s1, s2);
s0 = s1;

@@ -850,3 +877,3 @@ } else {

s2 = [];
if (peg$c15.test(input.charAt(peg$currPos))) {
if (peg$c16.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -857,3 +884,3 @@ peg$currPos++;

if (peg$silentFails === 0) {
peg$fail(peg$c16);
peg$fail(peg$c17);
}

@@ -864,3 +891,3 @@ }

s2.push(s3);
if (peg$c15.test(input.charAt(peg$currPos))) {
if (peg$c16.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -871,3 +898,3 @@ peg$currPos++;

if (peg$silentFails === 0) {
peg$fail(peg$c16);
peg$fail(peg$c17);
}

@@ -881,3 +908,3 @@ }

peg$savedPos = s0;
s1 = peg$c17();
s1 = peg$c18();
s0 = s1;

@@ -896,3 +923,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c14);
peg$fail(peg$c15);
}

@@ -916,3 +943,3 @@ }

if (peg$silentFails === 0) {
peg$fail(peg$c18);
peg$fail(peg$c19);
}

@@ -924,2 +951,39 @@ }

function peg$parsews() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c21.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c22);
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c21.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c22);
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
return s0;
}
function peg$parsedot() {

@@ -929,3 +993,3 @@ var s0;

if (input.charCodeAt(peg$currPos) === 46) {
s0 = peg$c19;
s0 = peg$c23;
peg$currPos++;

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

if (peg$silentFails === 0) {
peg$fail(peg$c20);
peg$fail(peg$c24);
}

@@ -947,3 +1011,3 @@ }

if (input.charCodeAt(peg$currPos) === 45) {
s0 = peg$c21;
s0 = peg$c25;
peg$currPos++;

@@ -953,3 +1017,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c22);
peg$fail(peg$c26);
}

@@ -965,3 +1029,3 @@ }

if (input.charCodeAt(peg$currPos) === 58) {
s0 = peg$c23;
s0 = peg$c27;
peg$currPos++;

@@ -971,3 +1035,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c24);
peg$fail(peg$c28);
}

@@ -983,3 +1047,3 @@ }

if (input.charCodeAt(peg$currPos) === 44) {
s0 = peg$c25;
s0 = peg$c29;
peg$currPos++;

@@ -989,3 +1053,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c26);
peg$fail(peg$c30);
}

@@ -1001,3 +1065,3 @@ }

if (input.charCodeAt(peg$currPos) === 40) {
s0 = peg$c7;
s0 = peg$c8;
peg$currPos++;

@@ -1007,3 +1071,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c8);
peg$fail(peg$c9);
}

@@ -1015,2 +1079,24 @@ }

function peg$parseopenParenWs() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseopenParen();
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecloseParen() {

@@ -1020,3 +1106,3 @@ var s0;

if (input.charCodeAt(peg$currPos) === 41) {
s0 = peg$c9;
s0 = peg$c10;
peg$currPos++;

@@ -1026,3 +1112,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c10);
peg$fail(peg$c11);
}

@@ -1034,7 +1120,29 @@ }

function peg$parsecloseParenWs() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsecloseParen();
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseeof() {
var s0;
if (input.substr(peg$currPos, 3) === peg$c27) {
s0 = peg$c27;
if (input.substr(peg$currPos, 3) === peg$c31) {
s0 = peg$c31;
peg$currPos += 3;

@@ -1044,3 +1152,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c28);
peg$fail(peg$c32);
}

@@ -1056,4 +1164,4 @@ }

s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c29) {
s1 = peg$c29;
if (input.substr(peg$currPos, 4) === peg$c33) {
s1 = peg$c33;
peg$currPos += 4;

@@ -1063,3 +1171,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c30);
peg$fail(peg$c34);
}

@@ -1069,3 +1177,3 @@ }

peg$savedPos = s0;
s1 = peg$c31();
s1 = peg$c35();
}

@@ -1081,4 +1189,4 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c32) {
s1 = peg$c32;
if (input.substr(peg$currPos, 5) === peg$c36) {
s1 = peg$c36;
peg$currPos += 5;

@@ -1088,3 +1196,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c33);
peg$fail(peg$c37);
}

@@ -1094,3 +1202,3 @@ }

peg$savedPos = s0;
s1 = peg$c34();
s1 = peg$c38();
}

@@ -1102,39 +1210,2 @@ s0 = s1;

function peg$parsews() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c37);
}
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c37);
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c35);
}
}
return s0;
}
function peg$parsesingleQuote() {

@@ -1144,3 +1215,3 @@ var s0;

if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c38;
s0 = peg$c39;
peg$currPos++;

@@ -1150,3 +1221,3 @@ } else {

if (peg$silentFails === 0) {
peg$fail(peg$c39);
peg$fail(peg$c40);
}

@@ -1161,3 +1232,3 @@ }

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

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

if (peg$silentFails === 0) {
peg$fail(peg$c41);
peg$fail(peg$c42);
}

@@ -1180,3 +1251,3 @@ }

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

@@ -1187,3 +1258,3 @@ peg$currPos++;

if (peg$silentFails === 0) {
peg$fail(peg$c43);
peg$fail(peg$c44);
}

@@ -1193,3 +1264,3 @@ }

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

@@ -1200,3 +1271,3 @@ peg$currPos++;

if (peg$silentFails === 0) {
peg$fail(peg$c43);
peg$fail(peg$c44);
}

@@ -1203,0 +1274,0 @@ }

{
"name": "@fullstackio/cq",
"version": "5.0.1",
"version": "5.0.3",
"description": "query code with selectors",

@@ -33,3 +33,3 @@ "main": "dist/index.js",

"devDependencies": {
"@fullstackio/cqmd": "^5.0.1",
"@fullstackio/cqmd": "^5.0.3",
"babel-cli": "^6.10.1",

@@ -36,0 +36,0 @@ "babel-core": "^6.9.1",

@@ -39,3 +39,6 @@ module.exports = (function() {

peg$c0 = function(head, tail) {
peg$c0 = function(selExps) {
return selExps;
},
peg$c1 = function(head, tail) {
// TODO: potentially use this for identifying the discontinuous queries

@@ -45,3 +48,3 @@ // head.queryType = QueryResultTypes.SELECTION_EXPRESSION;

},
peg$c1 = function(head, tail) {
peg$c2 = function(head, tail) {
let result = head;

@@ -60,3 +63,3 @@ let i;

},
peg$c2 = function(start, end) {
peg$c3 = function(start, end) {
return {

@@ -68,3 +71,3 @@ type: NodeTypes.RANGE,

},
peg$c3 = function(number) {
peg$c4 = function(number) {
return {

@@ -75,6 +78,6 @@ type: NodeTypes.LINE_NUMBER,

},
peg$c4 = function(node) {
peg$c5 = function(node) {
return node;
},
peg$c5 = function(str) {
peg$c6 = function(str) {
return {

@@ -85,3 +88,3 @@ type: NodeTypes.STRING,

},
peg$c6 = function(chars) {
peg$c7 = function(chars) {
return {

@@ -92,13 +95,13 @@ type: NodeTypes.IDENTIFIER,

},
peg$c7 = "(",
peg$c8 = { type: "literal", value: "(", description: "\"(\"" },
peg$c9 = ")",
peg$c10 = { type: "literal", value: ")", description: "\")\"" },
peg$c11 = function(args) {
peg$c8 = "(",
peg$c9 = { type: "literal", value: "(", description: "\"(\"" },
peg$c10 = ")",
peg$c11 = { type: "literal", value: ")", description: "\")\"" },
peg$c12 = function(args) {
return optionalList(extractOptional(args, 0));
},
peg$c12 = function(head, tail) {
peg$c13 = function(head, tail) {
return buildList(head, tail, 3);
},
peg$c13 = function(callee, args) {
peg$c14 = function(callee, args) {
return {

@@ -110,32 +113,32 @@ type: "CALL_EXPRESSION",

},
peg$c14 = { type: "other", description: "integer" },
peg$c15 = /^[0-9]/,
peg$c16 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c17 = function() { return parseInt(text(), 10); },
peg$c18 = { type: "other", description: "boolean" },
peg$c19 = ".",
peg$c20 = { type: "literal", value: ".", description: "\".\"" },
peg$c21 = "-",
peg$c22 = { type: "literal", value: "-", description: "\"-\"" },
peg$c23 = ":",
peg$c24 = { type: "literal", value: ":", description: "\":\"" },
peg$c25 = ",",
peg$c26 = { type: "literal", value: ",", description: "\",\"" },
peg$c27 = "EOF",
peg$c28 = { type: "literal", value: "EOF", description: "\"EOF\"" },
peg$c29 = "true",
peg$c30 = { type: "literal", value: "true", description: "\"true\"" },
peg$c31 = function() { return true; },
peg$c32 = "false",
peg$c33 = { type: "literal", value: "false", description: "\"false\"" },
peg$c34 = function() { return false; },
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 = "'",
peg$c39 = { type: "literal", value: "'", description: "\"'\"" },
peg$c40 = /^[A-Za-z0-9_$]/,
peg$c41 = { type: "class", value: "[A-Za-z0-9_$]", description: "[A-Za-z0-9_$]" },
peg$c42 = /^[^\n']/,
peg$c43 = { type: "class", value: "[^\\n\\']", description: "[^\\n\\']" },
peg$c15 = { type: "other", description: "integer" },
peg$c16 = /^[0-9]/,
peg$c17 = { type: "class", value: "[0-9]", description: "[0-9]" },
peg$c18 = function() { return parseInt(text(), 10); },
peg$c19 = { type: "other", description: "boolean" },
peg$c20 = { type: "other", description: "whitespace" },
peg$c21 = /^[ \t\n\r]/,
peg$c22 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
peg$c23 = ".",
peg$c24 = { type: "literal", value: ".", description: "\".\"" },
peg$c25 = "-",
peg$c26 = { type: "literal", value: "-", description: "\"-\"" },
peg$c27 = ":",
peg$c28 = { type: "literal", value: ":", description: "\":\"" },
peg$c29 = ",",
peg$c30 = { type: "literal", value: ",", description: "\",\"" },
peg$c31 = "EOF",
peg$c32 = { type: "literal", value: "EOF", description: "\"EOF\"" },
peg$c33 = "true",
peg$c34 = { type: "literal", value: "true", description: "\"true\"" },
peg$c35 = function() { return true; },
peg$c36 = "false",
peg$c37 = { type: "literal", value: "false", description: "\"false\"" },
peg$c38 = function() { return false; },
peg$c39 = "'",
peg$c40 = { type: "literal", value: "'", description: "\"'\"" },
peg$c41 = /^[A-Za-z0-9_$]/,
peg$c42 = { type: "class", value: "[A-Za-z0-9_$]", description: "[A-Za-z0-9_$]" },
peg$c43 = /^[^\n']/,
peg$c44 = { type: "class", value: "[^\\n\\']", description: "[^\\n\\']" },

@@ -328,5 +331,29 @@ peg$currPos = 0,

function peg$parsestart() {
var s0;
var s0, s1, s2, s3;
s0 = peg$parseSelectionExpressions();
s0 = peg$currPos;
s1 = peg$parseopenParenWs();
if (s1 !== peg$FAILED) {
s2 = peg$parseSelectionExpressions();
if (s2 !== peg$FAILED) {
s3 = peg$parsecloseParenWs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(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$parseSelectionExpressions();
}

@@ -402,3 +429,3 @@ return s0;

peg$savedPos = s0;
s1 = peg$c0(s1, s2);
s1 = peg$c1(s1, s2);
s0 = s1;

@@ -459,3 +486,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c1(s1, s2);
s1 = peg$c2(s1, s2);
s0 = s1;

@@ -496,3 +523,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c2(s1, s3);
s1 = peg$c3(s1, s3);
s0 = s1;

@@ -524,3 +551,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c3(s1);
s1 = peg$c4(s1);
}

@@ -546,10 +573,10 @@ s0 = s1;

s0 = peg$currPos;
s1 = peg$parseopenParen();
s1 = peg$parseopenParenWs();
if (s1 !== peg$FAILED) {
s2 = peg$parseSelectionExpression();
if (s2 !== peg$FAILED) {
s3 = peg$parsecloseParen();
s3 = peg$parsecloseParenWs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s1 = peg$c5(s2);
s0 = s1;

@@ -583,3 +610,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c5(s2);
s1 = peg$c6(s2);
s0 = s1;

@@ -620,3 +647,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c6(s2);
s1 = peg$c7(s2);
s0 = s1;

@@ -640,7 +667,7 @@ } else {

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

@@ -670,11 +697,11 @@ if (s1 !== peg$FAILED) {

if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c9;
s4 = peg$c10;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
if (peg$silentFails === 0) { peg$fail(peg$c11); }
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c11(s3);
s1 = peg$c12(s3);
s0 = s1;

@@ -767,3 +794,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c12(s1, s2);
s1 = peg$c13(s1, s2);
s0 = s1;

@@ -814,3 +841,3 @@ } else {

peg$savedPos = s0;
s1 = peg$c13(s1, s2);
s1 = peg$c14(s1, s2);
s0 = s1;

@@ -851,3 +878,3 @@ } else {

s2 = [];
if (peg$c15.test(input.charAt(peg$currPos))) {
if (peg$c16.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -857,3 +884,3 @@ peg$currPos++;

s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}

@@ -863,3 +890,3 @@ if (s3 !== peg$FAILED) {

s2.push(s3);
if (peg$c15.test(input.charAt(peg$currPos))) {
if (peg$c16.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);

@@ -869,3 +896,3 @@ peg$currPos++;

s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c16); }
if (peg$silentFails === 0) { peg$fail(peg$c17); }
}

@@ -878,3 +905,3 @@ }

peg$savedPos = s0;
s1 = peg$c17();
s1 = peg$c18();
s0 = s1;

@@ -892,3 +919,3 @@ } else {

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c14); }
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}

@@ -910,3 +937,3 @@

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
if (peg$silentFails === 0) { peg$fail(peg$c19); }
}

@@ -917,2 +944,33 @@

function peg$parsews() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c21.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c21.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}
return s0;
}
function peg$parsedot() {

@@ -922,7 +980,7 @@ var s0;

if (input.charCodeAt(peg$currPos) === 46) {
s0 = peg$c19;
s0 = peg$c23;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}

@@ -937,7 +995,7 @@

if (input.charCodeAt(peg$currPos) === 45) {
s0 = peg$c21;
s0 = peg$c25;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}

@@ -952,7 +1010,7 @@

if (input.charCodeAt(peg$currPos) === 58) {
s0 = peg$c23;
s0 = peg$c27;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}

@@ -967,7 +1025,7 @@

if (input.charCodeAt(peg$currPos) === 44) {
s0 = peg$c25;
s0 = peg$c29;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
if (peg$silentFails === 0) { peg$fail(peg$c30); }
}

@@ -982,7 +1040,7 @@

if (input.charCodeAt(peg$currPos) === 40) {
s0 = peg$c7;
s0 = peg$c8;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c8); }
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}

@@ -993,2 +1051,24 @@

function peg$parseopenParenWs() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseopenParen();
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecloseParen() {

@@ -998,7 +1078,7 @@ var s0;

if (input.charCodeAt(peg$currPos) === 41) {
s0 = peg$c9;
s0 = peg$c10;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c10); }
if (peg$silentFails === 0) { peg$fail(peg$c11); }
}

@@ -1009,11 +1089,33 @@

function peg$parsecloseParenWs() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsecloseParen();
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseeof() {
var s0;
if (input.substr(peg$currPos, 3) === peg$c27) {
s0 = peg$c27;
if (input.substr(peg$currPos, 3) === peg$c31) {
s0 = peg$c31;
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}

@@ -1028,12 +1130,12 @@

s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c29) {
s1 = peg$c29;
if (input.substr(peg$currPos, 4) === peg$c33) {
s1 = peg$c33;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c30); }
if (peg$silentFails === 0) { peg$fail(peg$c34); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31();
s1 = peg$c35();
}

@@ -1049,12 +1151,12 @@ s0 = s1;

s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c32) {
s1 = peg$c32;
if (input.substr(peg$currPos, 5) === peg$c36) {
s1 = peg$c36;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c33); }
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c34();
s1 = peg$c38();
}

@@ -1066,33 +1168,2 @@ s0 = s1;

function peg$parsews() {
var s0, s1;
peg$silentFails++;
s0 = [];
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c36.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c35); }
}
return s0;
}
function peg$parsesingleQuote() {

@@ -1102,7 +1173,7 @@ var s0;

if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c38;
s0 = peg$c39;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c39); }
if (peg$silentFails === 0) { peg$fail(peg$c40); }
}

@@ -1116,3 +1187,3 @@

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

@@ -1122,3 +1193,3 @@ peg$currPos++;

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

@@ -1133,3 +1204,3 @@

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

@@ -1139,7 +1210,7 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}
while (s1 !== peg$FAILED) {
s0.push(s1);
if (peg$c42.test(input.charAt(peg$currPos))) {
if (peg$c43.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);

@@ -1149,3 +1220,3 @@ peg$currPos++;

s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
if (peg$silentFails === 0) { peg$fail(peg$c44); }
}

@@ -1152,0 +1223,0 @@ }

@@ -305,2 +305,16 @@ import 'babel-polyfill'

it('should return two top level identifiers with parens', () => {
let actual = parser.parse('(.Switch, .Cow)');
let expected = [{
type: NodeTypes.IDENTIFIER,
matcher: 'Switch'
},
{
type: NodeTypes.IDENTIFIER,
matcher: 'Cow'
}];
assert.deepEqual(actual, expected);
});
it('should return two top level identifiers, even with functions', () => {

@@ -330,4 +344,28 @@ let actual = parser.parse('.Switch, context(.foo, -2, -3)');

it('should return two top level identifiers, even with functions with parens', () => {
let actual = parser.parse('(.Switch, context(.foo, -2, -3))');
let expected = [{
type: NodeTypes.IDENTIFIER,
matcher: 'Switch'
},
{
type: NodeTypes.CALL_EXPRESSION,
callee: 'context',
arguments: [{
matcher: 'foo',
type: NodeTypes.IDENTIFIER,
}, {
type: NodeTypes.LINE_NUMBER,
value: -2
}, {
type: NodeTypes.LINE_NUMBER,
value: -3
}]
}];
assert.deepEqual(actual, expected);
});
});
});

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