forked from jasder/antlr
Update copyright, remove options which are no longer relevant to the Tool
This commit is contained in:
parent
66bdbb7abd
commit
f91cb106a9
|
@ -1,9 +1,7 @@
|
|||
/**
|
||||
[The "BSD licence"]
|
||||
|
||||
ANTLR - Copyright (c) 2005-2008 Terence Parr
|
||||
Maven Plugin - Copyright (c) 2009 Jim Idle
|
||||
|
||||
/*
|
||||
[The "BSD license"]
|
||||
Copyright (c) 2012 Terence Parr
|
||||
Copyright (c) 2012 Sam Harwell
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -72,7 +70,7 @@ import java.util.Set;
|
|||
* are required for generation of the compilable sources into the location
|
||||
* that we use to compile them, such as target/generated-sources/antlr4 ...
|
||||
*
|
||||
* @author <a href="mailto:jimi@temporal-wave.com">Jim Idle</a>
|
||||
* @author Sam Harwell
|
||||
*/
|
||||
@Mojo(
|
||||
name = "antlr",
|
||||
|
@ -85,44 +83,12 @@ public class Antlr4Mojo
|
|||
// First, let's deal with the options that the ANTLR tool itself
|
||||
// can be configured by.
|
||||
//
|
||||
/**
|
||||
* If set to true, then after the tool has processed an input grammar file
|
||||
* it will report variaous statistics about the parser, such as information
|
||||
* on cyclic DFAs, which rules may use backtracking, and so on.
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean report;
|
||||
/**
|
||||
* If set to true, then the ANTLR tool will print a version of the input
|
||||
* grammar which is devoid of any actions that may be present in the input file.
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean printGrammar;
|
||||
/**
|
||||
* If set to true, then the code generated by the ANTLR code generator will
|
||||
* be set to debug mode. This means that when run, the code will 'hang' and
|
||||
* wait for a debug connection on a TCP port (49100 by default).
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean debug;
|
||||
/**
|
||||
* If set to true, then then the generated parser will compute and report on
|
||||
* profile information at runtime.
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean profile;
|
||||
/**
|
||||
* If set to true then the ANTLR tool will generate a description of the atn
|
||||
* for each rule in <a href="http://www.graphviz.org">Dot format</a>
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean atn;
|
||||
/**
|
||||
* If set to true, the generated parser code will log rule entry and exit points
|
||||
* to stdout as an aid to debugging.
|
||||
*/
|
||||
@Parameter(defaultValue = "false")
|
||||
protected boolean trace;
|
||||
/**
|
||||
* If this parameter is set, it indicates that any warning or error messages returned
|
||||
* by ANLTR, shoould be formatted in the specified way. Currently, ANTLR suports the
|
||||
|
@ -130,32 +96,11 @@ public class Antlr4Mojo
|
|||
*/
|
||||
@Parameter(defaultValue = "antlr")
|
||||
protected String messageFormat;
|
||||
/**
|
||||
* If this parameter is set to true, then ANTLR will report all sorts of things
|
||||
* about what it is doing such as the names of files and the version of ANTLR and so on.
|
||||
*/
|
||||
@Parameter(defaultValue = "true")
|
||||
protected boolean verbose;
|
||||
|
||||
protected boolean verbose_dfa;
|
||||
|
||||
protected boolean force_atn;
|
||||
|
||||
protected boolean abstract_recognizer;
|
||||
|
||||
/**
|
||||
* The number of alts, beyond which ANTLR will not generate a switch statement
|
||||
* for the DFA.
|
||||
*/
|
||||
@Parameter(defaultValue = "300")
|
||||
private int maxSwitchCaseLabels;
|
||||
|
||||
/**
|
||||
* The number of alts, below which ANTLR will not choose to generate a switch
|
||||
* statement over an if statement.
|
||||
*/
|
||||
private int minSwitchAlts;
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* The following are Maven specific parameters, rather than specificlly
|
||||
* options that the ANTLR tool can use.
|
||||
|
@ -268,16 +213,6 @@ public class Antlr4Mojo
|
|||
|
||||
// Flags
|
||||
//
|
||||
log.debug("ANTLR: report : " + report);
|
||||
log.debug("ANTLR: printGrammar : " + printGrammar);
|
||||
log.debug("ANTLR: debug : " + debug);
|
||||
log.debug("ANTLR: profile : " + profile);
|
||||
log.debug("ANTLR: atn : " + atn);
|
||||
log.debug("ANTLR: trace : " + trace);
|
||||
log.debug("ANTLR: messageFormat : " + messageFormat);
|
||||
log.debug("ANTLR: maxSwitchCaseLabels : " + maxSwitchCaseLabels);
|
||||
log.debug("ANTLR: minSwitchAlts : " + minSwitchAlts);
|
||||
log.debug("ANTLR: verbose : " + verbose);
|
||||
}
|
||||
|
||||
// Ensure that the output directory path is all in tact so that
|
||||
|
@ -306,21 +241,9 @@ public class Antlr4Mojo
|
|||
// Next we need to set the options given to us in the pom into the
|
||||
// tool instance we have created.
|
||||
//
|
||||
if (debug) {
|
||||
args.add("-debug");
|
||||
}
|
||||
if (atn) {
|
||||
args.add("-atn");
|
||||
}
|
||||
if (profile) {
|
||||
args.add("-profile");
|
||||
}
|
||||
if (report) {
|
||||
args.add("-report");
|
||||
}
|
||||
if (printGrammar) {
|
||||
args.add("-print");
|
||||
}
|
||||
if (verbose_dfa) {
|
||||
args.add("-Xverbose-dfa");
|
||||
}
|
||||
|
@ -331,9 +254,6 @@ public class Antlr4Mojo
|
|||
if (force_atn) {
|
||||
args.add("-Xforce-atn");
|
||||
}
|
||||
if (abstract_recognizer) {
|
||||
args.add("-abstract");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
|
@ -395,9 +315,6 @@ public class Antlr4Mojo
|
|||
};
|
||||
tool.addListener(new Antlr4ErrorLog(log));
|
||||
|
||||
// we set some options directly
|
||||
tool.trace = trace;
|
||||
|
||||
// Where do we want ANTLR to produce its output? (Base directory)
|
||||
//
|
||||
if (log.isDebugEnabled())
|
||||
|
|
Loading…
Reference in New Issue