Exemple #1
0
        /// <summary>
        /// wend
        /// </summary>
        /// <param name="s"></param>
        protected void onWhileEnd(Statement s)
        {
            if (m_whileLoopStack.Count <= 0)
            {
                throw new ErrorCode(ErrorCode.ERROR_CODE_17);
            }

            WhileRecord wr = m_whileLoopStack.Peek();

            if (wr.IsLoopDone(calculateExp))
            {
                m_whileLoopStack.Pop();
            }
            else
            {
                m_index = wr.LOOP_BEGIN_INDEX;
                m_index++;
            }
        }
Exemple #2
0
        /// <summary>
        /// while
        /// </summary>
        /// <param name="s"></param>
        protected void onWhileBegin(Statement s)
        {
            WhileRecord wr = new WhileRecord(s.m_expressList[0], s.m_lineIndex);

            if (wr.IsLoopDone(calculateExp))
            {
                int whileCnt = 0;
                // skip to the wend next line
                for (; ;)
                {
                    Statement statement = m_statements[m_index];

                    if (statement.m_type == Statement.TYPE_WHILE_BEGIN)
                    {
                        whileCnt++;
                    }
                    else if (statement.m_type == Statement.TYPE_WHILE_END)
                    {
                        if (whileCnt == 0)
                        {
                            break;
                        }
                        else
                        {
                            whileCnt--;
                        }
                    }

                    m_index++;
                }

                m_index++;
            }
            else
            {
                m_whileLoopStack.Push(wr);
            }
        }
Exemple #3
0
        /// <summary>
        /// while 
        /// </summary>
        /// <param name="s"></param>
        protected void onWhileBegin( Statement s )
        {
            WhileRecord wr = new WhileRecord( s.m_expressList[0], s.m_lineIndex );

            if (wr.IsLoopDone( calculateExp ))
            {
                int whileCnt = 0;
                // skip to the wend next line 
                for (; ; )
                {
                    Statement statement = m_statements[m_index];

                    if (statement.m_type == Statement.TYPE_WHILE_BEGIN)
                    {
                        whileCnt++;
                    }
                    else if (statement.m_type == Statement.TYPE_WHILE_END)
                    {
                        if (whileCnt == 0)
                            break;
                        else
                            whileCnt--;
                    }

                    m_index++;
                }

                m_index++;
            }
            else
            {
                m_whileLoopStack.Push(wr);
            }
        }