This commit is contained in:
Eric Vergnaud 2015-08-26 02:14:19 +08:00
parent e6d27c7a7c
commit 2f4f36d60c
3 changed files with 3 additions and 6 deletions

View File

@ -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)

View File

@ -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.

View File

@ -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: