public void SetPrecedenceStartState(int precedence, DFAState startState)
{
if (!IsPrecedenceDfa)
{
throw new Exception("Only precedence DFAs may contain a precedence start state.");
}
if (precedence < 0)
{
return;
}
// synchronization on s0 here is ok. when the DFA is turned into a
// precedence DFA, s0 will be initialized once and not updated again
lock (s0)
{
// s0.edges is never null for a precedence DFA
if (precedence >= s0.edges.Length)
{
s0.edges = Arrays.CopyOf(s0.edges, precedence + 1);
}
s0.edges[precedence] = startState;
}
}