Exemplo n.º 1
0
        public bool lookupGoto(int q_state, int q_token)
        {
            SSYaccTableRowEntry entry = this.m_table.lookupRow(q_state).lookupGoto(q_token);

            if (entry == null)
            {
                return(true);
            }
            this.m_state = entry.entry();
            return(false);
        }
Exemplo n.º 2
0
        public void lookupAction(int q_state, int q_token)
        {
            SSYaccTableRowEntry entry = this.m_table.lookupRow(q_state).lookupAction(q_token);

            if (entry == null)
            {
                this.m_action = 1;
            }
            else
            {
                switch ((this.m_action = entry.action()))
                {
                case 0:
                    this.m_state = entry.entry();
                    return;

                case 1:
                case 3:
                    break;

                case 2:
                {
                    SSYaccTableProd prod = this.m_table.lookupProd(entry.entry());
                    this.m_production     = entry.entry();
                    this.m_leftside       = prod.leftside();
                    this.m_productionSize = prod.size();
                    return;
                }

                case 4:
                    this.m_lexSubtable = this.m_table.larTable(entry.entry());
                    break;

                default:
                    return;
                }
            }
        }
Exemplo n.º 3
0
        public bool syncErr()
        {
            SSYaccTableRow row3;
            SSYaccSet      set = new SSYaccSet();

            for (int i = 0; i < this.m_stack.getSize(); i++)
            {
                int            num2 = ((SSYaccStackElement)this.m_stack.elementAt(i)).state();
                SSYaccTableRow row  = this.m_table.lookupRow(num2);
                if (row.hasSync() || row.hasSyncAll())
                {
                    for (int j = 0; j < row.action(); j++)
                    {
                        SSYaccTableRowEntry entry = row.lookupEntry(j);
                        if (row.hasSyncAll() || entry.hasSync())
                        {
                            int num4 = entry.token();
                            set.add(num4);
                        }
                    }
                }
                if (row.hasError())
                {
                    SSYaccTableRow row2 = this.m_table.lookupRow(row.lookupError().entry());
                    for (int k = 0; k < row2.action(); k++)
                    {
                        int num6 = row2.lookupEntry(k).token();
                        set.add(num6);
                    }
                }
            }
            if (set.Count == 0)
            {
                return(true);
            }
            while (!set.locate(this.m_lookahead.token()))
            {
                if (this.doGetLexeme(false))
                {
                    return(true);
                }
            }
Label_012B:
            row3 = this.m_table.lookupRow(this.m_state);
            if (row3.hasError())
            {
                this.lookupAction(row3.lookupError().entry(), this.m_lookahead.token());
                if (this.m_action != 1)
                {
                    SSLexLexeme lexeme = new SSLexLexeme("%error", -2);
                    this.m_element = this.stackElement();
                    this.m_element.setLexeme(lexeme);
                    this.m_element.setState(row3.lookupError().entry());
                    this.push();
                    goto Label_0226;
                }
            }
            if (row3.hasSyncAll())
            {
                this.lookupAction(this.m_state, this.m_lookahead.token());
                if (this.m_action == 1)
                {
                    goto Label_0219;
                }
                goto Label_0226;
            }
            if (row3.hasSync() && (row3.lookupAction(this.m_lookahead.token()) != null))
            {
                this.lookupAction(this.m_state, this.m_lookahead.token());
                goto Label_0226;
            }
Label_0219:
            this.pop(1);
            goto Label_012B;
Label_0226:
            return(false);
        }