Mass fixes for toString

This commit is contained in:
Peter Boyer 2015-12-15 18:15:13 -05:00
parent ac5e4d9b44
commit 1ac3d2701a
14 changed files with 36 additions and 36 deletions

View File

@ -23,7 +23,7 @@ func (i *Interval) contains(item int) {
return item >= i.start && item < i.stop
}
func (i *Interval) toString() {
func (i *Interval) toString() string {
if(i.start==i.stop-1) {
return strconv.Itoa(i.start)
} else {

View File

@ -156,7 +156,7 @@ func (this *SingletonPredictionContext) hashString() {
return this.cachedHashString
}
func (this *SingletonPredictionContext) toString() {
func (this *SingletonPredictionContext) toString() string {
var up = this.parentCtx == nil ? "" : this.parentCtx.toString()
if (up.length == 0) {
if (this.returnState == this.EMPTY_RETURN_STATE) {
@ -193,7 +193,7 @@ func (this *EmptyPredictionContext) equals(other) {
return this == other
}
func (this *EmptyPredictionContext) toString() {
func (this *EmptyPredictionContext) toString() string {
return "$"
}
@ -247,7 +247,7 @@ func (this *ArrayPredictionContext) equals(other) {
}
}
func (this *ArrayPredictionContext) toString() {
func (this *ArrayPredictionContext) toString() string {
if (this.isEmpty()) {
return "[]"
} else {

View File

@ -141,7 +141,7 @@ Object.defineProperty(CommonToken.prototype, "text", {
}
})
func (this *CommonToken) toString() {
func (this *CommonToken) toString() string {
var txt = this.text
if (txt != nil) {
txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")

View File

@ -80,7 +80,7 @@ func (this *Set) values() {
return l
}
func (this *Set) toString() {
func (this *Set) toString() string {
return arrayToString(this.values())
}
@ -131,7 +131,7 @@ Object.defineProperty(BitSet.prototype, "length", {
}
})
func (this *BitSet) toString() {
func (this *BitSet) toString() string {
return "{" + this.values().join(", ") + "}"
}

View File

@ -95,7 +95,7 @@ func (this *ATNConfig) hashString() {
"/" + this.semanticContext.hashString()
}
func (this *ATNConfig) toString() {
func (this *ATNConfig) toString() string {
return "(" + this.state + "," + this.alt +
(this.context!=nil ? ",[" + this.context.toString() + "]" : "") +
(this.semanticContext != SemanticContext.NONE ?

View File

@ -232,7 +232,7 @@ func (this *ATNConfigSet) setReadonly(readOnly) {
}
}
func (this *ATNConfigSet) toString() {
func (this *ATNConfigSet) toString() string {
return Utils.arrayToString(this.configs) +
(this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
(this.uniqueAlt != ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +

View File

@ -127,7 +127,7 @@ var ATNState.serializationNames = [
"PLUS_LOOP_BACK",
"LOOP_END" ]
func (this *ATNState) toString() {
func (this *ATNState) toString() string {
return this.stateNumber
}

View File

@ -50,7 +50,7 @@ func (this *LexerSkipAction) execute(lexer) {
lexer.skip()
}
func (this *LexerSkipAction) toString() {
func (this *LexerSkipAction) toString() string {
return "skip"
}
@ -84,7 +84,7 @@ func (this *LexerTypeAction) equals(other) {
}
}
func (this *LexerTypeAction) toString() {
func (this *LexerTypeAction) toString() string {
return "type(" + this.type + ")"
}
@ -119,7 +119,7 @@ func (this *LexerPushModeAction) equals(other) {
}
}
func (this *LexerPushModeAction) toString() {
func (this *LexerPushModeAction) toString() string {
return "pushMode(" + this.mode + ")"
}
@ -143,7 +143,7 @@ func (this *LexerPopModeAction) execute(lexer) {
lexer.popMode()
}
func (this *LexerPopModeAction) toString() {
func (this *LexerPopModeAction) toString() string {
return "popMode"
}
@ -166,7 +166,7 @@ func (this *LexerMoreAction) execute(lexer) {
lexer.more()
}
func (this *LexerMoreAction) toString() {
func (this *LexerMoreAction) toString() string {
return "more"
}
@ -202,7 +202,7 @@ func (this *LexerModeAction) equals(other) {
}
}
func (this *LexerModeAction) toString() {
func (this *LexerModeAction) toString() string {
return "mode(" + this.mode + ")"
}
@ -288,7 +288,7 @@ func (this *LexerChannelAction) equals(other) {
}
}
func (this *LexerChannelAction) toString() {
func (this *LexerChannelAction) toString() string {
return "channel(" + this.channel + ")"
}

View File

@ -122,7 +122,7 @@ func (this *Predicate) equals(other) {
}
}
func (this *Predicate) toString() {
func (this *Predicate) toString() string {
return "{" + this.ruleIndex + ":" + this.predIndex + "}?"
}
@ -164,7 +164,7 @@ func (this *PrecedencePredicate) equals(other) {
}
}
func (this *PrecedencePredicate) toString() {
func (this *PrecedencePredicate) toString() string {
return "{"+this.precedence+">=prec}?"
}
@ -277,7 +277,7 @@ func (this *AND) evalPrecedence(parser, outerContext) {
return result
}
func (this *AND) toString() {
func (this *AND) toString() string {
var s = ""
this.opnds.map(function(o) {
s += "&& " + o.toString()
@ -379,7 +379,7 @@ func (this *OR) evalPrecedence(parser, outerContext) {
return result
}
func (this *AND) toString() {
func (this *AND) toString() string {
var s = ""
this.opnds.map(function(o) {
s += "|| " + o.toString()

View File

@ -91,7 +91,7 @@ func (this *AtomTransition) matches( symbol, minVocabSymbol, maxVocabSymbol) {
return this.label_ == symbol
}
func (this *AtomTransition) toString() {
func (this *AtomTransition) toString() string {
return this.label_
}
@ -128,7 +128,7 @@ func (this *EpsilonTransition) matches( symbol, minVocabSymbol, maxVocabSymbol)
return false
}
func (this *EpsilonTransition) toString() {
func (this *EpsilonTransition) toString() string {
return "epsilon"
}
@ -154,7 +154,7 @@ func (this *RangeTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return symbol >= this.start && symbol <= this.stop
}
func (this *RangeTransition) toString() {
func (this *RangeTransition) toString() string {
return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'"
}
@ -187,7 +187,7 @@ func (this *PredicateTransition) getPredicate() {
return NewPredicate(this.ruleIndex, this.predIndex, this.isCtxDependent)
}
func (this *PredicateTransition) toString() {
func (this *PredicateTransition) toString() string {
return "pred_" + this.ruleIndex + ":" + this.predIndex
}
@ -209,7 +209,7 @@ func (this *ActionTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
return false
}
func (this *ActionTransition) toString() {
func (this *ActionTransition) toString() string {
return "action_" + this.ruleIndex + ":" + this.actionIndex
}
@ -235,7 +235,7 @@ func (this *SetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
}
func (this *SetTransition) toString() {
func (this *SetTransition) toString() string {
return this.label.toString()
}
@ -253,7 +253,7 @@ func (this *NotSetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
!SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol)
}
func (this *NotSetTransition) toString() {
func (this *NotSetTransition) toString() string {
return '~' + SetTransition.prototype.toString.call(this)
}
@ -271,7 +271,7 @@ func (this *WildcardTransition) matches(symbol, minVocabSymbol, maxVocabSymbol)
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol
}
func (this *WildcardTransition) toString() {
func (this *WildcardTransition) toString() string {
return "."
}
@ -294,7 +294,7 @@ func (this *PrecedencePredicateTransition) getPredicate() {
return NewPrecedencePredicate(this.precedence)
}
func (this *PrecedencePredicateTransition) toString() {
func (this *PrecedencePredicateTransition) toString() string {
return this.precedence + " >= _p"
}

View File

@ -10,7 +10,7 @@ func DFASerializer(dfa, literalNames, symbolicNames) {
return this
}
func (this *DFASerializer) toString() {
func (this *DFASerializer) toString() string {
if(this.dfa.s0 == nil) {
return nil
}

View File

@ -10,7 +10,7 @@ func PredPrediction(pred, alt) {
return this
}
func (this *PredPrediction) toString() {
func (this *PredPrediction) toString() string {
return "(" + this.pred + ", " + this.alt + ")"
}
@ -120,7 +120,7 @@ func (this *DFAState) equals(other) {
}
}
func (this *DFAState) toString() {
func (this *DFAState) toString() string {
return "" + this.stateNumber + ":" + this.hashString()
}

View File

@ -58,7 +58,7 @@ func (this *RecognitionException) getExpectedTokens() {
}
}
func (this *RecognitionException) toString() {
func (this *RecognitionException) toString() string {
return this.message
}
@ -72,7 +72,7 @@ func LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
//LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
//LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
func (this *LexerNoViableAltException) toString() {
func (this *LexerNoViableAltException) toString() string {
var symbol = ""
if (this.startIndex >= 0 && this.startIndex < this.input.size) {
symbol = this.input.getText((this.startIndex,this.startIndex))

View File

@ -165,7 +165,7 @@ func (this *TerminalNodeImpl) getText() {
return this.symbol.text
}
func (this *TerminalNodeImpl) toString() {
func (this *TerminalNodeImpl) toString() string {
if (this.symbol.type == TokenEOF) {
return "<EOF>"
} else {