add option -exact-ambiguities to TestRig
This commit is contained in:
parent
baa4dcf1b9
commit
400b58d4a0
|
@ -1,5 +1,9 @@
|
|||
ANTLR v4 Honey Badger
|
||||
|
||||
November 3, 2012
|
||||
|
||||
* add option -exact-ambiguities to TestRig
|
||||
|
||||
October 29, 2012
|
||||
|
||||
* Sam fixes nongreedy more.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -75,6 +74,7 @@ public class TestRig {
|
|||
static boolean diagnostics = false;
|
||||
static String encoding = null;
|
||||
static boolean SLL = false;
|
||||
static boolean exactAmbigDetection = false;
|
||||
|
||||
public static final String LEXER_START_RULE_NAME = "tokens";
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class TestRig {
|
|||
if ( args.length < 2 ) {
|
||||
System.err.println("java org.antlr.v4.runtime.misc.TestRig GrammarName startRuleName\n" +
|
||||
" [-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]\n" +
|
||||
" [-trace] [-diagnostics] [-SLL]\n"+
|
||||
" [-trace] [-diagnostics] [-SLL] [-exact-ambiguities]\n"+
|
||||
" [input-filename(s)]");
|
||||
System.err.println("Use startRuleName='tokens' if GrammarName is a lexer grammar.");
|
||||
System.err.println("Omitting input-filename makes rig read from stdin.");
|
||||
|
@ -116,6 +116,9 @@ public class TestRig {
|
|||
else if ( arg.equals("-SLL") ) {
|
||||
SLL = true;
|
||||
}
|
||||
else if ( arg.equals("-exact-ambiguities") ) {
|
||||
exactAmbigDetection = true;
|
||||
}
|
||||
else if ( arg.equals("-diagnostics") ) {
|
||||
diagnostics = true;
|
||||
}
|
||||
|
@ -224,7 +227,10 @@ public class TestRig {
|
|||
parser.setBuildParseTree(true);
|
||||
}
|
||||
|
||||
if ( SLL ) {
|
||||
if ( exactAmbigDetection ) {
|
||||
parser.getInterpreter().setPredictionMode(PredictionMode.LL_EXACT_AMBIG_DETECTION);
|
||||
}
|
||||
if ( SLL ) { // overrides exactAmbigDetection
|
||||
parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue