コード例 #1
0
ファイル: SSYacc.cs プロジェクト: woodymax/SSASDiag
        public bool doConflict()
        {
            this.m_cache = 0;
            int num = 0;

            num = this.m_lexSubtable.lookup(num, this.m_lookahead.token());
            while ((this.m_larLookahead = this.getLexemeCache()) != null)
            {
                num = this.m_lexSubtable.lookup(num, this.m_larLookahead.token());
                if (num == -1)
                {
                    break;
                }
                SSLexFinalState state = this.m_lexSubtable.lookupFinal(num);
                if (state.isFinal())
                {
                    if (state.isReduce())
                    {
                        this.m_production = state.token();
                        SSYaccTableProd prod = this.m_table.lookupProd(this.m_production);
                        this.m_leftside       = prod.leftside();
                        this.m_productionSize = prod.size();
                        return(this.doReduce());
                    }
                    this.m_state = state.token();
                    return(this.doShift());
                }
            }
            return(this.doLarError());
        }
コード例 #2
0
ファイル: SSYacc.cs プロジェクト: woodymax/SSASDiag
        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;
                }
            }
        }