Closure() public method

public Closure ( ) : void
return void
コード例 #1
0
ファイル: dfa.cs プロジェクト: jswiatkowski/cognipy
        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);
        }
コード例 #2
0
ファイル: Dfa.cs プロジェクト: m33p/radegast
        internal Dfa Target(char ch)
        {
            Dfa dfa = new Dfa(this.m_tks);

            for (NList nlist = this.m_nfa; !nlist.AtEnd; nlist = nlist.m_next)
            {
                nlist.m_node.AddTarget(ch, dfa);
            }
            if (dfa.m_nfa.AtEnd)
            {
                return((Dfa)null);
            }
            dfa.Closure();
            for (int index = 0; index < this.m_tks.states.Count; ++index)
            {
                if (((Dfa)this.m_tks.states[index]).SameAs(dfa))
                {
                    return((Dfa)this.m_tks.states[index]);
                }
            }
            dfa.AddActions();
            return(dfa);
        }
コード例 #3
0
ファイル: dfa.cs プロジェクト: hdinh/OmahaBot
        /// <exclude/>
        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;
        }