antlr.build.ANTLR Maven / Gradle / Ivy
package antlr.build;
import java.io.*;
/** Simple class that uses build.Tool to compile ANTLR's Java stuff */
public class ANTLR {
public static String compiler = "javac";
public static String jarName = "antlr.jar";
public static String root = ".";
public static String[] srcdir = {
"antlr",
"antlr/actions/cpp",
"antlr/actions/java",
"antlr/actions/csharp",
"antlr/collections",
"antlr/collections/impl",
"antlr/debug",
"antlr/ASdebug",
"antlr/debug/misc",
"antlr/preprocessor"
};
public ANTLR() {
compiler = System.getProperty("antlr.build.compiler", compiler);
root = System.getProperty("antlr.build.root", root);
}
public String getName() { return "ANTLR"; }
/** Build ANTLR. action on cmd-line matches method name */
public void build(Tool tool) {
if ( !rootIsValidANTLRDir(tool) ) {
return;
}
// run ANTLR on its own .g files
tool.antlr(root+"/antlr/antlr.g");
tool.antlr(root+"/antlr/tokdef.g");
tool.antlr(root+"/antlr/preprocessor/preproc.g");
tool.antlr(root+"/antlr/actions/java/action.g");
tool.antlr(root+"/antlr/actions/cpp/action.g");
tool.antlr(root+"/antlr/actions/csharp/action.g");
for (int i=0; i