diff --git a/runtime/Python2/src/antlr4/TokenStreamRewriter.py b/runtime/Python2/src/antlr4/TokenStreamRewriter.py index 23bb0d40a..1adf82ef8 100644 --- a/runtime/Python2/src/antlr4/TokenStreamRewriter.py +++ b/runtime/Python2/src/antlr4/TokenStreamRewriter.py @@ -163,7 +163,7 @@ class TokenStreamRewriter(object): rop.index = min(prevRop.index, rop.index) rop.last_index = min(prevRop.last_index, rop.last_index) 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)) # Walk inserts before diff --git a/runtime/Python3/src/antlr4/TokenStreamRewriter.py b/runtime/Python3/src/antlr4/TokenStreamRewriter.py index d714d9fe6..bed274c65 100644 --- a/runtime/Python3/src/antlr4/TokenStreamRewriter.py +++ b/runtime/Python3/src/antlr4/TokenStreamRewriter.py @@ -162,7 +162,7 @@ class TokenStreamRewriter(object): rop.index = min(prevRop.index, rop.index) rop.last_index = min(prevRop.last_index, rop.last_index) 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)) # Walk inserts @@ -249,4 +249,4 @@ class TokenStreamRewriter(object): def __str__(self): if self.text: return ''.format(self.tokens.get(self.index), self.tokens.get(self.last_index), - self.text) \ No newline at end of file + self.text)