| 8 | |
| 9 | |
| 10 | class PosReturn: |
| 11 | # this can be used for configurable callbacks |
| 12 | |
| 13 | def __init__(self): |
| 14 | self.pos = 0 |
| 15 | |
| 16 | def handle(self, exc): |
| 17 | oldpos = self.pos |
| 18 | realpos = oldpos |
| 19 | if realpos<0: |
| 20 | realpos = len(exc.object) + realpos |
| 21 | # if we don't advance this time, terminate on the next call |
| 22 | # otherwise we'd get an endless loop |
| 23 | if realpos <= exc.start: |
| 24 | self.pos = len(exc.object) |
| 25 | return ("<?>", oldpos) |
| 26 | |
| 27 | class RepeatedPosReturn: |
| 28 | def __init__(self, repl="<?>"): |
no outgoing calls
searching dependent graphs…