Get the next element from the cache.
(self, pos: int | None = None)
| 835 | self.cache_index = 0 |
| 836 | |
| 837 | def get_cached_result(self, pos: int | None = None) -> tuple[etree.Element, int, int]: |
| 838 | """Get the next element from the cache.""" |
| 839 | |
| 840 | el, start, end, anchor = self.cache[self.cache_index] |
| 841 | offset = 0 if pos is None else pos - self.cache_pos |
| 842 | self.cache_index += 1 |
| 843 | |
| 844 | if self.cache_index < len(self.cache): |
| 845 | self.cache_pos = anchor |
| 846 | # Nothing left to process |
| 847 | else: |
| 848 | self.reset() |
| 849 | |
| 850 | return el, start + offset, end + offset |
| 851 | |
| 852 | @staticmethod |
| 853 | def rule_of_3(opener: int, closer: int) -> bool: |