Beispiel #1
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);
                }
            }
        }
Beispiel #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);
         }
     }
 }