Extend a match identifier by (besti, bestj, bestsize) with any matching tokens on each end. Return a new Match.
(besti, bestj, bestsize, a, b, alo, ahi, blo, bhi, matchables)
| 82 | |
| 83 | |
| 84 | def extend_match(besti, bestj, bestsize, a, b, alo, ahi, blo, bhi, matchables): |
| 85 | """ |
| 86 | Extend a match identifier by (besti, bestj, bestsize) with any matching |
| 87 | tokens on each end. Return a new Match. |
| 88 | """ |
| 89 | if bestsize: |
| 90 | while (besti > alo and bestj > blo |
| 91 | and a[besti - 1] == b[bestj - 1] |
| 92 | and (besti - 1) in matchables): |
| 93 | |
| 94 | besti -= 1 |
| 95 | bestj -= 1 |
| 96 | bestsize += 1 |
| 97 | |
| 98 | while (besti + bestsize < ahi and bestj + bestsize < bhi |
| 99 | and a[besti + bestsize] == b[bestj + bestsize] |
| 100 | and (besti + bestsize) in matchables): |
| 101 | |
| 102 | bestsize += 1 |
| 103 | |
| 104 | return Match(besti, bestj, bestsize) |
| 105 | |
| 106 | |
| 107 | def match_blocks(a, b, a_start, a_end, b2j, len_good, matchables=frozenset(), *args, **kwargs): |
no test coverage detected