示例#1
0
        /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
        /// <summary>Produce warning messages for all conflicts found in this state.  
        /// </summary>
        protected internal virtual void report_conflicts(terminal_set conflict_set)
        {
            lalr_item itm, compare;
            //symbol shift_sym;

            bool after_itm;

            /* consider each element */
            //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 itms = items().all(); itms.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) itms.Current;

                /* clear the S/R conflict set for this item */

                /* if it results in a reduce, it could be a conflict */
                if (itm.dot_at_end())
                {
                    /* not yet after itm */
                    after_itm = false;

                    /* compare this item against all others looking for conflicts */
                    //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 comps = items().all(); comps.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"'
                        compare = (lalr_item) comps.Current;

                        /* if this is the item, next one is after it */
                        if (itm == compare)
                            after_itm = true;

                        /* only look at it if its not the same item */
                        if (itm != compare)
                        {
                            /* is it a reduce */
                            if (compare.dot_at_end())
                            {
                                /* only look at reduces after itm */
                                if (after_itm)
                                    if (compare.lookahead().intersects(itm.lookahead()))
                                        report_reduce_reduce(itm, compare);
                            }
                        }
                    }
                    /* report S/R conflicts under all the symbols we conflict under */
                     for (int t = 0; t < terminal.number(); t++)
                        if (conflict_set.contains(t))
                            report_shift_reduce(itm, t);
                }
            }
        }
示例#2
0
        /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

        /// <summary>Produce warning messages for all conflicts found in this state.
        /// </summary>
        protected internal virtual void  report_conflicts(terminal_set conflict_set)
        {
            lalr_item itm, compare;
            //symbol shift_sym;

            bool after_itm;

            /* consider each element */
            //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 itms = items().all(); itms.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)itms.Current;

                /* clear the S/R conflict set for this item */

                /* if it results in a reduce, it could be a conflict */
                if (itm.dot_at_end())
                {
                    /* not yet after itm */
                    after_itm = false;

                    /* compare this item against all others looking for conflicts */
                    //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 comps = items().all(); comps.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"'
                        compare = (lalr_item)comps.Current;

                        /* if this is the item, next one is after it */
                        if (itm == compare)
                        {
                            after_itm = true;
                        }

                        /* only look at it if its not the same item */
                        if (itm != compare)
                        {
                            /* is it a reduce */
                            if (compare.dot_at_end())
                            {
                                /* only look at reduces after itm */
                                if (after_itm)
                                {
                                    if (compare.lookahead().intersects(itm.lookahead()))
                                    {
                                        report_reduce_reduce(itm, compare);
                                    }
                                }
                            }
                        }
                    }
                    /* report S/R conflicts under all the symbols we conflict under */
                    for (int t = 0; t < terminal.number(); t++)
                    {
                        if (conflict_set.contains(t))
                        {
                            report_shift_reduce(itm, t);
                        }
                    }
                }
            }
        }