Proxy a compiled pattern while recording the search offsets.
| 742 | |
| 743 | |
| 744 | class _RecordingPattern: |
| 745 | """Proxy a compiled pattern while recording the search offsets.""" |
| 746 | |
| 747 | def __init__(self, pattern, start_indices): |
| 748 | self.pattern = pattern |
| 749 | self.start_indices = start_indices |
| 750 | |
| 751 | def finditer(self, data, start_index=0): |
| 752 | self.start_indices.append(start_index) |
| 753 | return self.pattern.finditer(data, start_index) |
| 754 | |
| 755 | |
| 756 | class _InlineProcessorThatRecordsSearchIndex(inlinepatterns.InlineProcessor): |
no outgoing calls