This commit is contained in:
Eric Vergnaud 2015-09-30 22:07:46 +08:00
parent 3bdc4b7ee6
commit a3b27766fa
3 changed files with 10 additions and 10 deletions

View File

@ -78,7 +78,7 @@ ATN.prototype.nextTokensNoContext = function(s) {
return s.nextTokenWithinRule;
}
s.nextTokenWithinRule = this.nextTokensInContext(s, null);
s.nextTokenWithinRule.readonly = true;
s.nextTokenWithinRule.readOnly = true;
return s.nextTokenWithinRule;
};

View File

@ -78,7 +78,7 @@ function ATNConfigSet(fullCtx) {
// the sets and they must not change. This does not protect the other
// fields; in particular, conflictingAlts is set after
// we've made this readonly.
this.readonly = false;
this.readOnly = false;
// Track the elements as they are added to the set; supports get(i)///
this.configs = [];
@ -112,7 +112,7 @@ ATNConfigSet.prototype.add = function(config, mergeCache) {
if (mergeCache === undefined) {
mergeCache = null;
}
if (this.readonly) {
if (this.readOnly) {
throw "This set is readonly";
}
if (config.semanticContext !== SemanticContext.NONE) {
@ -168,7 +168,7 @@ Object.defineProperty(ATNConfigSet.prototype, "items", {
});
ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
if (this.readonly) {
if (this.readOnly) {
throw "This set is readonly";
}
if (this.configLookup.length === 0) {
@ -202,7 +202,7 @@ ATNConfigSet.prototype.equals = function(other) {
};
ATNConfigSet.prototype.hashString = function() {
if (this.readonly) {
if (this.readOnly) {
if (this.cachedHashString === "-1") {
this.cachedHashString = this.hashConfigs();
}
@ -245,7 +245,7 @@ ATNConfigSet.prototype.containsFast = function(item) {
};
ATNConfigSet.prototype.clear = function() {
if (this.readonly) {
if (this.readOnly) {
throw "This set is readonly";
}
this.configs = [];
@ -253,9 +253,9 @@ ATNConfigSet.prototype.clear = function() {
this.configLookup = new Set();
};
ATNConfigSet.prototype.setReadonly = function(readonly) {
this.readonly = readonly;
if (readonly) {
ATNConfigSet.prototype.setReadonly = function(readOnly) {
this.readOnly = readOnly;
if (readOnly) {
this.configLookup = null; // can't mod, no need for lookup cache
}
};

View File

@ -1637,7 +1637,7 @@ ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
return existing;
}
D.stateNumber = dfa.states.length;
if (! D.configs.readonly) {
if (! D.configs.readOnly) {
D.configs.optimizeConfigs(this);
D.configs.setReadonly(true);
}