diff --git a/runtime/Python3/src/antlr4/PredictionContext.py b/runtime/Python3/src/antlr4/PredictionContext.py index c5413f204..8ecc23401 100644 --- a/runtime/Python3/src/antlr4/PredictionContext.py +++ b/runtime/Python3/src/antlr4/PredictionContext.py @@ -298,9 +298,9 @@ def merge(a:PredictionContext, b:PredictionContext, rootIsWildcard:bool, mergeCa # convert singleton so both are arrays to normalize if isinstance( a, SingletonPredictionContext ): - a = ArrayPredictionContext([a.parent], [a.returnState]) + a = ArrayPredictionContext([a.parentCtx], [a.returnState]) if isinstance( b, SingletonPredictionContext): - b = ArrayPredictionContext([b.parent], [b.returnState]) + b = ArrayPredictionContext([b.parentCtx], [b.returnState]) return mergeArrays(a, b, rootIsWildcard, mergeCache) diff --git a/runtime/Python3/src/antlr4/atn/ATNConfig.py b/runtime/Python3/src/antlr4/atn/ATNConfig.py index 8ea47d97e..19eef663d 100644 --- a/runtime/Python3/src/antlr4/atn/ATNConfig.py +++ b/runtime/Python3/src/antlr4/atn/ATNConfig.py @@ -60,8 +60,6 @@ class ATNConfig(object): if semantic is None: semantic = SemanticContext.NONE - if not isinstance(state, ATNState): - pass # The ATN state associated with this configuration#/ self.state = state # What alt (or lexer rule) is predicted by this configuration#/ @@ -83,7 +81,6 @@ class ATNConfig(object): self.reachesIntoOuterContext = 0 if config is None else config.reachesIntoOuterContext self.precedenceFilterSuppressed = False if config is None else config.precedenceFilterSuppressed - # An ATN configuration is equal to another if both have # the same state, they predict the same alternative, and # syntactic/semantic contexts are the same. diff --git a/runtime/Python3/src/antlr4/atn/SemanticContext.py b/runtime/Python3/src/antlr4/atn/SemanticContext.py index de739343c..c012e35c2 100644 --- a/runtime/Python3/src/antlr4/atn/SemanticContext.py +++ b/runtime/Python3/src/antlr4/atn/SemanticContext.py @@ -327,7 +327,7 @@ class OR (SemanticContext): for context in self.opnds: evaluated = context.evalPrecedence(parser, outerContext) differs |= evaluated is not context - if evaluate is SemanticContext.NONE: + if evaluated is SemanticContext.NONE: # The OR context is true if any element is true return SemanticContext.NONE elif evaluated is not None: