protected DFAState AddDFAEdge(DFA dfa,
DFAState from,
int t,
DFAState to)
{
if (debug)
{
Console.WriteLine("EDGE " + from + " -> " + to + " upon " + GetTokenName(t));
}
if (to == null)
{
return null;
}
to = AddDFAState(dfa, to); // used existing if possible not incoming
if (from == null || t < -1 || t > atn.maxTokenType)
{
return to;
}
lock (from)
{
if (from.edges == null)
{
from.edges = new DFAState[atn.maxTokenType + 1 + 1];
}
from.edges[t + 1] = to; // connect
}
if (debug)
{
Console.WriteLine("DFA=\n" + dfa.ToString(parser != null ? parser.Vocabulary : Vocabulary.EmptyVocabulary));
}
return to;
}