Exemplo n.º 1
0
        public void Add(IToken tok)
        {
            m_vRPN.Add(tok);
            if (tok.AsIValue() != null)
            {
                m_nStackPos++;
            }
            else if (tok.AsICallback() != null)
            {
                ICallback pFun = tok.AsICallback();
                Global.MUP_VERIFY(pFun != null);
                m_nStackPos -= pFun.GetArgsPresent() - 1;
            }

            Global.MUP_VERIFY(m_nStackPos >= 0);
            m_nMaxStackPos = Math.Max(m_nStackPos, m_nMaxStackPos);
        }
Exemplo n.º 2
0
        public void Pop(int num)
        {
            if (!m_vRPN.Any())
            {
                return;
            }

            for (int i = 0; i < num; ++i)
            {
                IToken tok = m_vRPN.Last();

                if (tok.AsIValue() != null)
                {
                    m_nStackPos--;
                }

                m_vRPN.RemoveAt(m_vRPN.Count - 1);
            }
        }