protected void HandleKleen(BuildDFA buildDfa, int head, int tail) { switch (m_kleene) { case EKleene.ZeroOrMore: buildDfa.AddLambdaEdge(head, tail); buildDfa.AddLambdaEdge(tail, head); break; case EKleene.OneOrMore: buildDfa.AddLambdaEdge(tail, head); break; case EKleene.ZeroOrOne: buildDfa.AddLambdaEdge(head, tail); break; } }
internal Automata CreateAutomata(BuildDFA buildDfa) { Debug.Assert(m_items.Count > 0); var automata = m_items[0].CreateAutomata(buildDfa); var head = automata.Head; var tail = automata.Tail; for (var i = 1; i < m_items.Count; ++i) { automata = m_items[i].CreateAutomata(buildDfa); buildDfa.AddLambdaEdge(tail, automata.Head); tail = automata.Tail; } return(new Automata { Head = head, Tail = tail }); }