Proxy a compiled pattern while recording the search offsets.
| 766 | |
| 767 | |
| 768 | class _RecordingPattern: |
| 769 | """Proxy a compiled pattern while recording the search offsets.""" |
| 770 | |
| 771 | def __init__(self, pattern, start_indices): |
| 772 | self.pattern = pattern |
| 773 | self.start_indices = start_indices |
| 774 | |
| 775 | def finditer(self, data, start_index=0): |
| 776 | self.start_indices.append(start_index) |
| 777 | return self.pattern.finditer(data, start_index) |
| 778 | |
| 779 | |
| 780 | class _InlineProcessorThatRecordsSearchIndex(inlinepatterns.InlineProcessor): |
no outgoing calls