v4: check for null before evaluating sempreds in the lexer (issue a warning if no recognizer is available for evaluation)
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9486]
This commit is contained in:
parent
c25f3ff3d8
commit
a71a9f04ea
|
@ -458,8 +458,12 @@ public class LexerATNSimulator extends ATNSimulator {
|
|||
c = new ATNConfig(config, t.target, newContext);
|
||||
}
|
||||
else if ( t.getClass() == PredicateTransition.class ) {
|
||||
if (recog == null) {
|
||||
System.out.printf("Predicates cannot be evaluated without a recognizer; assuming true.\n");
|
||||
}
|
||||
|
||||
PredicateTransition pt = (PredicateTransition)t;
|
||||
if ( recog.sempred(null, pt.ruleIndex, pt.predIndex) ) {
|
||||
if ( recog == null || recog.sempred(null, pt.ruleIndex, pt.predIndex) ) {
|
||||
c = new ATNConfig(config, t.target);
|
||||
c.traversedPredicate = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue