Socket
Socket
Sign inDemoInstall

regjsparser

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.0 to 0.8.0

9

package.json
{
"name": "regjsparser",
"version": "0.7.0",
"version": "0.8.0",
"author": "'Julian Viereck' <julian.viereck@gmail.com>",
"license": "BSD-2-Clause",
"main": "./parser",
"types": "./parser.d.ts",
"bin": "bin/parser",

@@ -14,3 +15,5 @@ "homepage": "https://github.com/jviereck/regjsparser",

"scripts": {
"test": "node test/index.js"
"test": "run-p test:*",
"test:src": "node test/index.js",
"test:types": "tsc test/types.ts --noEmit"
},

@@ -27,5 +30,7 @@ "files": [

"devDependencies": {
"npm-run-all": "^4.1.5",
"regenerate": "~1.0.1",
"typescript": "^4.5.2",
"unicode-11.0.0": "^0.7.8"
}
}

@@ -567,3 +567,3 @@ // regjsparser

// is an error.
pos_backup = pos
var pos_backup = pos
var quantifier = parseQuantifier() || false;

@@ -693,2 +693,6 @@ if (quantifier) {

if ((min && !Number.isSafeInteger(min)) || (max && !Number.isSafeInteger(max))) {
bail("iterations outside JS safe integer range in quantifier", "", from, pos);
}
if (quantifier) {

@@ -810,3 +814,3 @@ if (match('?')) {

res = parseDecimalEscape() || parseNamedReference();
res = parseDecimalEscape(insideCharacterClass) || parseNamedReference();
if (res) {

@@ -847,12 +851,22 @@ return res;

function parseDecimalEscape() {
function parseDecimalEscape(insideCharacterClass) {
// DecimalEscape ::
// DecimalIntegerLiteral [lookahead ∉ DecimalDigit]
var res, match;
var res, match, from = pos;
if (hasUnicodeFlag) {
if (res = matchReg(/^\d/)) {
if (res[0] !== "0" || (res = matchReg(/^\d/)) ) {
bail("Invalid decimal escape in unicode mode", null, from, pos);
}
return createEscaped('null', 0x0000, '0', 1);
}
return false;
}
if (res = matchReg(/^(?!0)\d+/)) {
match = res[0];
var refIdx = parseInt(res[0], 10);
if (refIdx <= closedCaptureCounter) {
if (refIdx <= closedCaptureCounter && !insideCharacterClass) {
// If the number is smaller than the normal-groups found so

@@ -921,2 +935,4 @@ // far, then it is a reference...

});
} else if (features.unicodeSet && hasUnicodeSetFlag && match('q{')) {
return parseClassStrings();
}

@@ -1299,3 +1315,3 @@ return false;

if (current('&')) {
bail('&& cannot be followed by &. Wrap it in parentheses: &&(&).');
bail('&& cannot be followed by &. Wrap it in brackets: &&[&].');
}

@@ -1341,12 +1357,13 @@ } else if (kind === 'subtraction') {

if (match('\\')) {
// ClassOperand ::
// ...
// ClassStrings
// NestedClass
//
// NestedClass ::
// ...
// \ CharacterClassEscape[+U, +V]
if (res = parseCharacterClassEscape()) {
start = res;
} else if (res = parseClassCharacterEscapedHelper()) {
// ClassOperand ::
// ...
// NestedClass
//
// NestedClass ::
// ...
// \ CharacterClassEscape[+U, +V]
return res;

@@ -1358,6 +1375,5 @@ } else {

start = res;
} else if (res = parseClassStrings() || parseCharacterClass()) {
} else if (res = parseCharacterClass()) {
// ClassOperand ::
// ...
// ClassStrings
// NestedClass

@@ -1443,11 +1459,8 @@ //

// ClassStrings ::
// ( ClassString MoreClassStrings? )
// \q{ ClassString MoreClassStrings? }
// When calling this function, \q{ has already been consumed.
var from = pos - 3;
var res = [];
var from = pos;
if (!match('(')) {
return null;
}
do {

@@ -1457,3 +1470,3 @@ res.push(parseClassString());

skip(')');
skip('}');

@@ -1460,0 +1473,0 @@ return createClassStrings(res, from, pos);

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc