From f12eaef24ffc1b73097afd81d3d9c35b5c32931f Mon Sep 17 00:00:00 2001 From: Peter Boyer Date: Tue, 15 Dec 2015 15:55:04 -0500 Subject: [PATCH] !== -> != --- runtime/Go/src/antlr4/CommonTokenFactory.go | 4 +- runtime/Go/src/antlr4/LL1Analyzer.go | 6 +- runtime/Go/src/antlr4/Parser.go | 46 +++++----- runtime/Go/src/antlr4/ParserRuleContext.go | 2 +- runtime/Go/src/antlr4/PredictionContext.go | 56 ++++++------ runtime/Go/src/antlr4/Recognizer.go | 5 +- runtime/Go/src/antlr4/RuleContext.go | 6 +- runtime/Go/src/antlr4/Token.go | 16 ++-- runtime/Go/src/antlr4/atn/ATN.go | 6 +- runtime/Go/src/antlr4/atn/ATNConfig.go | 20 ++--- runtime/Go/src/antlr4/atn/ATNConfigSet.go | 10 +-- runtime/Go/src/antlr4/atn/ATNDeserializer.go | 30 +++---- runtime/Go/src/antlr4/atn/ATNState.go | 2 +- .../Go/src/antlr4/atn/LexerATNSimulator.go | 26 +++--- .../Go/src/antlr4/atn/LexerActionExecutor.go | 2 +- .../Go/src/antlr4/atn/ParserATNSimulator.go | 86 +++++++++---------- runtime/Go/src/antlr4/atn/PredictionMode.go | 6 +- runtime/Go/src/antlr4/atn/SemanticContext.go | 8 +- runtime/Go/src/antlr4/atn/Transition.go | 2 +- runtime/Go/src/antlr4/dfa/DFA.go | 2 +- runtime/Go/src/antlr4/dfa/DFASerializer.go | 8 +- runtime/Go/src/antlr4/dfa/DFAState.go | 4 +- .../antlr4/error/DiagnosticErrorListener.go | 2 +- runtime/Go/src/antlr4/error/ErrorStrategy.go | 16 ++-- runtime/Go/src/antlr4/error/Errors.go | 6 +- runtime/Go/src/antlr4/tree/Tree.go | 2 +- runtime/Go/src/antlr4/tree/Trees.go | 10 +-- 27 files changed, 194 insertions(+), 195 deletions(-) diff --git a/runtime/Go/src/antlr4/CommonTokenFactory.go b/runtime/Go/src/antlr4/CommonTokenFactory.go index a43332e37..7fc60f49e 100644 --- a/runtime/Go/src/antlr4/CommonTokenFactory.go +++ b/runtime/Go/src/antlr4/CommonTokenFactory.go @@ -48,9 +48,9 @@ func (this *CommonTokenFactory) create(source, type, text, channel, start, stop, var t = new CommonToken(source, type, channel, start, stop) t.line = line t.column = column - if (text !==nil) { + if (text !=nil) { t.text = text - } else if (this.copyText && source[1] !==nil) { + } else if (this.copyText && source[1] !=nil) { t.text = source[1].getText(start,stop) } return t diff --git a/runtime/Go/src/antlr4/LL1Analyzer.go b/runtime/Go/src/antlr4/LL1Analyzer.go index 0eab5d6aa..19da16e67 100644 --- a/runtime/Go/src/antlr4/LL1Analyzer.go +++ b/runtime/Go/src/antlr4/LL1Analyzer.go @@ -88,7 +88,7 @@ LL1func (this *Analyzer) LOOK(s, stopState, ctx) { var r = new IntervalSet() var seeThruPreds = true // ignore preds get all lookahead ctx = ctx || nil - var lookContext = ctx!==nil ? predictionContextFromRuleContext(s.atn, ctx) : nil + var lookContext = ctx!=nil ? predictionContextFromRuleContext(s.atn, ctx) : nil this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true) return r } @@ -146,7 +146,7 @@ LL1func (this *Analyzer) _LOOK(s, stopState , ctx, look, lookBusy, calledRuleSta look.addOne(Token.EOF) return } - if (ctx !== PredictionContext.EMPTY) { + if (ctx != PredictionContext.EMPTY) { // run thru all possible stack tops in ctx for(var i=0 i= 0) { p._parseListeners.splice(idx, 1) @@ -215,7 +215,7 @@ func (p.*Parser) removeParseListeners() { // Notify any parse listeners of an enter rule event. func (p.*Parser) triggerEnterRuleEvent() { - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { var ctx = p._ctx p._parseListeners.map(function(listener) { listener.enterEveryRule(ctx) @@ -230,7 +230,7 @@ func (p.*Parser) triggerEnterRuleEvent() { // @see //addParseListener // func (p.*Parser) triggerExitRuleEvent() { - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { // reverse order walk of listeners var ctx = p._ctx p._parseListeners.slice(0).reverse().map(function(listener) { @@ -287,7 +287,7 @@ var Lexer = require('./Lexer').Lexer func (p.*Parser) compileParseTreePattern(pattern, patternRuleIndex, lexer) { lexer = lexer || nil if (lexer == nil) { - if (p.getTokenStream() !== nil) { + if (p.getTokenStream() != nil) { var tokenSource = p.getTokenStream().tokenSource if (tokenSource instanceof Lexer) { lexer = tokenSource @@ -363,10 +363,10 @@ func (p.*Parser) notifyErrorListeners(msg, offendingToken, err) { // func (p.*Parser) consume() { var o = p.getCurrentToken() - if (o.type !== Token.EOF) { + if (o.type != Token.EOF) { p.getInputStream().consume() } - var hasListener = p._parseListeners !== nil && p._parseListeners.length > 0 + var hasListener = p._parseListeners != nil && p._parseListeners.length > 0 if (p.buildParseTrees || hasListener) { var node if (p._errHandler.inErrorRecoveryMode(p.) { @@ -386,7 +386,7 @@ func (p.*Parser) consume() { func (p.*Parser) addContextToParseTree() { // add current context to parent if we have a parent - if (p._ctx.parentCtx !== nil) { + if (p._ctx.parentCtx != nil) { p._ctx.parentCtx.addChild(p._ctx) } } @@ -401,7 +401,7 @@ func (p.*Parser) enterRule(localctx, state, ruleIndex) { if (p.buildParseTrees) { p.addContextToParseTree() } - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { p.triggerEnterRuleEvent() } } @@ -409,7 +409,7 @@ func (p.*Parser) enterRule(localctx, state, ruleIndex) { func (p.*Parser) exitRule() { p._ctx.stop = p._input.LT(-1) // trigger event on _ctx, before it reverts to parent - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { p.triggerExitRuleEvent() } p.state = p._ctx.invokingState @@ -419,8 +419,8 @@ func (p.*Parser) exitRule() { func (p.*Parser) enterOuterAlt(localctx, altNum) { // if we have new localctx, make sure we replace existing ctx // that is previous child of parse tree - if (p.buildParseTrees && p._ctx !== localctx) { - if (p._ctx.parentCtx !== nil) { + if (p.buildParseTrees && p._ctx != localctx) { + if (p._ctx.parentCtx != nil) { p._ctx.parentCtx.removeLastChild() p._ctx.parentCtx.addChild(localctx) } @@ -447,7 +447,7 @@ func (p.*Parser) enterRecursionRule(localctx, state, ruleIndex, p._precedenceStack.push(precedence) p._ctx = localctx p._ctx.start = p._input.LT(1) - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { p.triggerEnterRuleEvent() // simulates rule entry for // left-recursive rules } @@ -467,7 +467,7 @@ func (p.*Parser) pushNewRecursionContext(localctx, state, ruleIndex) { if (p.buildParseTrees) { p._ctx.addChild(previous) } - if (p._parseListeners !== nil) { + if (p._parseListeners != nil) { p.triggerEnterRuleEvent() // simulates rule entry for // left-recursive rules } @@ -478,8 +478,8 @@ func (p.*Parser) unrollRecursionContexts(parentCtx) { p._ctx.stop = p._input.LT(-1) var retCtx = p._ctx // save current ctx (return value) // unroll so _ctx is as it was before call to recursive method - if (p._parseListeners !== nil) { - while (p._ctx !== parentCtx) { + if (p._parseListeners != nil) { + while (p._ctx != parentCtx) { p.triggerExitRuleEvent() p._ctx = p._ctx.parentCtx } @@ -488,7 +488,7 @@ func (p.*Parser) unrollRecursionContexts(parentCtx) { } // hook into tree retCtx.parentCtx = parentCtx - if (p.buildParseTrees && parentCtx !== nil) { + if (p.buildParseTrees && parentCtx != nil) { // add return ctx into invoking rule's tree parentCtx.addChild(retCtx) } @@ -496,7 +496,7 @@ func (p.*Parser) unrollRecursionContexts(parentCtx) { func (p.*Parser) getInvokingContext(ruleIndex) { var ctx = p._ctx - while (ctx !== nil) { + while (ctx != nil) { if (ctx.ruleIndex == ruleIndex) { return ctx } @@ -539,7 +539,7 @@ func (p.*Parser) isExpectedToken(symbol) { if (!following.contains(Token.EPSILON)) { return false } - while (ctx !== nil && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) { + while (ctx != nil && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) { var invokingState = atn.states[ctx.invokingState] var rt = invokingState.transitions[0] following = atn.nextTokens(rt.followState) @@ -574,7 +574,7 @@ func (p.*Parser) getExpectedTokensWithinCurrentRule() { // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.// func (p.*Parser) getRuleIndex(ruleName) { var ruleIndex = p.getRuleIndexMap()[ruleName] - if (ruleIndex !== nil) { + if (ruleIndex != nil) { return ruleIndex } else { return -1 @@ -594,7 +594,7 @@ func (p.*Parser) getRuleInvocationStack(p) { p = p._ctx } var stack = [] - while (p !== nil) { + while (p != nil) { // compute what follows who invoked us var ruleIndex = p.ruleIndex if (ruleIndex < 0) { @@ -646,7 +646,7 @@ func (p.*Parser) setTrace(trace) { p.removeParseListener(p._tracer) p._tracer = nil } else { - if (p._tracer !== nil) { + if (p._tracer != nil) { p.removeParseListener(p._tracer) } p._tracer = new TraceListener(p. diff --git a/runtime/Go/src/antlr4/ParserRuleContext.go b/runtime/Go/src/antlr4/ParserRuleContext.go index 104a77a47..bbe7687b4 100644 --- a/runtime/Go/src/antlr4/ParserRuleContext.go +++ b/runtime/Go/src/antlr4/ParserRuleContext.go @@ -84,7 +84,7 @@ func (this *ParserRuleContext) addChild(child) { // generic ruleContext object. // / func (this *ParserRuleContext) removeLastChild() { - if (this.children !== nil) { + if (this.children != nil) { this.children.pop() } } diff --git a/runtime/Go/src/antlr4/PredictionContext.go b/runtime/Go/src/antlr4/PredictionContext.go index 70634b418..f88570f38 100644 --- a/runtime/Go/src/antlr4/PredictionContext.go +++ b/runtime/Go/src/antlr4/PredictionContext.go @@ -84,7 +84,7 @@ func (this *PredictionContextCache) add(ctx) { return PredictionContext.EMPTY } var existing = this.cache[ctx] || nil - if (existing !== nil) { + if (existing != nil) { return existing } this.cache[ctx] = ctx @@ -102,7 +102,7 @@ Object.defineProperty(PredictionContextCache.prototype, "length", { }) func SingletonPredictionContext(parent, returnState) { - var hashString = parent !== nil ? calculateHashString(parent, returnState) + var hashString = parent != nil ? calculateHashString(parent, returnState) : calculateEmptyHashString() PredictionContext.call(this, hashString) this.parentCtx = parent @@ -140,10 +140,10 @@ func (this *SingletonPredictionContext) equals(other) { return true } else if (!(other instanceof SingletonPredictionContext)) { return false - } else if (this.hashString() !== other.hashString()) { + } else if (this.hashString() != other.hashString()) { return false // can't be same if hash is different } else { - if(this.returnState !== other.returnState) + if(this.returnState != other.returnState) return false else if(this.parentCtx==nil) return other.parentCtx==nil @@ -239,7 +239,7 @@ func (this *ArrayPredictionContext) equals(other) { return true } else if (!(other instanceof ArrayPredictionContext)) { return false - } else if (this.hashString !== other.hashString()) { + } else if (this.hashString != other.hashString()) { return false // can't be same if hash is different } else { return this.returnStates == other.returnStates && @@ -261,7 +261,7 @@ func (this *ArrayPredictionContext) toString() { continue } s = s + this.returnStates[i] - if (this.parents[i] !== nil) { + if (this.parents[i] != nil) { s = s + " " + this.parents[i] } else { s = s + "nil" @@ -361,20 +361,20 @@ func merge(a, b, rootIsWildcard, mergeCache) { // @param mergeCache // / func mergeSingletons(a, b, rootIsWildcard, mergeCache) { - if (mergeCache !== nil) { + if (mergeCache != nil) { var previous = mergeCache.get(a, b) - if (previous !== nil) { + if (previous != nil) { return previous } previous = mergeCache.get(b, a) - if (previous !== nil) { + if (previous != nil) { return previous } } var rootMerge = mergeRoot(a, b, rootIsWildcard) - if (rootMerge !== nil) { - if (mergeCache !== nil) { + if (rootMerge != nil) { + if (mergeCache != nil) { mergeCache.set(a, b, rootMerge) } return rootMerge @@ -394,19 +394,19 @@ func mergeSingletons(a, b, rootIsWildcard, mergeCache) { // of those graphs. dup a, a' points at merged array // new joined parent so create new singleton pointing to it, a' var spc = SingletonPredictionContext.create(parent, a.returnState) - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, spc) } return spc } else { // a != b payloads differ // see if we can collapse parents due to $+x parents if local ctx var singleParent = nil - if (a == b || (a.parentCtx !== nil && a.parentCtx == b.parentCtx)) { // ax + + if (a == b || (a.parentCtx != nil && a.parentCtx == b.parentCtx)) { // ax + // bx = // [a,b]x singleParent = a.parentCtx } - if (singleParent !== nil) { // parents are same + if (singleParent != nil) { // parents are same // sort payloads and use same parent var payloads = [ a.returnState, b.returnState ] if (a.returnState > b.returnState) { @@ -415,7 +415,7 @@ func mergeSingletons(a, b, rootIsWildcard, mergeCache) { } var parents = [ singleParent, singleParent ] var apc = new ArrayPredictionContext(parents, payloads) - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, apc) } return apc @@ -431,7 +431,7 @@ func mergeSingletons(a, b, rootIsWildcard, mergeCache) { parents = [ b.parentCtx, a.parentCtx ] } var a_ = new ArrayPredictionContext(parents, payloads) - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, a_) } return a_ @@ -522,13 +522,13 @@ func mergeRoot(a, b, rootIsWildcard) { //

// / func mergeArrays(a, b, rootIsWildcard, mergeCache) { - if (mergeCache !== nil) { + if (mergeCache != nil) { var previous = mergeCache.get(a, b) - if (previous !== nil) { + if (previous != nil) { return previous } previous = mergeCache.get(b, a) - if (previous !== nil) { + if (previous != nil) { return previous } } @@ -549,7 +549,7 @@ func mergeArrays(a, b, rootIsWildcard, mergeCache) { // $+$ = $ var bothDollars = payload == PredictionContext.EMPTY_RETURN_STATE && a_parent == nil && b_parent == nil - var ax_ax = (a_parent !== nil && b_parent !== nil && a_parent == b_parent) // ax+ax + var ax_ax = (a_parent != nil && b_parent != nil && a_parent == b_parent) // ax+ax // -> // ax if (bothDollars || ax_ax) { @@ -592,7 +592,7 @@ func mergeArrays(a, b, rootIsWildcard, mergeCache) { if (k == 1) { // for just one merged element, return singleton top var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]) - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, a_) } return a_ @@ -606,20 +606,20 @@ func mergeArrays(a, b, rootIsWildcard, mergeCache) { // if we created same array as a or b, return that instead // TODO: track whether this is possible above during merge sort for speed if (M == a) { - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, a) } return a } if (M == b) { - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, b) } return b } combineCommonParents(mergedParents) - if (mergeCache !== nil) { + if (mergeCache != nil) { mergeCache.set(a, b, M) } return M @@ -648,11 +648,11 @@ func getCachedPredictionContext(context, contextCache, visited) { return context } var existing = visited[context] || nil - if (existing !== nil) { + if (existing != nil) { return existing } existing = contextCache.get(context) - if (existing !== nil) { + if (existing != nil) { visited[context] = existing return existing } @@ -660,7 +660,7 @@ func getCachedPredictionContext(context, contextCache, visited) { var parents = [] for (var i = 0 i < parents.length i++) { var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited) - if (changed || parent !== context.getParent(i)) { + if (changed || parent != context.getParent(i)) { if (!changed) { parents = [] for (var j = 0 j < context.length j++) { @@ -701,7 +701,7 @@ func getAllContextNodes(context, nodes, visited) { visited = {} return getAllContextNodes(context, nodes, visited) } else { - if (context == nil || visited[context] !== nil) { + if (context == nil || visited[context] != nil) { return nodes } visited[context] = context diff --git a/runtime/Go/src/antlr4/Recognizer.go b/runtime/Go/src/antlr4/Recognizer.go index a7ef8b87f..5723cf762 100644 --- a/runtime/Go/src/antlr4/Recognizer.go +++ b/runtime/Go/src/antlr4/Recognizer.go @@ -14,10 +14,9 @@ type Recognizer struct { Recognizer.tokenTypeMapCache = {} Recognizer.ruleIndexMapCache = {} - func (this *Recognizer) checkVersion(toolVersion) { var runtimeVersion = "4.5.1" - if (runtimeVersion!==toolVersion) { + if (runtimeVersion!=toolVersion) { console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion) } } @@ -63,7 +62,7 @@ func (this *Recognizer) getRuleIndexMap() { func (this *Recognizer) getTokenType(tokenName) { var ttype = this.getTokenTypeMap()[tokenName] - if (ttype !==undefined) { + if (ttype !=undefined) { return ttype } else { return Token.INVALID_TYPE diff --git a/runtime/Go/src/antlr4/RuleContext.go b/runtime/Go/src/antlr4/RuleContext.go index 50002c251..b6465485d 100644 --- a/runtime/Go/src/antlr4/RuleContext.go +++ b/runtime/Go/src/antlr4/RuleContext.go @@ -41,7 +41,7 @@ RuleContext.prototype.constructor = RuleContext func (this *RuleContext) depth() { var n = 0 var p = this - while (p !== nil) { + while (p != nil) { p = p.parentCtx n += 1 } @@ -115,7 +115,7 @@ func (this *RuleContext) toString(ruleNames, stop) { stop = stop || nil var p = this var s = "[" - while (p !== nil && p !== stop) { + while (p != nil && p != stop) { if (ruleNames == nil) { if (!p.isEmpty()) { s += p.invokingState @@ -126,7 +126,7 @@ func (this *RuleContext) toString(ruleNames, stop) { : "" + ri s += ruleName } - if (p.parentCtx !== nil && (ruleNames !== nil || !p.parentCtx.isEmpty())) { + if (p.parentCtx != nil && (ruleNames != nil || !p.parentCtx.isEmpty())) { s += " " } p = p.parentCtx diff --git a/runtime/Go/src/antlr4/Token.go b/runtime/Go/src/antlr4/Token.go index a7d2ca183..a73d9186c 100644 --- a/runtime/Go/src/antlr4/Token.go +++ b/runtime/Go/src/antlr4/Token.go @@ -65,13 +65,13 @@ func (this *Token) getInputStream() { func CommonToken(source, type, channel, start, stop) { Token.call(this) - this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE - this.type = type !== undefined ? type : nil - this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL - this.start = start !== undefined ? start : -1 - this.stop = stop !== undefined ? stop : -1 + this.source = source != undefined ? source : CommonToken.EMPTY_SOURCE + this.type = type != undefined ? type : nil + this.channel = channel != undefined ? channel : Token.DEFAULT_CHANNEL + this.start = start != undefined ? start : -1 + this.stop = stop != undefined ? stop : -1 this.tokenIndex = -1 - if (this.source[0] !== nil) { + if (this.source[0] != nil) { this.line = source[0].line this.column = source[0].column } else { @@ -111,7 +111,7 @@ func (this *CommonToken) clone() { Object.defineProperty(CommonToken.prototype, "text", { get : function() { - if (this._text !== nil) { + if (this._text != nil) { return this._text } var input = this.getInputStream() @@ -132,7 +132,7 @@ Object.defineProperty(CommonToken.prototype, "text", { func (this *CommonToken) toString() { var txt = this.text - if (txt !== nil) { + if (txt != nil) { txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t") } else { txt = "" diff --git a/runtime/Go/src/antlr4/atn/ATN.go b/runtime/Go/src/antlr4/atn/ATN.go index 9ae42b749..82258ae7c 100644 --- a/runtime/Go/src/antlr4/atn/ATN.go +++ b/runtime/Go/src/antlr4/atn/ATN.go @@ -63,7 +63,7 @@ func (this *ATN) nextTokensInContext(s, ctx) { // staying in same rule. {@link Token//EPSILON} is in set if we reach end of // rule. func (this *ATN) nextTokensNoContext(s) { - if (s.nextTokenWithinRule !== nil ) { + if (s.nextTokenWithinRule != nil ) { return s.nextTokenWithinRule } s.nextTokenWithinRule = this.nextTokensInContext(s, nil) @@ -80,7 +80,7 @@ func (this *ATN) nextTokens(s, ctx) { } func (this *ATN) addState( state) { - if ( state !== nil ) { + if ( state != nil ) { state.atn = this state.stateNumber = this.states.length } @@ -137,7 +137,7 @@ func (this *ATN) getExpectedTokens( stateNumber, ctx ) { var expected = new IntervalSet() expected.addSet(following) expected.removeOne(Token.EPSILON) - while (ctx !== nil && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) { + while (ctx != nil && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) { var invokingState = this.states[ctx.invokingState] var rt = invokingState.transitions[0] following = this.nextTokens(rt.followState) diff --git a/runtime/Go/src/antlr4/atn/ATNConfig.go b/runtime/Go/src/antlr4/atn/ATNConfig.go index d9209fcfd..6ed0568aa 100644 --- a/runtime/Go/src/antlr4/atn/ATNConfig.go +++ b/runtime/Go/src/antlr4/atn/ATNConfig.go @@ -37,15 +37,15 @@ func ATNConfig(params, config) { params = checkParams(params) config = checkParams(config, true) // The ATN state associated with this configuration/// - this.state = params.state!==nil ? params.state : config.state + this.state = params.state!=nil ? params.state : config.state // What alt (or lexer rule) is predicted by this configuration/// - this.alt = params.alt!==nil ? params.alt : config.alt + this.alt = params.alt!=nil ? params.alt : config.alt // The stack of invoking states leading to the rule/states associated // with this config. We track only those contexts pushed during // execution of the ATN simulator. - this.context = params.context!==nil ? params.context : config.context - this.semanticContext = params.semanticContext!==nil ? params.semanticContext : - (config.semanticContext!==nil ? config.semanticContext : SemanticContext.NONE) + this.context = params.context!=nil ? params.context : config.context + this.semanticContext = params.semanticContext!=nil ? params.semanticContext : + (config.semanticContext!=nil ? config.semanticContext : SemanticContext.NONE) // We cannot execute predicates dependent upon local context unless // we know for sure we are in the correct context. Because there is // no way to do this efficiently, we simply cannot evaluate @@ -97,8 +97,8 @@ func (this *ATNConfig) hashString() { func (this *ATNConfig) toString() { return "(" + this.state + "," + this.alt + - (this.context!==nil ? ",[" + this.context.toString() + "]" : "") + - (this.semanticContext !== SemanticContext.NONE ? + (this.context!=nil ? ",[" + this.context.toString() + "]" : "") + + (this.semanticContext != SemanticContext.NONE ? ("," + this.semanticContext.toString()) : "") + (this.reachesIntoOuterContext>0 ? @@ -112,8 +112,8 @@ func LexerATNConfig(params, config) { // This is the backing field for {@link //getLexerActionExecutor}. var lexerActionExecutor = params.lexerActionExecutor || nil - this.lexerActionExecutor = lexerActionExecutor || (config!==nil ? config.lexerActionExecutor : nil) - this.passedThroughNonGreedyDecision = config!==nil ? this.checkNonGreedyDecision(config, this.state) : false + this.lexerActionExecutor = lexerActionExecutor || (config!=nil ? config.lexerActionExecutor : nil) + this.passedThroughNonGreedyDecision = config!=nil ? this.checkNonGreedyDecision(config, this.state) : false return this } @@ -131,7 +131,7 @@ func (this *LexerATNConfig) equals(other) { return true } else if (!(other instanceof LexerATNConfig)) { return false - } else if (this.passedThroughNonGreedyDecision !== other.passedThroughNonGreedyDecision) { + } else if (this.passedThroughNonGreedyDecision != other.passedThroughNonGreedyDecision) { return false } else if (this.lexerActionExecutor ? !this.lexerActionExecutor.equals(other.lexerActionExecutor) diff --git a/runtime/Go/src/antlr4/atn/ATNConfigSet.go b/runtime/Go/src/antlr4/atn/ATNConfigSet.go index 07c09af8f..93ae65376 100644 --- a/runtime/Go/src/antlr4/atn/ATNConfigSet.go +++ b/runtime/Go/src/antlr4/atn/ATNConfigSet.go @@ -87,7 +87,7 @@ func (this *ATNConfigSet) add(config, mergeCache) { if (this.readOnly) { throw "This set is readonly" } - if (config.semanticContext !== SemanticContext.NONE) { + if (config.semanticContext != SemanticContext.NONE) { this.hasSemanticContext = true } if (config.reachesIntoOuterContext > 0) { @@ -126,7 +126,7 @@ func (this *ATNConfigSet) getPredicates() { var preds = [] for (var i = 0 i < this.configs.length i++) { var c = this.configs[i].semanticContext - if (c !== SemanticContext.NONE) { + if (c != SemanticContext.NONE) { preds.push(c.semanticContext) } } @@ -165,7 +165,7 @@ func (this *ATNConfigSet) equals(other) { } else if (!(other instanceof ATNConfigSet)) { return false } - return this.configs !== nil && this.configs.equals(other.configs) && + return this.configs != nil && this.configs.equals(other.configs) && this.fullCtx == other.fullCtx && this.uniqueAlt == other.uniqueAlt && this.conflictingAlts == other.conflictingAlts && @@ -235,8 +235,8 @@ func (this *ATNConfigSet) setReadonly(readOnly) { func (this *ATNConfigSet) toString() { return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + - (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + - (this.conflictingAlts !== nil ? ",conflictingAlts=" + this.conflictingAlts : "") + + (this.uniqueAlt != ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + + (this.conflictingAlts != nil ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "") } diff --git a/runtime/Go/src/antlr4/atn/ATNDeserializer.go b/runtime/Go/src/antlr4/atn/ATNDeserializer.go index d1005e8d8..96a077e69 100644 --- a/runtime/Go/src/antlr4/atn/ATNDeserializer.go +++ b/runtime/Go/src/antlr4/atn/ATNDeserializer.go @@ -132,7 +132,7 @@ func (this *ATNDeserializer) reset(data) { func (this *ATNDeserializer) checkVersion() { var version = this.readInt() - if ( version !== SERIALIZED_VERSION ) { + if ( version != SERIALIZED_VERSION ) { throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").") } } @@ -249,7 +249,7 @@ func (this *ATNDeserializer) readSets(atn) { sets.push(iset) var n = this.readInt() var containsEof = this.readInt() - if (containsEof!==0) { + if (containsEof!=0) { iset.addOne(-1) } for (var j=0 j= 0) } else { @@ -588,17 +588,17 @@ ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2 case Transition.EPSILON: return new EpsilonTransition(target) case Transition.RANGE: - return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2) + return arg3 != 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2) case Transition.RULE: return new RuleTransition(atn.states[arg1], arg2, arg3, target) case Transition.PREDICATE: - return new PredicateTransition(target, arg1, arg2, arg3 !== 0) + return new PredicateTransition(target, arg1, arg2, arg3 != 0) case Transition.PRECEDENCE: return new PrecedencePredicateTransition(target, arg1) case Transition.ATOM: - return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1) + return arg3 != 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1) case Transition.ACTION: - return new ActionTransition(target, arg1, arg2, arg3 !== 0) + return new ActionTransition(target, arg1, arg2, arg3 != 0) case Transition.SET: return new SetTransition(target, sets[arg1]) case Transition.NOT_SET: @@ -632,7 +632,7 @@ func (this *ATNDeserializer) stateFactory(type, ruleIndex) { throw("The specified state type " + type + " is not valid.") } else { var s = this.stateFactories[type]() - if (s!==nil) { + if (s!=nil) { s.ruleIndex = ruleIndex return s } diff --git a/runtime/Go/src/antlr4/atn/ATNState.go b/runtime/Go/src/antlr4/atn/ATNState.go index 1d1709bc1..8d5219107 100644 --- a/runtime/Go/src/antlr4/atn/ATNState.go +++ b/runtime/Go/src/antlr4/atn/ATNState.go @@ -131,7 +131,7 @@ func (this *ATNState) addTransition(trans, index) { } if (this.transitions.length==0) { this.epsilonOnlyTransitions = trans.isEpsilon - } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) { + } else if(this.epsilonOnlyTransitions != trans.isEpsilon) { this.epsilonOnlyTransitions = false } if (index==-1) { diff --git a/runtime/Go/src/antlr4/atn/LexerATNSimulator.go b/runtime/Go/src/antlr4/atn/LexerATNSimulator.go index b7e6580a5..601e90cc8 100644 --- a/runtime/Go/src/antlr4/atn/LexerATNSimulator.go +++ b/runtime/Go/src/antlr4/atn/LexerATNSimulator.go @@ -184,7 +184,7 @@ LexerATNSimulator.prototype.execATN = function(input, ds0) { // capturing the accept state so the input index, line, and char // position accurately reflect the state of the interpreter at the // end of the token. - if (t !== Token.EOF) { + if (t != Token.EOF) { this.consume(input) } if (target.isAcceptState) { @@ -217,7 +217,7 @@ func (this *LexerATNSimulator) getExistingTargetState(s, t) { if(target==undefined) { target = nil } - if (this.debug && target !== nil) { + if (this.debug && target != nil) { console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber) } return target @@ -253,7 +253,7 @@ func (this *LexerATNSimulator) computeTargetState(input, s, t) { } func (this *LexerATNSimulator) failOrAccept(prevAccept, input, reach, t) { - if (this.prevAccept.dfaState !== nil) { + if (this.prevAccept.dfaState != nil) { var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column) @@ -288,9 +288,9 @@ func (this *LexerATNSimulator) getReachableConfigSet(input, closure, for (var j = 0 j < cfg.state.transitions.length j++) { var trans = cfg.state.transitions[j] // for each transition var target = this.getReachableTarget(trans, t) - if (target !== nil) { + if (target != nil) { var lexerActionExecutor = cfg.lexerActionExecutor - if (lexerActionExecutor !== nil) { + if (lexerActionExecutor != nil) { lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex) } var treatEofAsEpsilon = (t == Token.EOF) @@ -315,7 +315,7 @@ func (this *LexerATNSimulator) accept(input, lexerActionExecutor, input.seek(index) this.line = line this.column = charPos - if (lexerActionExecutor !== nil && this.recog !== nil) { + if (lexerActionExecutor != nil && this.recog != nil) { lexerActionExecutor.execute(this.recog, input, startIndex) } } @@ -355,7 +355,7 @@ func (this *LexerATNSimulator) closure(input, config, configs, } if (config.state instanceof RuleStopState) { if (this.debug) { - if (this.recog !== nil) { + if (this.recog != nil) { console.log("closure at %s rule stop %s\n", this.recog.getRuleNames()[config.state.ruleIndex], config) } else { console.log("closure at rule stop %s\n", config) @@ -370,9 +370,9 @@ func (this *LexerATNSimulator) closure(input, config, configs, currentAltReachedAcceptState = true } } - if (config.context !== nil && !config.context.isEmpty()) { + if (config.context != nil && !config.context.isEmpty()) { for (var i = 0 i < config.context.length i++) { - if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) { + if (config.context.getReturnState(i) != PredictionContext.EMPTY_RETURN_STATE) { var newContext = config.context.getParent(i) // "pop" return state var returnState = this.atn.states[config.context.getReturnState(i)] cfg = new LexerATNConfig({ state:returnState, context:newContext }, config) @@ -393,7 +393,7 @@ func (this *LexerATNSimulator) closure(input, config, configs, for (var j = 0 j < config.state.transitions.length j++) { var trans = config.state.transitions[j] cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon) - if (cfg !== nil) { + if (cfg != nil) { currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) } @@ -529,7 +529,7 @@ func (this *LexerATNSimulator) addDFAEdge(from_, tk, to, cfgs) { if (cfgs == undefined) { cfgs = nil } - if (to == nil && cfgs !== nil) { + if (to == nil && cfgs != nil) { // leading to this call, ATNConfigSet.hasSemanticContext is used as a // marker indicating dynamic predicate evaluation makes this edge // dependent on the specific input sequence, so the static edge in the @@ -581,7 +581,7 @@ func (this *LexerATNSimulator) addDFAState(configs) { break } } - if (firstConfigWithRuleStopState !== nil) { + if (firstConfigWithRuleStopState != nil) { proposed.isAcceptState = true proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex] @@ -589,7 +589,7 @@ func (this *LexerATNSimulator) addDFAState(configs) { var hash = proposed.hashString() var dfa = this.decisionToDFA[this.mode] var existing = dfa.states[hash] || nil - if (existing!==nil) { + if (existing!=nil) { return existing } var newState = proposed diff --git a/runtime/Go/src/antlr4/atn/LexerActionExecutor.go b/runtime/Go/src/antlr4/atn/LexerActionExecutor.go index 07c2ccb70..3a9565ebe 100644 --- a/runtime/Go/src/antlr4/atn/LexerActionExecutor.go +++ b/runtime/Go/src/antlr4/atn/LexerActionExecutor.go @@ -114,7 +114,7 @@ func (this *LexerActionExecutor) execute(lexer, input, startIndex) { var offset = lexerAction.offset input.seek(startIndex + offset) lexerAction = lexerAction.action - requiresSeek = (startIndex + offset) !== stopIndex + requiresSeek = (startIndex + offset) != stopIndex } else if (lexerAction.isPositionDependent) { input.seek(stopIndex) requiresSeek = false diff --git a/runtime/Go/src/antlr4/atn/ParserATNSimulator.go b/runtime/Go/src/antlr4/atn/ParserATNSimulator.go index 9ce4760fb..3e201dcd6 100644 --- a/runtime/Go/src/antlr4/atn/ParserATNSimulator.go +++ b/runtime/Go/src/antlr4/atn/ParserATNSimulator.go @@ -431,21 +431,21 @@ ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, oute var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex) input.seek(startIndex) alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext) - if(alt!==ATN.INVALID_ALT_NUMBER) { + if(alt!=ATN.INVALID_ALT_NUMBER) { return alt } else { throw e } } - if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) { + if(D.requiresFullContext && this.predictionMode != PredictionMode.SLL) { // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error) var conflictingAlts = nil - if (D.predicates!==nil) { + if (D.predicates!=nil) { if (this.debug) { console.log("DFA state has preds in DFA sim LL failover") } var conflictIndex = input.index - if(conflictIndex !== startIndex) { + if(conflictIndex != startIndex) { input.seek(startIndex) } conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true) @@ -455,7 +455,7 @@ ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, oute } return conflictingAlts.minValue() } - if (conflictIndex !== startIndex) { + if (conflictIndex != startIndex) { // restore the index so reporting the fallback to full // context occurs with the index at the correct spot input.seek(conflictIndex) @@ -489,7 +489,7 @@ ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, oute } previousD = D - if (t !== Token.EOF) { + if (t != Token.EOF) { input.consume() t = input.LA(1) } @@ -547,7 +547,7 @@ func (this *ParserATNSimulator) computeTargetState(dfa, previousD, t) { PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach)) } - if (predictedAlt!==ATN.INVALID_ALT_NUMBER) { + if (predictedAlt!=ATN.INVALID_ALT_NUMBER) { // NO CONFLICT, UNIQUELY PREDICTED ALT D.isAcceptState = true D.configs.uniqueAlt = predictedAlt @@ -562,7 +562,7 @@ func (this *ParserATNSimulator) computeTargetState(dfa, previousD, t) { } if (D.isAcceptState && D.configs.hasSemanticContext) { this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision)) - if( D.predicates!==nil) { + if( D.predicates!=nil) { D.prediction = ATN.INVALID_ALT_NUMBER } } @@ -579,7 +579,7 @@ func (this *ParserATNSimulator) predicateDFAState(dfaState, decisionState) { // pairs if preds found for conflicting alts var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs) var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts) - if (altToPred!==nil) { + if (altToPred!=nil) { dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred) dfaState.prediction = ATN.INVALID_ALT_NUMBER // make sure we use preds } else { @@ -621,7 +621,7 @@ ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how fa var e = this.noViableAlt(input, outerContext, previous, startIndex) input.seek(startIndex) var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext) - if(alt!==ATN.INVALID_ALT_NUMBER) { + if(alt!=ATN.INVALID_ALT_NUMBER) { return alt } else { throw e @@ -635,12 +635,12 @@ ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how fa } reach.uniqueAlt = this.getUniqueAlt(reach) // unique prediction? - if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) { + if(reach.uniqueAlt!=ATN.INVALID_ALT_NUMBER) { predictedAlt = reach.uniqueAlt break - } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) { + } else if (this.predictionMode != PredictionMode.LL_EXACT_AMBIG_DETECTION) { predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets) - if(predictedAlt !== ATN.INVALID_ALT_NUMBER) { + if(predictedAlt != ATN.INVALID_ALT_NUMBER) { break } } else { @@ -656,7 +656,7 @@ ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how fa // So, keep going. } previous = reach - if( t !== Token.EOF) { + if( t != Token.EOF) { input.consume() t = input.LA(1) } @@ -664,7 +664,7 @@ ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how fa // If the configuration set uniquely predicts an alternative, // without conflict, then we know that it's a full LL decision // not SLL. - if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) { + if (reach.uniqueAlt != ATN.INVALID_ALT_NUMBER ) { this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index) return predictedAlt } @@ -742,7 +742,7 @@ func (this *ParserATNSimulator) computeReachSet(closure, t, fullCtx) { for(var j=0j0) { alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs) - if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists + if (alt!=ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists return alt } } @@ -1140,7 +1140,7 @@ func (this *ParserATNSimulator) splitAccordingToSemanticValidity( configs, outer var failed = new ATNConfigSet(configs.fullCtx) for(var i=0i 0. - if (closureBusy.add(c)!==c) { + if (closureBusy.add(c)!=c) { // avoid infinite recursion for right-recursive rules continue } - if (this._dfa !== nil && this._dfa.precedenceDfa) { + if (this._dfa != nil && this._dfa.precedenceDfa) { if (t.outermostPrecedenceReturn == this._dfa.atnStartState.ruleIndex) { c.precedenceFilterSuppressed = true } @@ -1309,7 +1309,7 @@ func (this *ParserATNSimulator) closure_(config, configs, closureBusy, collectPr } func (this *ParserATNSimulator) getRuleName( index) { - if (this.parser!==nil && index>=0) { + if (this.parser!=nil && index>=0) { return this.parser.ruleNames[index] } else { return "" @@ -1355,7 +1355,7 @@ func (this *ParserATNSimulator) precedenceTransition(config, pt, collectPredica if (this.debug) { console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true") - if (this.parser!==nil) { + if (this.parser!=nil) { console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack())) } } @@ -1390,7 +1390,7 @@ func (this *ParserATNSimulator) predTransition(config, pt, collectPredicates, in if (this.debug) { console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent) - if (this.parser!==nil) { + if (this.parser!=nil) { console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack())) } } @@ -1473,7 +1473,7 @@ func (this *ParserATNSimulator) getConflictingAlts(configs) { func (this *ParserATNSimulator) getConflictingAltsOrUniqueAlt(configs) { var conflictingAlts = nil - if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) { + if (configs.uniqueAlt!= ATN.INVALID_ALT_NUMBER) { conflictingAlts = new BitSet() conflictingAlts.add(configs.uniqueAlt) } else { @@ -1486,7 +1486,7 @@ func (this *ParserATNSimulator) getTokenName( t) { if (t==Token.EOF) { return "EOF" } - if( this.parser!==nil && this.parser.literalNames!==nil) { + if( this.parser!=nil && this.parser.literalNames!=nil) { if (t >= this.parser.literalNames.length) { console.log("" + t + " ttype out of range: " + this.parser.literalNames) console.log("" + this.parser.getInputStream().getTokens()) @@ -1534,7 +1534,7 @@ func (this *ParserATNSimulator) getUniqueAlt(configs) { var c = configs.items[i] if (alt == ATN.INVALID_ALT_NUMBER) { alt = c.alt // found first alt - } else if( c.alt!==alt) { + } else if( c.alt!=alt) { return ATN.INVALID_ALT_NUMBER } } @@ -1604,7 +1604,7 @@ func (this *ParserATNSimulator) addDFAState(dfa, D) { } var hash = D.hashString() var existing = dfa.states[hash] || nil - if(existing!==nil) { + if(existing!=nil) { return existing } D.stateNumber = dfa.states.length @@ -1625,7 +1625,7 @@ func (this *ParserATNSimulator) reportAttemptingFullContext(dfa, conflictingAlts console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval)) } - if (this.parser!==nil) { + if (this.parser!=nil) { this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs) } } @@ -1636,7 +1636,7 @@ func (this *ParserATNSimulator) reportContextSensitivity(dfa, prediction, config console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval)) } - if (this.parser!==nil) { + if (this.parser!=nil) { this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs) } } @@ -1649,7 +1649,7 @@ func (this *ParserATNSimulator) reportAmbiguity(dfa, D, startIndex, stopIndex, console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval)) } - if (this.parser!==nil) { + if (this.parser!=nil) { this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs) } } diff --git a/runtime/Go/src/antlr4/atn/PredictionMode.go b/runtime/Go/src/antlr4/atn/PredictionMode.go index cb30e3b2a..0d87f0195 100644 --- a/runtime/Go/src/antlr4/atn/PredictionMode.go +++ b/runtime/Go/src/antlr4/atn/PredictionMode.go @@ -440,7 +440,7 @@ PredictionMode.allSubsetsEqual = function(altsets) { var alts = altsets[i] if (first == nil) { first = alts - } else if (alts!==first) { + } else if (alts!=first) { return false } } @@ -499,7 +499,7 @@ PredictionMode.getConflictingAltSubsets = function(configs) { } var values = [] for(var k in configToAlts) { - if(k.indexOf("key_")!==0) { + if(k.indexOf("key_")!=0) { continue } values.push(configToAlts[k]) @@ -545,7 +545,7 @@ PredictionMode.getSingleViableAlt = function(altsets) { var minAlt = alts.minValue() if(result==nil) { result = minAlt - } else if(result!==minAlt) { // more than 1 viable alt + } else if(result!=minAlt) { // more than 1 viable alt return ATN.INVALID_ALT_NUMBER } } diff --git a/runtime/Go/src/antlr4/atn/SemanticContext.go b/runtime/Go/src/antlr4/atn/SemanticContext.go index 1d45e6b7e..f74615296 100644 --- a/runtime/Go/src/antlr4/atn/SemanticContext.go +++ b/runtime/Go/src/antlr4/atn/SemanticContext.go @@ -254,11 +254,11 @@ func (this *AND) evalPrecedence(parser, outerContext) { for (var i = 0 i < this.opnds.length i++) { var context = this.opnds[i] var evaluated = context.evalPrecedence(parser, outerContext) - differs |= (evaluated !== context) + differs |= (evaluated != context) if (evaluated == nil) { // The AND context is false if any element is false return nil - } else if (evaluated !== SemanticContext.NONE) { + } else if (evaluated != SemanticContext.NONE) { // Reduce the result by skipping true elements operands.push(evaluated) } @@ -356,11 +356,11 @@ func (this *OR) evalPrecedence(parser, outerContext) { for (var i = 0 i < this.opnds.length i++) { var context = this.opnds[i] var evaluated = context.evalPrecedence(parser, outerContext) - differs |= (evaluated !== context) + differs |= (evaluated != context) if (evaluated == SemanticContext.NONE) { // The OR context is true if any element is true return SemanticContext.NONE - } else if (evaluated !== nil) { + } else if (evaluated != nil) { // Reduce the result by skipping false elements operands.push(evaluated) } diff --git a/runtime/Go/src/antlr4/atn/Transition.go b/runtime/Go/src/antlr4/atn/Transition.go index 79ae37b19..55dbe43b4 100644 --- a/runtime/Go/src/antlr4/atn/Transition.go +++ b/runtime/Go/src/antlr4/atn/Transition.go @@ -218,7 +218,7 @@ func (this *ActionTransition) toString() { func SetTransition(target, set) { Transition.call(this, target) this.serializationType = Transition.SET - if (set !==undefined && set !==nil) { + if (set !=undefined && set !=nil) { this.label = set } else { this.label = new IntervalSet() diff --git a/runtime/Go/src/antlr4/dfa/DFA.go b/runtime/Go/src/antlr4/dfa/DFA.go index 80ac1934c..f619a5485 100644 --- a/runtime/Go/src/antlr4/dfa/DFA.go +++ b/runtime/Go/src/antlr4/dfa/DFA.go @@ -94,7 +94,7 @@ func (this *DFA) setPrecedenceStartState(precedence, startState) { // {@code false} func (this *DFA) setPrecedenceDfa(precedenceDfa) { - if (this.precedenceDfa!==precedenceDfa) { + if (this.precedenceDfa!=precedenceDfa) { this._states = new DFAStatesSet() if (precedenceDfa) { var precedenceState = new DFAState(new ATNConfigSet()) diff --git a/runtime/Go/src/antlr4/dfa/DFASerializer.go b/runtime/Go/src/antlr4/dfa/DFASerializer.go index dba130473..80a04bb90 100644 --- a/runtime/Go/src/antlr4/dfa/DFASerializer.go +++ b/runtime/Go/src/antlr4/dfa/DFASerializer.go @@ -18,11 +18,11 @@ func (this *DFASerializer) toString() { var states = this.dfa.sortedStates() for(var i=0i" + s.predicates.toString() } else { return baseStateStr + "=>" + s.prediction.toString() diff --git a/runtime/Go/src/antlr4/dfa/DFAState.go b/runtime/Go/src/antlr4/dfa/DFAState.go index 2b8a76db5..ad4535156 100644 --- a/runtime/Go/src/antlr4/dfa/DFAState.go +++ b/runtime/Go/src/antlr4/dfa/DFAState.go @@ -85,7 +85,7 @@ func DFAState(stateNumber, configs) { // DFA state. func (this *DFAState) getAltSet() { var alts = new Set() - if (this.configs !== nil) { + if (this.configs != nil) { for (var i = 0 i < this.configs.length i++) { var c = this.configs[i] alts.add(c.alt) @@ -127,7 +127,7 @@ func (this *DFAState) toString() { func (this *DFAState) hashString() { return "" + this.configs + (this.isAcceptState ? - "=>" + (this.predicates !== nil ? + "=>" + (this.predicates != nil ? this.predicates : this.prediction) : "") diff --git a/runtime/Go/src/antlr4/error/DiagnosticErrorListener.go b/runtime/Go/src/antlr4/error/DiagnosticErrorListener.go index 6199bfc76..88102c0cf 100644 --- a/runtime/Go/src/antlr4/error/DiagnosticErrorListener.go +++ b/runtime/Go/src/antlr4/error/DiagnosticErrorListener.go @@ -93,7 +93,7 @@ func (this *DiagnosticErrorListener) getDecisionDescription(recognizer, dfa) { // returns the set of alternatives represented in {@code configs}. // func (this *DiagnosticErrorListener) getConflictingAlts(reportedAlts, configs) { - if (reportedAlts !== nil) { + if (reportedAlts != nil) { return reportedAlts } var result = new BitSet() diff --git a/runtime/Go/src/antlr4/error/ErrorStrategy.go b/runtime/Go/src/antlr4/error/ErrorStrategy.go index 87f38a607..948f4d477 100644 --- a/runtime/Go/src/antlr4/error/ErrorStrategy.go +++ b/runtime/Go/src/antlr4/error/ErrorStrategy.go @@ -149,7 +149,7 @@ func (this *DefaultErrorStrategy) reportError(recognizer, e) { // func (this *DefaultErrorStrategy) recover(recognizer, e) { if (this.lastErrorIndex==recognizer.getInputStream().index && - this.lastErrorStates !== nil && this.lastErrorStates.indexOf(recognizer.state)>=0) { + this.lastErrorStates != nil && this.lastErrorStates.indexOf(recognizer.state)>=0) { // uh oh, another error at same token index and previously-visited // state in ATN must be a case where LT(1) is in the recovery // token set so nothing got consumed. Consume a single token @@ -231,7 +231,7 @@ func (this *DefaultErrorStrategy) sync(recognizer) { case ATNState.PLUS_BLOCK_START: case ATNState.STAR_LOOP_ENTRY: // report error and recover if possible - if( this.singleTokenDeletion(recognizer) !== nil) { + if( this.singleTokenDeletion(recognizer) != nil) { return } else { throw new InputMismatchException(recognizer) @@ -261,7 +261,7 @@ func (this *DefaultErrorStrategy) sync(recognizer) { func (this *DefaultErrorStrategy) reportNoViableAlternative(recognizer, e) { var tokens = recognizer.getTokenStream() var input - if(tokens !== nil) { + if(tokens != nil) { if (e.startToken.type==Token.EOF) { input = "" } else { @@ -413,7 +413,7 @@ func (this *DefaultErrorStrategy) reportMissingToken(recognizer) { func (this *DefaultErrorStrategy) recoverInline(recognizer) { // SINGLE TOKEN DELETION var matchedSymbol = this.singleTokenDeletion(recognizer) - if (matchedSymbol !== nil) { + if (matchedSymbol != nil) { // we have deleted the extra token. // now, move past ttype token as if all were ok recognizer.consume() @@ -529,7 +529,7 @@ func (this *DefaultErrorStrategy) getMissingSymbol(recognizer) { } var current = currentSymbol var lookback = recognizer.getTokenStream().LT(-1) - if (current.type==Token.EOF && lookback !== nil) { + if (current.type==Token.EOF && lookback != nil) { current = lookback } return recognizer.getTokenFactory().create(current.source, @@ -667,7 +667,7 @@ func (this *DefaultErrorStrategy) getErrorRecoverySet(recognizer) { var atn = recognizer._interp.atn var ctx = recognizer._ctx var recoverSet = new IntervalSet() - while (ctx !== nil && ctx.invokingState>=0) { + while (ctx != nil && ctx.invokingState>=0) { // compute what follows who invoked us var invokingState = atn.states[ctx.invokingState] var rt = invokingState.transitions[0] @@ -682,7 +682,7 @@ func (this *DefaultErrorStrategy) getErrorRecoverySet(recognizer) { // Consume tokens until one matches the given token set.// func (this *DefaultErrorStrategy) consumeUntil(recognizer, set) { var ttype = recognizer.getTokenStream().LA(1) - while( ttype !== Token.EOF && !set.contains(ttype)) { + while( ttype != Token.EOF && !set.contains(ttype)) { recognizer.consume() ttype = recognizer.getTokenStream().LA(1) } @@ -731,7 +731,7 @@ BailErrorStrategy.prototype.constructor = BailErrorStrategy // func (this *BailErrorStrategy) recover(recognizer, e) { var context = recognizer._ctx - while (context !== nil) { + while (context != nil) { context.exception = e context = context.parentCtx } diff --git a/runtime/Go/src/antlr4/error/Errors.go b/runtime/Go/src/antlr4/error/Errors.go index 131fd514c..9a255b488 100644 --- a/runtime/Go/src/antlr4/error/Errors.go +++ b/runtime/Go/src/antlr4/error/Errors.go @@ -29,7 +29,7 @@ func RecognitionException(params) { // {@link DecisionState} number. For others, it is the state whose outgoing // edge we couldn't match. this.offendingState = -1 - if (this.recognizer!==nil) { + if (this.recognizer!=nil) { this.offendingState = this.recognizer.state } return this @@ -51,7 +51,7 @@ RecognitionException.prototype.constructor = RecognitionException // state in the ATN, or {@code nil} if the information is not available. // / func (this *RecognitionException) getExpectedTokens() { - if (this.recognizer!==nil) { + if (this.recognizer!=nil) { return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx) } else { return nil @@ -142,7 +142,7 @@ FailedPredicateException.prototype = Object.create(RecognitionException.prototyp FailedPredicateException.prototype.constructor = FailedPredicateException func (this *FailedPredicateException) formatMessage(predicate, message) { - if (message !==nil) { + if (message !=nil) { return message } else { return "failed predicate: {" + predicate + "}?" diff --git a/runtime/Go/src/antlr4/tree/Tree.go b/runtime/Go/src/antlr4/tree/Tree.go index 96fffe566..1c924fa61 100644 --- a/runtime/Go/src/antlr4/tree/Tree.go +++ b/runtime/Go/src/antlr4/tree/Tree.go @@ -179,7 +179,7 @@ type ParseTreeWalker struct { func (this *ParseTreeWalker) walk(listener, t) { var errorNode = t instanceof ErrorNode || - (t.isErrorNode !== undefined && t.isErrorNode()) + (t.isErrorNode != undefined && t.isErrorNode()) if (errorNode) { listener.visitErrorNode(t) } else if (t instanceof TerminalNode) { diff --git a/runtime/Go/src/antlr4/tree/Trees.go b/runtime/Go/src/antlr4/tree/Trees.go index 254d8ee21..d285f6d56 100644 --- a/runtime/Go/src/antlr4/tree/Trees.go +++ b/runtime/Go/src/antlr4/tree/Trees.go @@ -17,7 +17,7 @@ type Trees struct { Trees.toStringTree = function(tree, ruleNames, recog) { ruleNames = ruleNames || nil recog = recog || nil - if(recog!==nil) { + if(recog!=nil) { ruleNames = recog.ruleNames } var s = Trees.getNodeText(tree, ruleNames) @@ -42,16 +42,16 @@ Trees.toStringTree = function(tree, ruleNames, recog) { Trees.getNodeText = function(t, ruleNames, recog) { ruleNames = ruleNames || nil recog = recog || nil - if(recog!==nil) { + if(recog!=nil) { ruleNames = recog.ruleNames } - if(ruleNames!==nil) { + if(ruleNames!=nil) { if (t instanceof RuleNode) { return ruleNames[t.getRuleContext().ruleIndex] } else if ( t instanceof ErrorNode) { return t.toString() } else if(t instanceof TerminalNode) { - if(t.symbol!==nil) { + if(t.symbol!=nil) { return t.symbol.text } } @@ -80,7 +80,7 @@ Trees.getChildren = function(t) { Trees.getAncestors = function(t) { var ancestors = [] t = t.getParent() - while(t!==nil) { + while(t!=nil) { ancestors = [t].concat(ancestors) t = t.getParent() }