예제 #1
0
파일: codeTree.cs 프로젝트: imughal/Aruuz
        public void AddChild(codeLocation loc) //Recursive Implementation [be careful!]
        {

            if (this.children.Count > 0)
            {
                if (this.children[0].location.wordRef == loc.wordRef)
                {
                    bool flag = false;
                    for (int i = 0; i < this.children.Count; i++)
                    {
                        if (loc.codeRef == this.children[i].location.codeRef)
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        CodeTree child = new CodeTree(loc);
                        child.errorParam = errorParam;
                        this.children.Add(child);
                    }
                }
                else
                {
                    for (int i = 0; i < this.children.Count; i++)
                    {
                        this.children[i].errorParam = errorParam;
                        this.children[i].AddChild(loc);
                    }
                }
            }
            else
            {
                if (this.location.wordRef == loc.wordRef - 1)
                {
                    CodeTree child = new CodeTree(loc);
                    child.errorParam = errorParam;
                    children.Add(child);
                }
            }
        }
예제 #2
0
 public void AddChild(codeLocation loc) //Recursive Implementation [be careful!]
 {
     if (this.children.Count > 0)
     {
         if (this.children[0].location.wordRef == loc.wordRef)
         {
             bool flag = false;
             for (int i = 0; i < this.children.Count; i++)
             {
                 if (loc.codeRef == this.children[i].location.codeRef)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 CodeTree child = new CodeTree(loc);
                 child.errorParam = errorParam;
                 this.children.Add(child);
             }
         }
         else
         {
             for (int i = 0; i < this.children.Count; i++)
             {
                 this.children[i].errorParam = errorParam;
                 this.children[i].AddChild(loc);
             }
         }
     }
     else
     {
         if (this.location.wordRef == loc.wordRef - 1)
         {
             CodeTree child = new CodeTree(loc);
             child.errorParam = errorParam;
             children.Add(child);
         }
     }
 }