From 4480634f13bb2e404a8b3d8b38ec7c8fa67d016b Mon Sep 17 00:00:00 2001 From: Terence Parr Date: Sat, 3 Nov 2012 17:35:57 -0700 Subject: [PATCH] do exact LL ambigs for -diagnostics --- runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java b/runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java index e8dc5cc9d..682b14659 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java +++ b/runtime/Java/src/org/antlr/v4/runtime/misc/TestRig.java @@ -36,7 +36,6 @@ import org.antlr.v4.runtime.DiagnosticErrorListener; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.atn.PredictionMode; @@ -218,13 +217,16 @@ public class TestRig { if ( startRuleName.equals(LEXER_START_RULE_NAME) ) return; - if ( diagnostics ) parser.addErrorListener(new DiagnosticErrorListener()); + if ( diagnostics ) { + parser.addErrorListener(new DiagnosticErrorListener()); + parser.getInterpreter().setPredictionMode(PredictionMode.LL_EXACT_AMBIG_DETECTION); + } if ( printTree || gui || psFile!=null ) { parser.setBuildParseTree(true); } - if ( SLL ) { + if ( SLL ) { // overrides diagnostics parser.getInterpreter().setPredictionMode(PredictionMode.SLL); }