コード例 #1
0
 public void flushStartOfLine(SSLexMark q_mark)
 {
     this.m_line++;
     this.m_start++;
     q_mark.m_line--;
     this.m_offset = 1;
 }
コード例 #2
0
 public virtual void flushLexeme(SSLexMark q_mark)
 {
     this.m_start       = this.m_index = q_mark.m_index;
     this.m_line       += q_mark.m_line;
     this.m_offset      = q_mark.m_offset;
     this.m_scanLine    = 0;
     this.m_scanOffset  = q_mark.m_offset;
     this.m_bufferIndex = 0;
 }
コード例 #3
0
ファイル: SSLexLexeme.cs プロジェクト: woodymax/SSASDiag
 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);
 }
コード例 #4
0
 public override void flushLexeme(SSLexMark q_mark)
 {
     base.m_start               = base.m_index = q_mark.m_index;
     base.m_line               += q_mark.m_line;
     base.m_offset              = q_mark.m_offset;
     base.m_scanLine            = 0;
     base.m_scanOffset          = q_mark.m_offset;
     base.m_bufferIndex         = 0;
     this.m_fileStream.Position = base.m_index;
 }
コード例 #5
0
        public char[] lexemeBuffer(SSLexMark q_mark)
        {
            int num = this.lexemeLength(q_mark);

            char[] chArray = new char[num];
            for (int i = 0; i < num; i++)
            {
                chArray[i] = this.m_buffer[i];
            }
            return(chArray);
        }
コード例 #6
0
 public void flushEndOfLine(SSLexMark q_mark)
 {
     q_mark.m_line--;
     q_mark.m_index--;
 }
コード例 #7
0
 public int lexemeLength(SSLexMark q_mark)
 {
     return(q_mark.index() - this.m_start);
 }
コード例 #8
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);
        }