/***************************************************************
         * Function: machine
         * Description: Recursive descent regular expression parser.
         **************************************************************/
        private CNfa machine
        (
        )
        {
            CNfa         start;
            CNfa         p;
            SparseBitSet states;

            if (CUtility.DESCENT_DEBUG)
            {
                CUtility.enter("machine", m_spec.m_lexeme, m_spec.m_current_token);
            }

            start = CAlloc.newCNfa(m_spec);
            p     = start;

            states = m_lexGen.getStates();

            /* Begin: Added for states. */
            m_spec.m_current_token = CLexGen.EOS;
            m_lexGen.advance();
            /* End: Added for states. */

            if (CLexGen.END_OF_INPUT != m_spec.m_current_token) // CSA fix.
            {
                p.m_next = rule();

                processStates(states, p.m_next);
            }

            while (CLexGen.END_OF_INPUT != m_spec.m_current_token)
            {
                /* Make state changes HERE. */
                states = m_lexGen.getStates();

                /* Begin: Added for states. */
                m_lexGen.advance();
                if (CLexGen.END_OF_INPUT == m_spec.m_current_token)
                {
                    break;
                }
                /* End: Added for states. */

                p.m_next2 = CAlloc.newCNfa(m_spec);
                p         = p.m_next2;
                p.m_next  = rule();

                processStates(states, p.m_next);
            }

            // CSA: add pseudo-rules for BOL and EOF
            SparseBitSet all_states = new SparseBitSet();

            for (int i = 0; i < m_spec.m_states.Count; ++i)
            {
                all_states.Set(i);
            }
            p.m_next2       = CAlloc.newCNfa(m_spec);
            p               = p.m_next2;
            p.m_next        = CAlloc.newCNfa(m_spec);
            p.m_next.m_edge = CNfa.CCL;
            p.m_next.m_next = CAlloc.newCNfa(m_spec);
            p.m_next.m_set  = new CSet();
            p.m_next.m_set.add(m_spec.BOL);
            p.m_next.m_set.add(m_spec.EOF);
            p.m_next.m_next.m_accept = // do-nothing accept rule
                                       new CAccept(new char[0], 0, m_input.m_line_number + 1);
            processStates(all_states, p.m_next);
            // CSA: done.

            if (CUtility.DESCENT_DEBUG)
            {
                CUtility.leave("machine", m_spec.m_lexeme, m_spec.m_current_token);
            }

            return(start);
        }