do exact LL ambigs for -diagnostics

This commit is contained in:
Terence Parr 2012-11-03 17:35:57 -07:00
parent d1795d205f
commit 4480634f13
1 changed files with 5 additions and 3 deletions

View File

@ -36,7 +36,6 @@ import org.antlr.v4.runtime.DiagnosticErrorListener;
import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.atn.PredictionMode; import org.antlr.v4.runtime.atn.PredictionMode;
@ -218,13 +217,16 @@ public class TestRig {
if ( startRuleName.equals(LEXER_START_RULE_NAME) ) return; 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 ) { if ( printTree || gui || psFile!=null ) {
parser.setBuildParseTree(true); parser.setBuildParseTree(true);
} }
if ( SLL ) { if ( SLL ) { // overrides diagnostics
parser.getInterpreter().setPredictionMode(PredictionMode.SLL); parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
} }