Tools.Dfa.Target C# (CSharp) Method

Target() private method

private Target ( char ch ) : Dfa
ch char
return Dfa
        internal Dfa Target(char ch)
        {
            // construct or lookup the target for a new arc
            Dfa n = new Dfa(m_tks);

            for (NList pos = m_nfa; !pos.AtEnd; pos=pos.m_next)
                pos.m_node.AddTarget(ch,n);
            // check we actually got something
            if (n.m_nfa.AtEnd)
                return null;
            n.Closure();
            // now check we haven't got it already
            for (int pos1=0;pos1<m_tks.states.Count;pos1++)
                if (((Dfa)m_tks.states[pos1]).SameAs(n))
                    return (Dfa)m_tks.states[pos1];
            // this is a brand new Dfa node so recursively build it
            n.AddActions();
            return n;
        }