Revert "add counter for stack graph nodes."
This reverts commit 43e73c8da9
.
This commit is contained in:
parent
bc4b530b3b
commit
ecf2258380
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
package org.antlr.v4.runtime.atn;
|
package org.antlr.v4.runtime.atn;
|
||||||
|
|
||||||
import org.antlr.misc.MutableInteger;
|
|
||||||
import org.antlr.v4.runtime.Recognizer;
|
import org.antlr.v4.runtime.Recognizer;
|
||||||
import org.antlr.v4.runtime.RuleContext;
|
import org.antlr.v4.runtime.RuleContext;
|
||||||
import org.antlr.v4.runtime.misc.DoubleKeyMap;
|
import org.antlr.v4.runtime.misc.DoubleKeyMap;
|
||||||
|
@ -655,26 +654,6 @@ public abstract class PredictionContext implements Iterable<SingletonPredictionC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int countAllContextNodes(PredictionContext context) {
|
|
||||||
MutableInteger count = new MutableInteger(0);
|
|
||||||
Map<PredictionContext, PredictionContext> visited =
|
|
||||||
new IdentityHashMap<PredictionContext, PredictionContext>();
|
|
||||||
countAllContextNodes_(context, count, visited);
|
|
||||||
return count.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void countAllContextNodes_(PredictionContext context,
|
|
||||||
MutableInteger count,
|
|
||||||
Map<PredictionContext, PredictionContext> visited)
|
|
||||||
{
|
|
||||||
if ( context==null || visited.containsKey(context) ) return;
|
|
||||||
visited.put(context, context);
|
|
||||||
count.value++;
|
|
||||||
for (int i = 0; i < context.size(); i++) {
|
|
||||||
countAllContextNodes_(context.getParent(i), count, visited);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(@Nullable Recognizer<?,?> recog) {
|
public String toString(@Nullable Recognizer<?,?> recog) {
|
||||||
return toString();
|
return toString();
|
||||||
// return toString(recog, ParserRuleContext.EMPTY);
|
// return toString(recog, ParserRuleContext.EMPTY);
|
||||||
|
|
Loading…
Reference in New Issue