Пример #1
0
        /*-----------------------------------------------------------*/
        /*--- Static Methods ----------------------------------------*/
        /*-----------------------------------------------------------*/

        /// <summary>Helper routine for debugging -- produces a dump of the given state
        /// onto System.out.
        /// </summary>
        protected internal static void  dump_state(lalr_state st)
        {
            lalr_item_set   itms;
            lalr_item       itm;
            production_part part;

            if (st == null)
            {
                System.Console.Out.WriteLine("NULL lalr_state");
                return;
            }

            System.Console.Out.WriteLine("lalr_state [" + st.index() + "] {");
            itms = st.items();
            //UPGRADE_TODO: method 'java.util.Enumeration.hasMoreElements' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationhasMoreElements"'
            for (System.Collections.IEnumerator e = itms.all(); e.MoveNext();)
            {
                //UPGRADE_TODO: method 'java.util.Enumeration.nextElement' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationnextElement"'
                itm = (lalr_item)e.Current;
                System.Console.Out.Write("  [");
                System.Console.Out.Write(itm.the_production().lhs().the_symbol().name_Renamed_Method());
                System.Console.Out.Write(" ::= ");
                for (int i = 0; i < itm.the_production().rhs_length(); i++)
                {
                    if (i == itm.dot_pos())
                    {
                        System.Console.Out.Write("(*) ");
                    }
                    part = itm.the_production().rhs(i);
                    if (part.is_action())
                    {
                        System.Console.Out.Write("{action} ");
                    }
                    else
                    {
                        System.Console.Out.Write(((symbol_part)part).the_symbol().name_Renamed_Method() + " ");
                    }
                }
                if (itm.dot_at_end())
                {
                    System.Console.Out.Write("(*) ");
                }
                System.Console.Out.WriteLine("]");
            }
            System.Console.Out.WriteLine("}");
        }
Пример #2
0
        /*-----------------------------------------------------------*/
        /*--- Static Methods ----------------------------------------*/
        /*-----------------------------------------------------------*/
        /// <summary>Helper routine for debugging -- produces a dump of the given state
        /// onto System.out.
        /// </summary>
        protected internal static void dump_state(lalr_state st)
        {
            lalr_item_set itms;
            lalr_item itm;
            production_part part;

            if (st == null)
            {
                System.Console.Out.WriteLine("NULL lalr_state");
                return ;
            }

            System.Console.Out.WriteLine("lalr_state [" + st.index() + "] {");
            itms = st.items();
            //UPGRADE_TODO: method 'java.util.Enumeration.hasMoreElements' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationhasMoreElements"'
             for (System.Collections.IEnumerator e = itms.all(); e.MoveNext(); )
            {
                //UPGRADE_TODO: method 'java.util.Enumeration.nextElement' was converted to ' ' which has a different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1073_javautilEnumerationnextElement"'
                itm = (lalr_item) e.Current;
                System.Console.Out.Write("  [");
                System.Console.Out.Write(itm.the_production().lhs().the_symbol().name_Renamed_Method());
                System.Console.Out.Write(" ::= ");
                 for (int i = 0; i < itm.the_production().rhs_length(); i++)
                {
                    if (i == itm.dot_pos())
                        System.Console.Out.Write("(*) ");
                    part = itm.the_production().rhs(i);
                    if (part.is_action())
                        System.Console.Out.Write("{action} ");
                    else
                        System.Console.Out.Write(((symbol_part) part).the_symbol().name_Renamed_Method() + " ");
                }
                if (itm.dot_at_end())
                    System.Console.Out.Write("(*) ");
                System.Console.Out.WriteLine("]");
            }
            System.Console.Out.WriteLine("}");
        }
Пример #3
0
 /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
 /// <summary>Equality comparison. 
 /// </summary>
 public virtual bool equals(lalr_state other)
 {
     /* we are equal if our item sets are equal */
     return other != null && items().equals(other.items());
 }
Пример #4
0
        /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

        /// <summary>Equality comparison.
        /// </summary>
        public virtual bool equals(lalr_state other)
        {
            /* we are equal if our item sets are equal */
            return(other != null && items().equals(other.items()));
        }