forked from jasder/antlr
Mass fixes for toString
This commit is contained in:
parent
ac5e4d9b44
commit
1ac3d2701a
|
@ -23,7 +23,7 @@ func (i *Interval) contains(item int) {
|
||||||
return item >= i.start && item < i.stop
|
return item >= i.start && item < i.stop
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Interval) toString() {
|
func (i *Interval) toString() string {
|
||||||
if(i.start==i.stop-1) {
|
if(i.start==i.stop-1) {
|
||||||
return strconv.Itoa(i.start)
|
return strconv.Itoa(i.start)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -156,7 +156,7 @@ func (this *SingletonPredictionContext) hashString() {
|
||||||
return this.cachedHashString
|
return this.cachedHashString
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *SingletonPredictionContext) toString() {
|
func (this *SingletonPredictionContext) toString() string {
|
||||||
var up = this.parentCtx == nil ? "" : this.parentCtx.toString()
|
var up = this.parentCtx == nil ? "" : this.parentCtx.toString()
|
||||||
if (up.length == 0) {
|
if (up.length == 0) {
|
||||||
if (this.returnState == this.EMPTY_RETURN_STATE) {
|
if (this.returnState == this.EMPTY_RETURN_STATE) {
|
||||||
|
@ -193,7 +193,7 @@ func (this *EmptyPredictionContext) equals(other) {
|
||||||
return this == other
|
return this == other
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EmptyPredictionContext) toString() {
|
func (this *EmptyPredictionContext) toString() string {
|
||||||
return "$"
|
return "$"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ func (this *ArrayPredictionContext) equals(other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ArrayPredictionContext) toString() {
|
func (this *ArrayPredictionContext) toString() string {
|
||||||
if (this.isEmpty()) {
|
if (this.isEmpty()) {
|
||||||
return "[]"
|
return "[]"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -141,7 +141,7 @@ Object.defineProperty(CommonToken.prototype, "text", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
func (this *CommonToken) toString() {
|
func (this *CommonToken) toString() string {
|
||||||
var txt = this.text
|
var txt = this.text
|
||||||
if (txt != nil) {
|
if (txt != nil) {
|
||||||
txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")
|
txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (this *Set) values() {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Set) toString() {
|
func (this *Set) toString() string {
|
||||||
return arrayToString(this.values())
|
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(", ") + "}"
|
return "{" + this.values().join(", ") + "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ func (this *ATNConfig) hashString() {
|
||||||
"/" + this.semanticContext.hashString()
|
"/" + this.semanticContext.hashString()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ATNConfig) toString() {
|
func (this *ATNConfig) toString() string {
|
||||||
return "(" + this.state + "," + this.alt +
|
return "(" + this.state + "," + this.alt +
|
||||||
(this.context!=nil ? ",[" + this.context.toString() + "]" : "") +
|
(this.context!=nil ? ",[" + this.context.toString() + "]" : "") +
|
||||||
(this.semanticContext != SemanticContext.NONE ?
|
(this.semanticContext != SemanticContext.NONE ?
|
||||||
|
|
|
@ -232,7 +232,7 @@ func (this *ATNConfigSet) setReadonly(readOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ATNConfigSet) toString() {
|
func (this *ATNConfigSet) toString() string {
|
||||||
return Utils.arrayToString(this.configs) +
|
return Utils.arrayToString(this.configs) +
|
||||||
(this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
|
(this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
|
||||||
(this.uniqueAlt != ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
|
(this.uniqueAlt != ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
|
||||||
|
|
|
@ -127,7 +127,7 @@ var ATNState.serializationNames = [
|
||||||
"PLUS_LOOP_BACK",
|
"PLUS_LOOP_BACK",
|
||||||
"LOOP_END" ]
|
"LOOP_END" ]
|
||||||
|
|
||||||
func (this *ATNState) toString() {
|
func (this *ATNState) toString() string {
|
||||||
return this.stateNumber
|
return this.stateNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (this *LexerSkipAction) execute(lexer) {
|
||||||
lexer.skip()
|
lexer.skip()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LexerSkipAction) toString() {
|
func (this *LexerSkipAction) toString() string {
|
||||||
return "skip"
|
return "skip"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ func (this *LexerTypeAction) equals(other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LexerTypeAction) toString() {
|
func (this *LexerTypeAction) toString() string {
|
||||||
return "type(" + this.type + ")"
|
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 + ")"
|
return "pushMode(" + this.mode + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ func (this *LexerPopModeAction) execute(lexer) {
|
||||||
lexer.popMode()
|
lexer.popMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LexerPopModeAction) toString() {
|
func (this *LexerPopModeAction) toString() string {
|
||||||
return "popMode"
|
return "popMode"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ func (this *LexerMoreAction) execute(lexer) {
|
||||||
lexer.more()
|
lexer.more()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LexerMoreAction) toString() {
|
func (this *LexerMoreAction) toString() string {
|
||||||
return "more"
|
return "more"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ func (this *LexerModeAction) equals(other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LexerModeAction) toString() {
|
func (this *LexerModeAction) toString() string {
|
||||||
return "mode(" + this.mode + ")"
|
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 + ")"
|
return "channel(" + this.channel + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (this *Predicate) equals(other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Predicate) toString() {
|
func (this *Predicate) toString() string {
|
||||||
return "{" + this.ruleIndex + ":" + this.predIndex + "}?"
|
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}?"
|
return "{"+this.precedence+">=prec}?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ func (this *AND) evalPrecedence(parser, outerContext) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AND) toString() {
|
func (this *AND) toString() string {
|
||||||
var s = ""
|
var s = ""
|
||||||
this.opnds.map(function(o) {
|
this.opnds.map(function(o) {
|
||||||
s += "&& " + o.toString()
|
s += "&& " + o.toString()
|
||||||
|
@ -379,7 +379,7 @@ func (this *OR) evalPrecedence(parser, outerContext) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AND) toString() {
|
func (this *AND) toString() string {
|
||||||
var s = ""
|
var s = ""
|
||||||
this.opnds.map(function(o) {
|
this.opnds.map(function(o) {
|
||||||
s += "|| " + o.toString()
|
s += "|| " + o.toString()
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (this *AtomTransition) matches( symbol, minVocabSymbol, maxVocabSymbol) {
|
||||||
return this.label_ == symbol
|
return this.label_ == symbol
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AtomTransition) toString() {
|
func (this *AtomTransition) toString() string {
|
||||||
return this.label_
|
return this.label_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ func (this *EpsilonTransition) matches( symbol, minVocabSymbol, maxVocabSymbol)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EpsilonTransition) toString() {
|
func (this *EpsilonTransition) toString() string {
|
||||||
return "epsilon"
|
return "epsilon"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ func (this *RangeTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
|
||||||
return symbol >= this.start && symbol <= this.stop
|
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) + "'"
|
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)
|
return NewPredicate(this.ruleIndex, this.predIndex, this.isCtxDependent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PredicateTransition) toString() {
|
func (this *PredicateTransition) toString() string {
|
||||||
return "pred_" + this.ruleIndex + ":" + this.predIndex
|
return "pred_" + this.ruleIndex + ":" + this.predIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ func (this *ActionTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ActionTransition) toString() {
|
func (this *ActionTransition) toString() string {
|
||||||
return "action_" + this.ruleIndex + ":" + this.actionIndex
|
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()
|
return this.label.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ func (this *NotSetTransition) matches(symbol, minVocabSymbol, maxVocabSymbol) {
|
||||||
!SetTransition.prototype.matches.call(this, 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)
|
return '~' + SetTransition.prototype.toString.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ func (this *WildcardTransition) matches(symbol, minVocabSymbol, maxVocabSymbol)
|
||||||
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol
|
return symbol >= minVocabSymbol && symbol <= maxVocabSymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *WildcardTransition) toString() {
|
func (this *WildcardTransition) toString() string {
|
||||||
return "."
|
return "."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ func (this *PrecedencePredicateTransition) getPredicate() {
|
||||||
return NewPrecedencePredicate(this.precedence)
|
return NewPrecedencePredicate(this.precedence)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PrecedencePredicateTransition) toString() {
|
func (this *PrecedencePredicateTransition) toString() string {
|
||||||
return this.precedence + " >= _p"
|
return this.precedence + " >= _p"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ func DFASerializer(dfa, literalNames, symbolicNames) {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *DFASerializer) toString() {
|
func (this *DFASerializer) toString() string {
|
||||||
if(this.dfa.s0 == nil) {
|
if(this.dfa.s0 == nil) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ func PredPrediction(pred, alt) {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PredPrediction) toString() {
|
func (this *PredPrediction) toString() string {
|
||||||
return "(" + this.pred + ", " + this.alt + ")"
|
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()
|
return "" + this.stateNumber + ":" + this.hashString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ func (this *RecognitionException) getExpectedTokens() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RecognitionException) toString() {
|
func (this *RecognitionException) toString() string {
|
||||||
return this.message
|
return this.message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ func LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
|
||||||
//LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
|
//LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype)
|
||||||
//LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
|
//LexerNoViableAltException.prototype.constructor = LexerNoViableAltException
|
||||||
|
|
||||||
func (this *LexerNoViableAltException) toString() {
|
func (this *LexerNoViableAltException) toString() string {
|
||||||
var symbol = ""
|
var symbol = ""
|
||||||
if (this.startIndex >= 0 && this.startIndex < this.input.size) {
|
if (this.startIndex >= 0 && this.startIndex < this.input.size) {
|
||||||
symbol = this.input.getText((this.startIndex,this.startIndex))
|
symbol = this.input.getText((this.startIndex,this.startIndex))
|
||||||
|
|
|
@ -165,7 +165,7 @@ func (this *TerminalNodeImpl) getText() {
|
||||||
return this.symbol.text
|
return this.symbol.text
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TerminalNodeImpl) toString() {
|
func (this *TerminalNodeImpl) toString() string {
|
||||||
if (this.symbol.type == TokenEOF) {
|
if (this.symbol.type == TokenEOF) {
|
||||||
return "<EOF>"
|
return "<EOF>"
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue