Fix overlaping condition
This commit is contained in:
parent
7c334b114c
commit
8d48f1a851
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue