forked from jasder/antlr
No need to continue SLL prediction if every configuration is at a RuleStopState
This commit is contained in:
parent
61b872377c
commit
b34ad624bc
|
@ -183,6 +183,10 @@ public enum PredictionMode {
|
|||
predicates.
|
||||
*/
|
||||
public static boolean hasSLLConflictTerminatingPrediction(PredictionMode mode, @NotNull ATNConfigSet configs) {
|
||||
if (onlyRuleStopStates(configs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// pure SLL mode parsing
|
||||
if ( mode == PredictionMode.SLL ) {
|
||||
// Don't bother with combining configs from different semantic
|
||||
|
@ -208,6 +212,15 @@ public enum PredictionMode {
|
|||
return heuristic;
|
||||
}
|
||||
|
||||
public static boolean onlyRuleStopStates(@NotNull ATNConfigSet configs) {
|
||||
for (ATNConfig config : configs) {
|
||||
if (!(config.state instanceof RuleStopState)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
Full LL prediction termination.
|
||||
|
|
Loading…
Reference in New Issue