Fix overlaping condition

This commit is contained in:
Thomas 2019-05-08 14:26:11 +02:00
parent 7c334b114c
commit 8d48f1a851
2 changed files with 3 additions and 3 deletions

View File

@ -163,7 +163,7 @@ class TokenStreamRewriter(object):
rop.index = min(prevRop.index, rop.index) rop.index = min(prevRop.index, rop.index)
rop.last_index = min(prevRop.last_index, rop.last_index) rop.last_index = min(prevRop.last_index, rop.last_index)
print('New rop {}'.format(rop)) print('New rop {}'.format(rop))
elif not all((isDisjoint, isSame)): elif (not(isDisjoint) and not(isSame)):
raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop)) raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop))
# Walk inserts before # Walk inserts before

View File

@ -162,7 +162,7 @@ class TokenStreamRewriter(object):
rop.index = min(prevRop.index, rop.index) rop.index = min(prevRop.index, rop.index)
rop.last_index = min(prevRop.last_index, rop.last_index) rop.last_index = min(prevRop.last_index, rop.last_index)
print('New rop {}'.format(rop)) print('New rop {}'.format(rop))
elif not all((isDisjoint, isSame)): elif (not(isDisjoint) and not(isSame)):
raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop)) raise ValueError("replace op boundaries of {} overlap with previous {}".format(rop, prevRop))
# Walk inserts # Walk inserts
@ -249,4 +249,4 @@ class TokenStreamRewriter(object):
def __str__(self): def __str__(self):
if self.text: if self.text:
return '<ReplaceOp@{}..{}:"{}">'.format(self.tokens.get(self.index), self.tokens.get(self.last_index), return '<ReplaceOp@{}..{}:"{}">'.format(self.tokens.get(self.index), self.tokens.get(self.last_index),
self.text) self.text)