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); }
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); } }
public Path(TreeTemplate token, int k) { _k = k; Token = token; }
public Pattern(TreeTemplate treeTemplate, int d, Path path) { TreeTemplate = treeTemplate; _path = path; _d = d; }
protected bool Equals(TreeTemplate other) { return(string.Equals(Type, other.Type) && Equals(Children, other.Children) && Equals(Value, other.Value) && Equals(TmpNode, other.TmpNode)); }