public void DestroyStack(STACKVAL stack)
        {
            var stackname = stack.m_stackname;
            var table     = m_stackList[stack.m_idInParent];

            table.Remove(stackname);
        }
        public static bool FindFunction(STACKVAL istack, string name, out ELEMENT funcElement, out ELEMENT pgmElement) // pgmElement will be needed when get stack.
        {
            STACKVAL stack = istack;

            while (stack.OwnerElement.isPROGRAM() == false)
            {
                stack = stack.Parent;
                if (stack == null)
                {
                    Debug.Log("Unexpected!");
                }
            }

            pgmElement  = stack.OwnerElement;
            funcElement = new ELEMENT()
            {
                group = GROUP.NONE
            };

            for (int i = 0; i < pgmElement.GetListCount(); i++)
            {
                var e = pgmElement.GetListElement(i);
                if (e.isSENTENCE() && e.GetListElement(0).isDEC_FUNC())
                {
                    var cd = e.GetListElement(0);
                    if (name == cd.decname)
                    {
                        funcElement = cd;
                        return(true);
                    }
                }
            }
            return(false);
        }
        public void SetGlobalVal(string vname, object val)
        {
            //UnityEngine.Debug.LogError("SetGlobalVal " + vname + "=" + val);
            STACKVAL ancester = this;

            while (ancester.m_parent != null)
            {
                ancester = ancester.m_parent;
            }
            ancester.DeclareLocalVal(vname);
            SetVal(vname, val);
            //UnityEngine.Debug.LogError("SetGlobalVal " + vname + "=" + val + "--->" + b) ;
        }
        public STACKVAL CreateStack(string istackname, ELEMENT e)
        {
            var newstack  = new STACKVAL();
            var stackname = "<" + istackname + ">";

            newstack.m_stackname    = stackname;
            newstack.m_root         = m_root;
            newstack.m_parent       = this;
            newstack.m_ownerElement = e;
            newstack.m_idInParent   = m_stackList.Count - 1;

            m_curStack[stackname] = newstack;
            return(newstack);
        }
 public STACKVAL()
 {
     m_stackList = new List <Hashtable>();
     m_stackList.Add(new Hashtable());
     m_root = this;
 }