예제 #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
 public SSLexLexeme(SSLexConsumer q_consumer, SSLexFinalState q_final, SSLexMark q_mark)
 {
     this.m_token  = q_final.token();
     this.m_line   = q_consumer.line();
     this.m_offset = q_consumer.offset();
     this.m_index  = q_consumer.index();
     this.m_lexeme = q_consumer.lexemeBuffer(q_mark);
     this.m_length = q_consumer.lexemeLength(q_mark);
 }
예제 #3
0
파일: SSLex.cs 프로젝트: woodymax/SSASDiag
        public SSLexLexeme next()
        {
            bool            flag   = false;
            SSLexLexeme     lexeme = null;
            SSLexFinalState state  = null;

Label_0006:
            this.m_state = 0;
            flag         = false;
            SSLexMark mark = null;

            state = this.m_table.lookupFinal(this.m_state);
            if (state.isFinal())
            {
                this.m_consumer.mark();
            }
            while (this.m_consumer.next())
            {
                flag = true;
                this.m_currentChar[0] = this.m_consumer.getCurrent();
                this.m_table.translateClass(this.m_currentChar);
                this.m_state = this.m_table.lookup(this.m_state, this.m_currentChar[0]);
                if (this.m_state == -1)
                {
                    break;
                }
                SSLexFinalState state2 = this.m_table.lookupFinal(this.m_state);
                if (state2.isFinal())
                {
                    mark  = this.m_consumer.mark();
                    state = state2;
                }
                if (state2.isContextStart())
                {
                    this.m_consumer.mark();
                }
            }
            if (flag)
            {
                if (state.isContextEnd() && (mark != null))
                {
                    this.m_consumer.flushEndOfLine(mark);
                }
                if (state.isIgnore() && (mark != null))
                {
                    this.m_consumer.flushLexeme(mark);
                    if (state.isPop() && state.isPush())
                    {
                        this.m_table.gotoSubtable(state.pushIndex());
                    }
                    else if (state.isPop())
                    {
                        this.m_table.popSubtable();
                    }
                    else if (state.isPush())
                    {
                        this.m_table.pushSubtable(state.pushIndex());
                    }
                    goto Label_0006;
                }
                if (!state.isFinal() || (mark == null))
                {
                    lexeme = new SSLexLexeme(this.m_consumer);
                    if (this.error(lexeme))
                    {
                        return(lexeme);
                    }
                    this.m_consumer.flushLexeme();
                    lexeme = null;
                    goto Label_0006;
                }
                if (state.isPop() && state.isPush())
                {
                    this.m_table.gotoSubtable(state.pushIndex());
                }
                else if (state.isPop())
                {
                    this.m_table.popSubtable();
                }
                else if (state.isPush())
                {
                    this.m_table.pushSubtable(state.pushIndex());
                }
                if ((state.isStartOfLine() && (this.m_consumer.line() != 0)) && (this.m_consumer.offset() != 0))
                {
                    this.m_consumer.flushStartOfLine(mark);
                }
                lexeme = new SSLexLexeme(this.m_consumer, state, mark);
                if (state.isKeyword())
                {
                    this.m_table.findKeyword(lexeme);
                }
                this.m_consumer.flushLexeme(mark);
                if (!this.complete(lexeme))
                {
                    lexeme = null;
                    goto Label_0006;
                }
            }
            return(lexeme);
        }