From a3b27766fa4a1d52ec98572950749ba561c45f2b Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Wed, 30 Sep 2015 22:07:46 +0800 Subject: [PATCH 1/4] fix type --- runtime/JavaScript/src/antlr4/atn/ATN.js | 2 +- .../JavaScript/src/antlr4/atn/ATNConfigSet.js | 16 ++++++++-------- .../src/antlr4/atn/ParserATNSimulator.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/atn/ATN.js b/runtime/JavaScript/src/antlr4/atn/ATN.js index 40d0c115a..899ae869a 100644 --- a/runtime/JavaScript/src/antlr4/atn/ATN.js +++ b/runtime/JavaScript/src/antlr4/atn/ATN.js @@ -78,7 +78,7 @@ ATN.prototype.nextTokensNoContext = function(s) { return s.nextTokenWithinRule; } s.nextTokenWithinRule = this.nextTokensInContext(s, null); - s.nextTokenWithinRule.readonly = true; + s.nextTokenWithinRule.readOnly = true; return s.nextTokenWithinRule; }; diff --git a/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js b/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js index 7fbf2ed23..723eeceb6 100644 --- a/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js +++ b/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js @@ -78,7 +78,7 @@ function ATNConfigSet(fullCtx) { // the sets and they must not change. This does not protect the other // fields; in particular, conflictingAlts is set after // we've made this readonly. - this.readonly = false; + this.readOnly = false; // Track the elements as they are added to the set; supports get(i)/// this.configs = []; @@ -112,7 +112,7 @@ ATNConfigSet.prototype.add = function(config, mergeCache) { if (mergeCache === undefined) { mergeCache = null; } - if (this.readonly) { + if (this.readOnly) { throw "This set is readonly"; } if (config.semanticContext !== SemanticContext.NONE) { @@ -168,7 +168,7 @@ Object.defineProperty(ATNConfigSet.prototype, "items", { }); ATNConfigSet.prototype.optimizeConfigs = function(interpreter) { - if (this.readonly) { + if (this.readOnly) { throw "This set is readonly"; } if (this.configLookup.length === 0) { @@ -202,7 +202,7 @@ ATNConfigSet.prototype.equals = function(other) { }; ATNConfigSet.prototype.hashString = function() { - if (this.readonly) { + if (this.readOnly) { if (this.cachedHashString === "-1") { this.cachedHashString = this.hashConfigs(); } @@ -245,7 +245,7 @@ ATNConfigSet.prototype.containsFast = function(item) { }; ATNConfigSet.prototype.clear = function() { - if (this.readonly) { + if (this.readOnly) { throw "This set is readonly"; } this.configs = []; @@ -253,9 +253,9 @@ ATNConfigSet.prototype.clear = function() { this.configLookup = new Set(); }; -ATNConfigSet.prototype.setReadonly = function(readonly) { - this.readonly = readonly; - if (readonly) { +ATNConfigSet.prototype.setReadonly = function(readOnly) { + this.readOnly = readOnly; + if (readOnly) { this.configLookup = null; // can't mod, no need for lookup cache } }; diff --git a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js index 6145085e5..9a262949f 100644 --- a/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js +++ b/runtime/JavaScript/src/antlr4/atn/ParserATNSimulator.js @@ -1637,7 +1637,7 @@ ParserATNSimulator.prototype.addDFAState = function(dfa, D) { return existing; } D.stateNumber = dfa.states.length; - if (! D.configs.readonly) { + if (! D.configs.readOnly) { D.configs.optimizeConfigs(this); D.configs.setReadonly(true); } From 1b01140354307a8ef6f6697aa0f363674e40f87a Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Sun, 4 Oct 2015 11:44:26 +0800 Subject: [PATCH 2/4] Useful information for code completion --- runtime/JavaScript/src/antlr4/Parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/JavaScript/src/antlr4/Parser.js b/runtime/JavaScript/src/antlr4/Parser.js index f5df0f003..b5db9271a 100644 --- a/runtime/JavaScript/src/antlr4/Parser.js +++ b/runtime/JavaScript/src/antlr4/Parser.js @@ -408,6 +408,7 @@ Parser.prototype.consume = function() { } else { node = this._ctx.addTokenNode(o); } + node.invokingState = this.state; if (hasListener) { this._parseListeners.map(function(listener) { listener.visitTerminal(node); From 158ef2c5678e777f038897de33ca79f58c1e262b Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Mon, 5 Oct 2015 21:03:37 +0800 Subject: [PATCH 3/4] same fix as #1010 --- .gitignore | 5 +++++ runtime/JavaScript/src/antlr4/atn/ATNConfig.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c9440b617..94ae7d588 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,11 @@ user.build.properties # Python *.pyc +# CSharp +bin/ +obj/ +*.userprefs + # NetBeans user configuration files nbactions*.xml /nbproject/private/ diff --git a/runtime/JavaScript/src/antlr4/atn/ATNConfig.js b/runtime/JavaScript/src/antlr4/atn/ATNConfig.js index 8b6f0b5be..0b13737ed 100644 --- a/runtime/JavaScript/src/antlr4/atn/ATNConfig.js +++ b/runtime/JavaScript/src/antlr4/atn/ATNConfig.js @@ -162,7 +162,9 @@ LexerATNConfig.prototype.equals = function(other) { return false; } else if (this.passedThroughNonGreedyDecision !== other.passedThroughNonGreedyDecision) { return false; - } else if (this.lexerActionExecutor !== other.lexerActionExecutor) { + } else if (this.lexerActionExecutor ? + !this.lexerActionExecutor.equals(other.lexerActionExecutor) + : !other.lexerActionExecutor) { return false; } else { return ATNConfig.prototype.equals.call(this, other); From 3e807138d56f4177df9d3e011c1c5a991760f1ae Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Mon, 5 Oct 2015 21:28:30 +0800 Subject: [PATCH 4/4] local replica of #1010 --- runtime/Python2/src/antlr4/atn/ATNConfig.py | 2 +- runtime/Python3/src/antlr4/atn/ATNConfig.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/Python2/src/antlr4/atn/ATNConfig.py b/runtime/Python2/src/antlr4/atn/ATNConfig.py index 1e83db86b..c8ffa8755 100644 --- a/runtime/Python2/src/antlr4/atn/ATNConfig.py +++ b/runtime/Python2/src/antlr4/atn/ATNConfig.py @@ -140,7 +140,7 @@ class LexerATNConfig(ATNConfig): return False if self.passedThroughNonGreedyDecision != other.passedThroughNonGreedyDecision: return False - if self.lexerActionExecutor is not other.lexerActionExecutor: + if not(self.lexerActionExecutor==other.lexerActionExecutor): return False return super(LexerATNConfig, self).__eq__(other) diff --git a/runtime/Python3/src/antlr4/atn/ATNConfig.py b/runtime/Python3/src/antlr4/atn/ATNConfig.py index 19eef663d..3eb34d292 100644 --- a/runtime/Python3/src/antlr4/atn/ATNConfig.py +++ b/runtime/Python3/src/antlr4/atn/ATNConfig.py @@ -146,7 +146,7 @@ class LexerATNConfig(ATNConfig): return False if self.passedThroughNonGreedyDecision != other.passedThroughNonGreedyDecision: return False - if self.lexerActionExecutor is not other.lexerActionExecutor: + if not(self.lexerActionExecutor == other.lexerActionExecutor): return False return super().__eq__(other)