コード例 #1
0
ファイル: MyStack.cs プロジェクト: sky4walk/WhileCompiler
        /// <summary>
        /// Pop
        /// </summary>
        /// <returns>returns object from stack</returns>
        public object Pop()
        {
            object obj = null;

            if (m_stkPos > 0)
            {
                m_stkPos--;
                obj = m_stk[m_stkPos];
                m_stk.RemoveAt(m_stkPos);
            }
            return(obj);
        }
コード例 #2
0
 private void ChangeGotoStates(MyArrayList fndHuellen, int OldStateNr, int NewStateNr)
 {
     for (int i = 0; i < m_GotoTableNeu.Count; i++)
     {
         GotoEntry ge = (GotoEntry)m_GotoTableNeu[i];
         if (ge.JumpToState == OldStateNr)
         {
             ge.JumpToState = NewStateNr;
         }
         for (int j = 0; j < fndHuellen.Count; j++)
         {
             int Nr = (int)fndHuellen[j];
             if (Nr == ge.JumpToState)
             {
                 ge.JumpToState = NewStateNr;
             }
             if (Nr == ge.ThisState)
             {
                 m_GotoTableNeu.RemoveAt(i);
                 i--;
             }
         }
     }
 }
コード例 #3
0
        private void DeleteStartRule(RuleStart rs)
        {
            BNFRule   bnfRl   = rs.GetRuleConnect();
            RuleStart AltNext = rs.GetAlternate();
            RuleStart AltBack = rs.GetAlternateBack();

            if (AltBack != null)
            {
                AltBack.SetAlternate(AltNext);
            }
            if (AltNext != null)
            {
                AltNext.SetAlternateBack(AltBack);
            }
            int index = bnfRl.Index;

            m_Rules.RemoveAt(index);
        }