private int original_charset_size; // original charset size

        #endregion Fields

        #region Methods

        public void simplify(CSpec m_spec)
        {
            computeClasses(m_spec); // initialize fields.

            // now rewrite the NFA using our character class mapping.
              IEnumerator e=m_spec.m_nfa_states.elements();
            while ( e.MoveNext() )
            {
                CNfa nfa = (CNfa) e.Current;
                if (nfa.m_edge==CNfa.EMPTY || nfa.m_edge==CNfa.EPSILON)
                    continue; // no change.
                if (nfa.m_edge==CNfa.CCL)
                {
                    CSet ncset = new CSet();
                    ncset.map(nfa.m_set, ccls); // map it.
                    nfa.m_set = ncset;
                }
                else
                { // single character
                    nfa.m_edge = ccls[nfa.m_edge]; // map it.
                }
            }

            // now update m_spec with the mapping.
            m_spec.m_ccls_map = ccls;
            m_spec.m_dtrans_ncols = mapped_charset_size;
        }
Exemplo n.º 2
0
        private int mapped_charset_size;   // reduced charset size

        public void simplify(CSpec m_spec)
        {
            computeClasses(m_spec); // initialize fields.

            // now rewrite the NFA using our character class mapping.
            IEnumerator e = m_spec.m_nfa_states.elements();

            while (e.MoveNext())
            {
                CNfa nfa = (CNfa)e.Current;
                if (nfa.m_edge == CNfa.EMPTY || nfa.m_edge == CNfa.EPSILON)
                {
                    continue; // no change.
                }
                if (nfa.m_edge == CNfa.CCL)
                {
                    CSet ncset = new CSet();
                    ncset.map(nfa.m_set, ccls); // map it.
                    nfa.m_set = ncset;
                }
                else
                {                                  // single character
                    nfa.m_edge = ccls[nfa.m_edge]; // map it.
                }
            }

            // now update m_spec with the mapping.
            m_spec.m_ccls_map     = ccls;
            m_spec.m_dtrans_ncols = mapped_charset_size;
        }