示例#1
0
 private bool FindReferenceNode(TreeTemplate template, PythonNode node)
 {
     if (template.Match(node))
     {
         if (template.Children.Any())
         {
             if (template.Children.Count != node.Children.Count)
             {
                 return(false);
             }
             for (var i = 0; i < template.Children.Count; i++)
             {
                 var child     = template.Children[i];
                 var childNode = node.Children[i];
                 var result    = FindReferenceNode(child, childNode);
                 if (result == false)
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     return(false);
 }
示例#2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (TreeTemplate != null ? TreeTemplate.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (_path != null ? _path.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#3
0
 public Path(TreeTemplate token, int k)
 {
     _k    = k;
     Token = token;
 }
示例#4
0
 public Pattern(TreeTemplate treeTemplate, int d, Path path)
 {
     TreeTemplate = treeTemplate;
     _path        = path;
     _d           = d;
 }
示例#5
0
 protected bool Equals(TreeTemplate other)
 {
     return(string.Equals(Type, other.Type) && Equals(Children, other.Children) && Equals(Value, other.Value) && Equals(TmpNode, other.TmpNode));
 }