Special optimized matcher for bare_name.
(self, nodes)
| 875 | results = new_results |
| 876 | |
| 877 | def _bare_name_matches(self, nodes) -> tuple[int, _Results]: |
| 878 | """Special optimized matcher for bare_name.""" |
| 879 | count = 0 |
| 880 | r = {} # type: _Results |
| 881 | done = False |
| 882 | max = len(nodes) |
| 883 | while not done and count < max: |
| 884 | done = True |
| 885 | for leaf in self.content: |
| 886 | if leaf[0].match(nodes[count], r): |
| 887 | count += 1 |
| 888 | done = False |
| 889 | break |
| 890 | assert self.name is not None |
| 891 | r[self.name] = nodes[:count] |
| 892 | return count, r |
| 893 | |
| 894 | def _recursive_matches(self, nodes, count) -> Iterator[tuple[int, _Results]]: |
| 895 | """Helper to recursively yield the matches.""" |