Comparing version 4.9.2 to 4.9.3
{ | ||
"name": "antlr4", | ||
"version": "4.9.2", | ||
"version": "4.9.3", | ||
"description": "JavaScript runtime for ANTLR4", | ||
@@ -22,7 +22,16 @@ "main": "src/antlr4/index.js", | ||
"@babel/preset-env": "^7.13.10", | ||
"ansi-regex": "^5.0.1", | ||
"babel-loader": "^8.2.2", | ||
"browserslist": ">=4.16.5", | ||
"hosted-git-info": ">=2.8.9", | ||
"ini": "1.3.6", | ||
"jest": "^26.6.3", | ||
"path-parse": ">=1.0.7", | ||
"set-value": ">=4.0.1", | ||
"ssri": ">=6.0.2", | ||
"tmpl": "^1.0.5", | ||
"webpack": "^4.46.0", | ||
"webpack-cli": "^3.3.12" | ||
"webpack-cli": "^3.3.12", | ||
"ws": ">=7.4.6", | ||
"y18n": ">=4.0.1" | ||
}, | ||
@@ -29,0 +38,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
*/ | ||
const Utils = require('./../Utils'); | ||
@@ -57,3 +58,3 @@ /** | ||
if (s.predicates !== null) { | ||
return baseStateStr + "=>" + s.predicates.toString(); | ||
return baseStateStr + "=>" + Utils.arrayToString(s.predicates); | ||
} else { | ||
@@ -60,0 +61,0 @@ return baseStateStr + "=>" + s.prediction.toString(); |
@@ -32,5 +32,6 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
} else { | ||
this.data = new Array(this.strdata.length); | ||
for (let i = 0; i < this.strdata.length; i++) { | ||
const codeUnit = this.strdata.charCodeAt(i); | ||
this.data.push(codeUnit); | ||
this.data[i] = codeUnit; | ||
} | ||
@@ -37,0 +38,0 @@ } |
@@ -10,2 +10,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
class Interval { | ||
constructor(start, stop) { | ||
@@ -16,2 +17,6 @@ this.start = start; | ||
clone() { | ||
return new Interval(this.start, this.stop); | ||
} | ||
contains(item) { | ||
@@ -60,3 +65,3 @@ return item >= this.start && item < this.stop; | ||
this.intervals = []; | ||
this.intervals.push(toAdd); | ||
this.intervals.push(toAdd.clone()); | ||
} else { | ||
@@ -73,3 +78,3 @@ // find insert pos | ||
else if (toAdd.stop === existing.start) { | ||
this.intervals[pos].start = toAdd.start; | ||
this.intervals[pos] = new Interval(toAdd.start, existing.stop) | ||
return; | ||
@@ -85,3 +90,3 @@ } | ||
// greater than any existing | ||
this.intervals.push(toAdd); | ||
this.intervals.push(toAdd.clone()); | ||
} | ||
@@ -115,3 +120,3 @@ } | ||
const result = new IntervalSet(); | ||
result.addInterval(new Interval(start,stop+1)); | ||
result.addInterval(new Interval(start, stop + 1)); | ||
if(this.intervals !== null) | ||
@@ -118,0 +123,0 @@ this.intervals.forEach(toRemove => result.removeRange(toRemove)); |
@@ -323,3 +323,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
get type(){ | ||
return this.type; | ||
return this._type; | ||
} | ||
@@ -326,0 +326,0 @@ |
@@ -227,3 +227,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
// Remove all parse listeners. | ||
// Remove all parse listeners. | ||
removeParseListeners() { | ||
@@ -233,7 +233,7 @@ this._parseListeners = null; | ||
// Notify any parse listeners of an enter rule event. | ||
// Notify any parse listeners of an enter rule event. | ||
triggerEnterRuleEvent() { | ||
if (this._parseListeners !== null) { | ||
const ctx = this._ctx; | ||
this._parseListeners.map(function(listener) { | ||
this._parseListeners.forEach(function(listener) { | ||
listener.enterEveryRule(ctx); | ||
@@ -253,3 +253,3 @@ ctx.enterRule(listener); | ||
const ctx = this._ctx; | ||
this._parseListeners.slice(0).reverse().map(function(listener) { | ||
this._parseListeners.slice(0).reverse().forEach(function(listener) { | ||
ctx.exitRule(listener); | ||
@@ -398,3 +398,3 @@ listener.exitEveryRule(ctx); | ||
if (hasListener) { | ||
this._parseListeners.map(function(listener) { | ||
this._parseListeners.forEach(function(listener) { | ||
if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) { | ||
@@ -429,5 +429,3 @@ listener.visitErrorNode(node); | ||
} | ||
if (this._parseListeners !== null) { | ||
this.triggerEnterRuleEvent(); | ||
} | ||
this.triggerEnterRuleEvent(); | ||
} | ||
@@ -438,5 +436,3 @@ | ||
// trigger event on _ctx, before it reverts to parent | ||
if (this._parseListeners !== null) { | ||
this.triggerExitRuleEvent(); | ||
} | ||
this.triggerExitRuleEvent(); | ||
this.state = this._ctx.invokingState; | ||
@@ -478,6 +474,3 @@ this._ctx = this._ctx.parentCtx; | ||
this._ctx.start = this._input.LT(1); | ||
if (this._parseListeners !== null) { | ||
this.triggerEnterRuleEvent(); // simulates rule entry for | ||
// left-recursive rules | ||
} | ||
this.triggerEnterRuleEvent(); // simulates rule entry for left-recursive rules | ||
} | ||
@@ -497,6 +490,3 @@ | ||
} | ||
if (this._parseListeners !== null) { | ||
this.triggerEnterRuleEvent(); // simulates rule entry for | ||
// left-recursive rules | ||
} | ||
this.triggerEnterRuleEvent(); // simulates rule entry for left-recursive rules | ||
} | ||
@@ -509,3 +499,4 @@ | ||
// unroll so _ctx is as it was before call to recursive method | ||
if (this._parseListeners !== null) { | ||
const parseListeners = this.getParseListeners(); | ||
if (parseListeners !== null && parseListeners.length > 0) { | ||
while (this._ctx !== parentCtx) { | ||
@@ -512,0 +503,0 @@ this.triggerExitRuleEvent(); |
@@ -18,3 +18,3 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
checkVersion(toolVersion) { | ||
const runtimeVersion = "4.9.2"; | ||
const runtimeVersion = "4.9.3"; | ||
if (runtimeVersion!==toolVersion) { | ||
@@ -33,2 +33,23 @@ console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion); | ||
getLiteralNames() { | ||
return Object.getPrototypeOf(this).constructor.literalNames || []; | ||
} | ||
getSymbolicNames() { | ||
return Object.getPrototypeOf(this).constructor.symbolicNames || []; | ||
} | ||
getTokenNames() { | ||
if(!this.tokenNames) { | ||
const literalNames = this.getLiteralNames(); | ||
const symbolicNames = this.getSymbolicNames(); | ||
const length = literalNames.length > symbolicNames.length ? literalNames.length : symbolicNames.length; | ||
this.tokenNames = []; | ||
for(let i=0; i<length; i++) { | ||
this.tokenNames[i] = literalNames[i] || symbolicNames[i] || "<INVALID"; | ||
} | ||
} | ||
return this.tokenNames; | ||
} | ||
getTokenTypeMap() { | ||
@@ -35,0 +56,0 @@ const tokenNames = this.getTokenNames(); |
@@ -6,4 +6,8 @@ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
function valueToString(v) { | ||
return v === null ? "null" : v; | ||
} | ||
function arrayToString(a) { | ||
return Array.isArray(a) ? ("[" + a.join(", ") + "]") : "null"; | ||
return Array.isArray(a) ? ("[" + a.map(valueToString).join(", ") + "]") : "null"; | ||
} | ||
@@ -10,0 +14,0 @@ |
Sorry, the diff of this file is too big to display
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
413226
11217
16