public nonTerminalNode(string nam,nonTerminals nonTerminal)
 {
     nonTerms=nonTerminal;
     lawLink = new Laws(this);
     next=null;
     item.Name=nam;
 }
 public nonTerminals(ParsHead PH)
 {
     this.parent = PH;
     first=null;
 }
 public void checkAdd(string nonTerm,int lawNum)
 {
     try
     {
         nonTerminalNode thisNode=null;
         string []part=nonTerm.Split(' ');
         string NonTerm=part[0].Substring(1,part[0].Length-1);
         nonTerminalNode temp;
         if(first==null)
         {
             first = new nonTerminalNode(nonTerminals.ExtraNonTerm,this);
             first.lawLink.add(0,nonTerminals.ExtraNonTerm+" #"+NonTerm);
             this.checkAdd(nonTerm,lawNum);
             return;
         }
         else
         {
             temp=first;
             while(temp.next!=null)
             {
                 if(temp.item.Name==NonTerm)
                 {
                     thisNode=temp;
                     break;
                 }
                 temp=temp.next;
             }
             if(thisNode==null)
             {
                 if(temp.item.Name!=NonTerm)
                 {
                     temp.next = new nonTerminalNode(NonTerm,this);
                     thisNode=temp.next;
                     count++;
                 }
                 else
                     thisNode=temp;
             }
         }
         thisNode.lawLink.add(lawNum,nonTerm);
     }
     catch(Exception e1)
     {
         MessageBox.Show("in nonTerminals.CheckAdd : "+e1.Message);
     }
 }
Beispiel #4
0
 //...............................
 public Laws(nonTerminalNode parentNonTerm)
 {
     first=null;
     lawsCount=0;
     this.parent=parentNonTerm;
 }