From 4e3325c9da23b11606782bffada6429c71a4fb26 Mon Sep 17 00:00:00 2001 From: Renata Hodovan Date: Fri, 6 May 2016 15:59:55 +0200 Subject: [PATCH] Fix initialization of ATNConfig when computing SLL prediction termination condition. The PredictionMode::hasSLLConflictTerminatingPrediction method aims to create ATNConfig objects from another ATNConfig and SemanticContext objects. In case of the Python targets, the initialization happened without keyword arguments. Since the called __init__ method had default values set for all the parameters, the parameter substitution worked by indices. As a consequence, the first ATNConfig parameter was wrongly interpreted as an ATNState and the SemanticContext as an alternative. The patch fixes this by adding the missing keywords. --- runtime/Python2/src/antlr4/atn/PredictionMode.py | 2 +- runtime/Python3/src/antlr4/atn/PredictionMode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/Python2/src/antlr4/atn/PredictionMode.py b/runtime/Python2/src/antlr4/atn/PredictionMode.py index c01641972..7c8cf2e22 100644 --- a/runtime/Python2/src/antlr4/atn/PredictionMode.py +++ b/runtime/Python2/src/antlr4/atn/PredictionMode.py @@ -213,7 +213,7 @@ class PredictionMode(object): # dup configs, tossing out semantic predicates dup = ATNConfigSet() for c in configs: - c = ATNConfig(c,SemanticContext.NONE) + c = ATNConfig(config=c, semantic=SemanticContext.NONE) dup.add(c) configs = dup # now we have combined contexts for configs with dissimilar preds diff --git a/runtime/Python3/src/antlr4/atn/PredictionMode.py b/runtime/Python3/src/antlr4/atn/PredictionMode.py index 0fba6351f..0906f6a6b 100644 --- a/runtime/Python3/src/antlr4/atn/PredictionMode.py +++ b/runtime/Python3/src/antlr4/atn/PredictionMode.py @@ -216,7 +216,7 @@ class PredictionMode(Enum): # dup configs, tossing out semantic predicates dup = ATNConfigSet() for c in configs: - c = ATNConfig(c,SemanticContext.NONE) + c = ATNConfig(config=c, semantic=SemanticContext.NONE) dup.add(c) configs = dup # now we have combined contexts for configs with dissimilar preds