forked from jasder/antlr
Fixes #1369 by removing any redundant edges.
This commit is contained in:
parent
1aa3c957eb
commit
125a509e4e
|
@ -192,18 +192,20 @@ public abstract class ATNState {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean alreadyPresent = false;
|
boolean alreadyPresent = false;
|
||||||
// for (Transition t : transitions) {
|
for (Transition t : transitions) {
|
||||||
// if ( t.target.stateNumber == e.target.stateNumber ) {
|
if ( t.target.stateNumber == e.target.stateNumber ) {
|
||||||
// if ( t.label()!=null && e.label()!=null && t.label().equals(e.label()) ) {
|
if ( t.label()!=null && e.label()!=null && t.label().equals(e.label()) ) {
|
||||||
// System.err.println("Repeated transition upon "+e.label()+" from "+stateNumber+"->"+t.target.stateNumber);
|
// System.err.println("Repeated transition upon "+e.label()+" from "+stateNumber+"->"+t.target.stateNumber);
|
||||||
// alreadyPresent = true;
|
alreadyPresent = true;
|
||||||
// }
|
break;
|
||||||
// else if ( t.isEpsilon() && e.isEpsilon() ) {
|
}
|
||||||
|
else if ( t.isEpsilon() && e.isEpsilon() ) {
|
||||||
// System.err.println("Repeated epsilon transition from "+stateNumber+"->"+t.target.stateNumber);
|
// System.err.println("Repeated epsilon transition from "+stateNumber+"->"+t.target.stateNumber);
|
||||||
// alreadyPresent = true;
|
alreadyPresent = true;
|
||||||
// }
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
if ( !alreadyPresent ) {
|
if ( !alreadyPresent ) {
|
||||||
transitions.add(index, e);
|
transitions.add(index, e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue