From 8d48f1a8519998ac0879823712592ae5806446d1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 8 May 2019 14:26:11 +0200 Subject: [PATCH] Fix overlaping condition --- runtime/Python2/src/antlr4/TokenStreamRewriter.py | 2 +- runtime/Python3/src/antlr4/TokenStreamRewriter.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)