New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

antlr4

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antlr4 - npm Package Compare versions

Comparing version 4.7.2 to 4.8.0

8

atn/ATNConfigSet.js

@@ -178,3 +178,3 @@ //

var hash = new Hash();
this.updateHashCode(hash);
hash.update(this.configs);
return hash.finish();

@@ -187,9 +187,7 @@ };

if (this.cachedHashCode === -1) {
var hash = new Hash();
hash.update(this.configs);
this.cachedHashCode = hash.finish();
this.cachedHashCode = this.hashCode();
}
hash.update(this.cachedHashCode);
} else {
hash.update(this.configs);
hash.update(this.hashCode());
}

@@ -196,0 +194,0 @@ };

@@ -141,3 +141,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

var v = c.charCodeAt(0);
return v>1 ? v-2 : v + 65533;
return v>1 ? v-2 : v + 65534;
};

@@ -144,0 +144,0 @@ var temp = data.split("").map(adjust);

@@ -11,2 +11,3 @@ //

var getCachedPredictionContext = require('./../PredictionContext').getCachedPredictionContext;
var Map = require('./../Utils').Map;

@@ -48,3 +49,3 @@ function ATNSimulator(atn, sharedContextCache) {

}
var visited = {};
var visited = new Map();
return getCachedPredictionContext(context, this.sharedContextCache, visited);

@@ -51,0 +52,0 @@ };

@@ -142,8 +142,2 @@ //

hash.update(this.configs);
if(this.isAcceptState) {
if (this.predicates !== null)
hash.update(this.predicates);
else
hash.update(this.prediction);
}
return hash.finish();

@@ -150,0 +144,0 @@ };

{
"name": "antlr4",
"version": "4.7.2",
"version": "4.8.0",
"description": "JavaScript runtime for ANTLR4",
"main": "src/antlr4/index.js",
"main": "index.js",
"repository": "antlr/antlr4.git",

@@ -7,0 +7,0 @@ "keywords": [

@@ -10,2 +10,3 @@ //

var Hash = require('./Utils').Hash;
var Map = require('./Utils').Map;

@@ -83,3 +84,3 @@ function PredictionContext(cachedHashCode) {

function PredictionContextCache() {
this.cache = {};
this.cache = new Map();
return this;

@@ -96,7 +97,7 @@ }

}
var existing = this.cache[ctx] || null;
var existing = this.cache.get(ctx) || null;
if (existing !== null) {
return existing;
}
this.cache[ctx] = ctx;
this.cache.put(ctx, ctx);
return ctx;

@@ -106,3 +107,3 @@ };

PredictionContextCache.prototype.get = function(ctx) {
return this.cache[ctx] || null;
return this.cache.get(ctx) || null;
};

@@ -118,7 +119,9 @@

var hashCode = 0;
var hash = new Hash();
if(parent !== null) {
var hash = new Hash();
hash.update(parent, returnState);
hashCode = hash.finish();
} else {
hash.update(1);
}
hashCode = hash.finish();
PredictionContext.call(this, hashCode);

@@ -648,12 +651,12 @@ this.parentCtx = parent;

function combineCommonParents(parents) {
var uniqueParents = {};
var uniqueParents = new Map();
for (var p = 0; p < parents.length; p++) {
var parent = parents[p];
if (!(parent in uniqueParents)) {
uniqueParents[parent] = parent;
if (!(uniqueParents.containsKey(parent))) {
uniqueParents.put(parent, parent);
}
}
for (var q = 0; q < parents.length; q++) {
parents[q] = uniqueParents[parents[q]];
parents[q] = uniqueParents.get(parents[q]);
}

@@ -666,3 +669,3 @@ }

}
var existing = visited[context] || null;
var existing = visited.get(context) || null;
if (existing !== null) {

@@ -673,3 +676,3 @@ return existing;

if (existing !== null) {
visited[context] = existing;
visited.put(context, existing);
return existing;

@@ -694,3 +697,3 @@ }

contextCache.add(context);
visited[context] = context;
visited.put(context, context);
return context;

@@ -708,4 +711,4 @@ }

contextCache.add(updated);
visited[updated] = updated;
visited[context] = updated;
visited.put(updated, updated);
visited.put(context, updated);

@@ -721,9 +724,9 @@ return updated;

} else if (visited === null) {
visited = {};
visited = new Map();
return getAllContextNodes(context, nodes, visited);
} else {
if (context === null || visited[context] !== null) {
if (context === null || visited.containsKey(context)) {
return nodes;
}
visited[context] = context;
visited.put(context, context);
nodes.push(context);

@@ -730,0 +733,0 @@ for (var i = 0; i < context.length; i++) {

@@ -24,3 +24,3 @@ //

Recognizer.prototype.checkVersion = function(toolVersion) {
var runtimeVersion = "4.7.2";
var runtimeVersion = "4.8";
if (runtimeVersion!==toolVersion) {

@@ -27,0 +27,0 @@ console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);

@@ -326,3 +326,5 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.

function DoubleDict() {
function DoubleDict(defaultMapCtor) {
this.defaultMapCtor = defaultMapCtor || Map;
this.cacheMap = new this.defaultMapCtor();
return this;

@@ -343,3 +345,3 @@ }

if(Array.isArray(value))
this.update.apply(value);
this.update.apply(this, value);
else {

@@ -359,3 +361,6 @@ var k = 0;

default:
value.updateHashCode(this);
if(value.updateHashCode)
value.updateHashCode(this);
else
console.log("No updateHashCode for " + value.toString())
continue;

@@ -373,3 +378,3 @@ }

}
}
};

@@ -384,7 +389,7 @@ Hash.prototype.finish = function () {

return hash;
}
};
function hashStuff() {
var hash = new Hash();
hash.update.apply(arguments);
hash.update.apply(hash, arguments);
return hash.finish();

@@ -394,13 +399,13 @@ }

DoubleDict.prototype.get = function (a, b) {
var d = this[a] || null;
return d === null ? null : (d[b] || null);
var d = this.cacheMap.get(a) || null;
return d === null ? null : (d.get(b) || null);
};
DoubleDict.prototype.set = function (a, b, o) {
var d = this[a] || null;
var d = this.cacheMap.get(a) || null;
if (d === null) {
d = {};
this[a] = d;
d = new this.defaultMapCtor();
this.cacheMap.put(a, d);
}
d[b] = o;
d.put(b, o);
};

@@ -407,0 +412,0 @@

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