Add error edges to DFA
This commit is contained in:
parent
64354e5740
commit
9206a263b7
|
@ -590,6 +590,8 @@ public class ParserATNSimulator extends ATNSimulator {
|
||||||
// return w/o altering DFA
|
// return w/o altering DFA
|
||||||
return alt;
|
return alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addDFAEdge(dfa, previousD, t, ERROR);
|
||||||
throw noViableAlt(input, outerContext, previousD.configs, startIndex);
|
throw noViableAlt(input, outerContext, previousD.configs, startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1590,6 +1592,10 @@ public class ParserATNSimulator extends ATNSimulator {
|
||||||
|
|
||||||
/** Add D if not there and return D. Return previous if already present. */
|
/** Add D if not there and return D. Return previous if already present. */
|
||||||
protected DFAState addDFAState(@NotNull DFA dfa, @NotNull DFAState D) {
|
protected DFAState addDFAState(@NotNull DFA dfa, @NotNull DFAState D) {
|
||||||
|
if (D == ERROR) {
|
||||||
|
return D;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (dfa.states) {
|
synchronized (dfa.states) {
|
||||||
DFAState existing = dfa.states.get(D);
|
DFAState existing = dfa.states.get(D);
|
||||||
if ( existing!=null ) return existing;
|
if ( existing!=null ) return existing;
|
||||||
|
|
Loading…
Reference in New Issue