From 33fd68778e1542311c900f03230349abe8047324 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 20 May 2016 23:44:36 -0700 Subject: [PATCH] Lint: Replace += 1 with ++ --- runtime/Go/antlr/atn_deserializer.go | 2 +- runtime/Go/antlr/common_token_stream.go | 8 ++++---- runtime/Go/antlr/input_stream.go | 4 ++-- runtime/Go/antlr/interval_set.go | 2 +- runtime/Go/antlr/lexer_atn_simulator.go | 6 +++--- runtime/Go/antlr/parser.go | 2 +- runtime/Go/antlr/parser_atn_simulator.go | 4 ++-- runtime/Go/antlr/prediction_context.go | 14 +++++++------- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/runtime/Go/antlr/atn_deserializer.go b/runtime/Go/antlr/atn_deserializer.go index f263c6ac4..e91bbd175 100644 --- a/runtime/Go/antlr/atn_deserializer.go +++ b/runtime/Go/antlr/atn_deserializer.go @@ -549,7 +549,7 @@ func (a *ATNDeserializer) checkCondition(condition bool, message string) { func (a *ATNDeserializer) readInt() int { v := a.data[a.pos] - a.pos += 1 + a.pos++ return int(v) } diff --git a/runtime/Go/antlr/common_token_stream.go b/runtime/Go/antlr/common_token_stream.go index d005bfd6b..1ae1b7cab 100644 --- a/runtime/Go/antlr/common_token_stream.go +++ b/runtime/Go/antlr/common_token_stream.go @@ -235,7 +235,7 @@ func (c *CommonTokenStream) NextTokenOnChannel(i, channel int) int { if token.GetTokenType() == TokenEOF { return -1 } - i += 1 + i++ c.Sync(i) token = c.tokens[i] } @@ -388,7 +388,7 @@ func (c *CommonTokenStream) LB(k int) Token { for n <= k { // Skip off-channel tokens i = c.previousTokenOnChannel(i-1, c.channel) - n += 1 + n++ } if i < 0 { return nil @@ -412,7 +412,7 @@ func (c *CommonTokenStream) LT(k int) Token { if c.Sync(i + 1) { i = c.NextTokenOnChannel(i+1, c.channel) } - n += 1 + n++ } return c.tokens[i] } @@ -424,7 +424,7 @@ func (c *CommonTokenStream) getNumberOfOnChannelTokens() int { for i := 0; i < len(c.tokens); i++ { var t = c.tokens[i] if t.GetChannel() == c.channel { - n += 1 + n++ } if t.GetTokenType() == TokenEOF { break diff --git a/runtime/Go/antlr/input_stream.go b/runtime/Go/antlr/input_stream.go index 544790b0a..caaae7597 100644 --- a/runtime/Go/antlr/input_stream.go +++ b/runtime/Go/antlr/input_stream.go @@ -30,7 +30,7 @@ func (is *InputStream) Consume() { // assert is.LA(1) == TokenEOF panic("cannot consume EOF") } - is.index += 1 + is.index++ } func (is *InputStream) LA(offset int) int { @@ -39,7 +39,7 @@ func (is *InputStream) LA(offset int) int { return 0 // nil } if offset < 0 { - offset += 1 // e.g., translate LA(-1) to use offset=0 + offset++ // e.g., translate LA(-1) to use offset=0 } var pos = is.index + offset - 1 diff --git a/runtime/Go/antlr/interval_set.go b/runtime/Go/antlr/interval_set.go index 08657c8be..06d07f6ec 100644 --- a/runtime/Go/antlr/interval_set.go +++ b/runtime/Go/antlr/interval_set.go @@ -186,7 +186,7 @@ func (i *IntervalSet) removeRange(v *Interval) { } else if v.stop < ni.stop { i.intervals[k] = NewInterval(v.stop, ni.stop) } - k += 1 + k++ } } } diff --git a/runtime/Go/antlr/lexer_atn_simulator.go b/runtime/Go/antlr/lexer_atn_simulator.go index 3b0efa2c6..798bf33c0 100644 --- a/runtime/Go/antlr/lexer_atn_simulator.go +++ b/runtime/Go/antlr/lexer_atn_simulator.go @@ -109,7 +109,7 @@ func (l *LexerATNSimulator) Match(input CharStream, mode int) int { fmt.Println("Match") } - l.Match_calls += 1 + l.Match_calls++ l.mode = mode var mark = input.Mark() @@ -672,10 +672,10 @@ func (l *LexerATNSimulator) GetText(input CharStream) string { func (l *LexerATNSimulator) consume(input CharStream) { var curChar = input.LA(1) if curChar == int('\n') { - l.line += 1 + l.line++ l.column = 0 } else { - l.column += 1 + l.column++ } input.Consume() } diff --git a/runtime/Go/antlr/parser.go b/runtime/Go/antlr/parser.go index 09ef6bf99..63e765692 100644 --- a/runtime/Go/antlr/parser.go +++ b/runtime/Go/antlr/parser.go @@ -418,7 +418,7 @@ func (p *BaseParser) NotifyErrorListeners(msg string, offendingToken Token, err if offendingToken == nil { offendingToken = p.GetCurrentToken() } - p._SyntaxErrors += 1 + p._SyntaxErrors++ var line = offendingToken.GetLine() var column = offendingToken.GetColumn() listener := p.GetErrorListenerDispatch() diff --git a/runtime/Go/antlr/parser_atn_simulator.go b/runtime/Go/antlr/parser_atn_simulator.go index 5558fe7be..15fdbf29f 100644 --- a/runtime/Go/antlr/parser_atn_simulator.go +++ b/runtime/Go/antlr/parser_atn_simulator.go @@ -796,7 +796,7 @@ func (p *ParserATNSimulator) getPredsForAmbigAlts(ambigAlts *BitSet, configs ATN if pred == nil { altToPred[i] = SemanticContextNone } else if pred != SemanticContextNone { - nPredAlts += 1 + nPredAlts++ } } // nonambig alts are nil in altToPred @@ -1112,7 +1112,7 @@ func (p *ParserATNSimulator) closure_(config ATNConfig, configs ATNConfigSet, cl } else if _, ok := t.(*RuleTransition); ok { // latch when newDepth goes negative - once we step out of the entry context we can't return if newDepth >= 0 { - newDepth += 1 + newDepth++ } } p.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon) diff --git a/runtime/Go/antlr/prediction_context.go b/runtime/Go/antlr/prediction_context.go index 8fc185c6a..62869351e 100644 --- a/runtime/Go/antlr/prediction_context.go +++ b/runtime/Go/antlr/prediction_context.go @@ -637,31 +637,31 @@ func mergeArrays(a, b *ArrayPredictionContext, rootIsWildcard bool, mergeCache * mergedParents[k] = mergedParent mergedReturnStates[k] = payload } - i += 1 // hop over left one as usual - j += 1 // but also Skip one in right side since we merge + i++ // hop over left one as usual + j++ // but also Skip one in right side since we merge } else if a.returnStates[i] < b.returnStates[j] { // copy a[i] to M mergedParents[k] = a_parent mergedReturnStates[k] = a.returnStates[i] - i += 1 + i++ } else { // b > a, copy b[j] to M mergedParents[k] = b_parent mergedReturnStates[k] = b.returnStates[j] - j += 1 + j++ } - k += 1 + k++ } // copy over any payloads remaining in either array if i < len(a.returnStates) { for p := i; p < len(a.returnStates); p++ { mergedParents[k] = a.parents[p] mergedReturnStates[k] = a.returnStates[p] - k += 1 + k++ } } else { for p := j; p < len(b.returnStates); p++ { mergedParents[k] = b.parents[p] mergedReturnStates[k] = b.returnStates[p] - k += 1 + k++ } } // trim merged if we combined a few that had same stack tops