Home | History | Annotate | Download | only in lib2to3

Lines Matching full:nodes

57         Compare two nodes for equality.
69 Compare two nodes for inequality.
79 Compare two nodes for equality.
81 This is called by __eq__ and __ne__. It is only called if the two nodes
83 Nodes should be considered equal if they have the same structure,
241 """Concrete implementation for interior nodes."""
251 child nodes, and an optional context keyword argument.
286 """Compare two nodes for equality."""
353 """Concrete implementation for leaf nodes."""
397 """Compare two nodes for equality."""
461 - WildcardPattern matches a sequence of nodes of variable length.
495 updated with the nodes matching named subpatterns.
513 def match_seq(self, nodes, results=None):
515 Does this pattern exactly match a sequence of nodes?
519 if len(nodes) != 1:
521 return self.match(nodes[0], results)
523 def generate_matches(self, nodes):
530 if nodes and self.match(nodes[0], r):
571 updated with the nodes matching named subpatterns.
589 non-leaf nodes that also match the content pattern.
620 updated with the nodes matching named subpatterns.
642 A wildcard pattern can match zero or more nodes.
711 def match_seq(self, nodes, results=None):
712 """Does this pattern exactly match a sequence of nodes?"""
713 for c, r in self.generate_matches(nodes):
714 if c == len(nodes):
718 results[self.name] = list(nodes)
722 def generate_matches(self, nodes):
724 Generator yielding matches for a sequence of nodes.
727 nodes: sequence of nodes
731 count: the match comprises nodes[:count];
736 for count in xrange(self.min, 1 + min(len(nodes), self.max)):
739 r[self.name] = nodes[:count]
742 yield self._bare_name_matches(nodes)
752 for count, r in self._recursive_matches(nodes, 0):
754 r[self.name] = nodes[:count]
759 for count, r in self._iterative_matches(nodes):
761 r[self.name] = nodes[:count]
767 def _iterative_matches(self, nodes):
769 nodelen = len(nodes)
776 for c, r in generate_matches(alt, nodes):
780 # for each match, iterate down the nodes
784 # stop if the entire set of nodes has been matched
787 for c1, r1 in generate_matches(alt, nodes[c0:]):
796 def _bare_name_matches(self, nodes):
801 max = len(nodes)
805 if leaf[0].match(nodes[count], r):
809 r[self.name] = nodes[:count]
812 def _recursive_matches(self, nodes, count):
819 for c0, r0 in generate_matches(alt, nodes):
820 for c1, r1 in self._recursive_matches(nodes[c0:], count+1):
846 def match_seq(self, nodes):
847 # We only match an empty sequence of nodes in its entirety
848 return len(nodes) == 0
850 def generate_matches(self, nodes):
853 if len(nodes) == 0:
857 for c, r in self.content.generate_matches(nodes):
862 def generate_matches(patterns, nodes):
864 Generator yielding matches for a sequence of patterns and nodes.
868 nodes: a sequence of nodes
872 count: the entire sequence of patterns matches nodes[:count];
879 for c0, r0 in p.generate_matches(nodes):
883 for c1, r1 in generate_matches(rest, nodes[c0:]):