public static PegNode FindNodeInParents(PegNode node, EPegGrammar id)
 {
     for(; node!=null;node=node.parent_)
     {
         if( node.id_ == (int) id ) return node;
     }
     return null;
 }
 public static PegNode FindNode(PegNode node, EPegGrammar id, int nodeDistance)
 {
     if (node == null || nodeDistance<=0) return null;
     if (node.id_ == (int)id) return node;
     PegNode foundNode = FindNode(node.child_, id, nodeDistance - 1);
     if (foundNode!=null) return foundNode;
     foundNode = FindNode(node.next_, id, nodeDistance - 1);
     if (foundNode != null) return foundNode;
     return null;
 }
 public static PegNode FindNodeNext(PegNode node, EPegGrammar id)
 {
     for (node = node.next_; node != null; node = node.next_)
     {
         if (node.id_ == (int)id) return node;
     }
     return null;
 }
 public static PegNode FindNode(PegNode node, EPegGrammar id)
 {
     return FindNode(node, id, 8);
 }
 internal TRepetition(int nLowerLimit, int nUpperLimit, EPegGrammar id, PegBegEnd begEnd)
     : base(null, (int)id)
 {
     base.match_ = begEnd;
     lower = nLowerLimit;
     upper = nUpperLimit;
 }
 PegNode NewNode(
                     EPegGrammar id,
                     PegBegEnd match,
                     PegNode child)
 {
     return NewNode(id, match, child, null);
 }
 PegNode NewNode(
                     EPegGrammar id,
                     PegBegEnd match)
 {
     return NewNode(id, match, null, null);
 }
 PegNode NewNode(
                     EPegGrammar id,
                     PegBegEnd match,
                     PegNode child,
                     PegNode next)
 {
     PegNode n = new PegNode(null, (int)id);
     n.match_ = match;
     n.child_ = child;
     n.next_ = next;
     for (PegNode node = n.child_; node != null; node = node.next_) node.parent_ = n;
     return n;
 }