forked from jasder/antlr
resolve contribs conflict
This commit is contained in:
commit
285c7fca6c
|
@ -0,0 +1,7 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*.{java,stg}]
|
||||||
|
charset = utf-8
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = tab
|
|
@ -94,4 +94,5 @@ YYYY/MM/DD, github id, Full name, email
|
||||||
2016/03/28, gagern, Martin von Gagern, gagern@ma.tum.de
|
2016/03/28, gagern, Martin von Gagern, gagern@ma.tum.de
|
||||||
2016/08/11, BurtHarris, Ralph "Burt" Harris, Burt_Harris_antlr4@azxs.33mail.com
|
2016/08/11, BurtHarris, Ralph "Burt" Harris, Burt_Harris_antlr4@azxs.33mail.com
|
||||||
2016/08/19, andjo403, Andreas Jonson, andjo403@hotmail.com
|
2016/08/19, andjo403, Andreas Jonson, andjo403@hotmail.com
|
||||||
2016/10/13, cgudrian, Christian Gudrian, christian.gudrian@gmx.de
|
2016/10/13, cgudrian, Christian Gudrian, christian.gudrian@gmx.de
|
||||||
|
2016/10/13, nielsbasjes, Niels Basjes, niels@basjes.nl
|
|
@ -96,10 +96,16 @@ ATNConfig.prototype.checkContext = function(params, config) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ATNConfig.prototype.hashString = function() {
|
||||||
|
return "" + this.state.stateNumber + "/" + this.alt + "/" +
|
||||||
|
(this.context===null ? "" : this.context.hashString()) +
|
||||||
|
"/" + this.semanticContext.hashString();
|
||||||
|
};
|
||||||
|
|
||||||
// An ATN configuration is equal to another if both have
|
// An ATN configuration is equal to another if both have
|
||||||
// the same state, they predict the same alternative, and
|
// the same state, they predict the same alternative, and
|
||||||
// syntactic/semantic contexts are the same.
|
// syntactic/semantic contexts are the same.
|
||||||
///
|
|
||||||
ATNConfig.prototype.equals = function(other) {
|
ATNConfig.prototype.equals = function(other) {
|
||||||
if (this === other) {
|
if (this === other) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -114,16 +120,23 @@ ATNConfig.prototype.equals = function(other) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ATNConfig.prototype.shortHashString = function() {
|
ATNConfig.prototype.hashStringForConfigSet = function() {
|
||||||
return "" + this.state.stateNumber + "/" + this.alt + "/" + this.semanticContext;
|
return "" + this.state.stateNumber + "/" + this.alt + "/" + this.semanticContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
ATNConfig.prototype.hashString = function() {
|
ATNConfig.prototype.equalsForConfigSet = function(other) {
|
||||||
return "" + this.state.stateNumber + "/" + this.alt + "/" +
|
if (this === other) {
|
||||||
(this.context===null ? "" : this.context.hashString()) +
|
return true;
|
||||||
"/" + this.semanticContext.hashString();
|
} else if (! (other instanceof ATNConfig)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return this.state.stateNumber===other.state.stateNumber &&
|
||||||
|
this.alt===other.alt &&
|
||||||
|
this.semanticContext.equals(other.semanticContext);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ATNConfig.prototype.toString = function() {
|
ATNConfig.prototype.toString = function() {
|
||||||
return "(" + this.state + "," + this.alt +
|
return "(" + this.state + "," + this.alt +
|
||||||
(this.context!==null ? ",[" + this.context.toString() + "]" : "") +
|
(this.context!==null ? ",[" + this.context.toString() + "]" : "") +
|
||||||
|
@ -171,6 +184,11 @@ LexerATNConfig.prototype.equals = function(other) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LexerATNConfig.prototype.hashStringForConfigSet = LexerATNConfig.prototype.hashString;
|
||||||
|
|
||||||
|
LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.eqials;
|
||||||
|
|
||||||
|
|
||||||
LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
|
LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
|
||||||
return source.passedThroughNonGreedyDecision ||
|
return source.passedThroughNonGreedyDecision ||
|
||||||
(target instanceof DecisionState) && target.nonGreedy;
|
(target instanceof DecisionState) && target.nonGreedy;
|
||||||
|
|
|
@ -41,19 +41,17 @@ var SemanticContext = require('./SemanticContext').SemanticContext;
|
||||||
var merge = require('./../PredictionContext').merge;
|
var merge = require('./../PredictionContext').merge;
|
||||||
|
|
||||||
function hashATNConfig(c) {
|
function hashATNConfig(c) {
|
||||||
return c.shortHashString();
|
return c.hashStringForConfigSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
function equalATNConfigs(a, b) {
|
function equalATNConfigs(a, b) {
|
||||||
if ( a===b ) {
|
if ( a===b ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if ( a===null || b===null ) {
|
||||||
if ( a===null || b===null ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else
|
||||||
return a.state.stateNumber===b.state.stateNumber &&
|
return a.equalsForConfigSet(b);
|
||||||
a.alt===b.alt && a.semanticContext.equals(b.semanticContext);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function ATNConfigSet(fullCtx) {
|
function ATNConfigSet(fullCtx) {
|
||||||
|
|
Loading…
Reference in New Issue