pull version from manifest file or use 4.x.

This commit is contained in:
Terence Parr 2012-12-24 13:25:28 -08:00
parent 84189cc81a
commit f43166bb45
2 changed files with 8 additions and 4 deletions

View File

@ -87,7 +87,11 @@ import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
public class Tool {
public static final String getVersion() { return "4.0b4"; }
public static final String VERSION;
static {
String version = Tool.class.getPackage().getImplementationVersion();
VERSION = version != null ? version : "4.x";
}
public static final String GRAMMAR_EXTENSION = ".g4";
public static final String LEGACY_GRAMMAR_EXTENSION = ".g";
@ -774,7 +778,7 @@ public class Tool {
}
public void help() {
info("ANTLR Parser Generator Version " + Tool.getVersion());
info("ANTLR Parser Generator Version " + Tool.VERSION);
for (Option o : optionDefs) {
String name = o.name + (o.argType!=OptionArgType.NONE? " ___" : "");
String s = String.format(" %-19s %s", name, o.description);
@ -822,7 +826,7 @@ public class Tool {
}
public void version() {
info("ANTLR Parser Generator Version " + getVersion());
info("ANTLR Parser Generator Version " + VERSION);
}
public void exit(int e) { System.exit(e); }

View File

@ -62,7 +62,7 @@ public enum ErrorType {
// Code generation errors
MISSING_CODE_GEN_TEMPLATES(30, "can't find code generation templates: <arg>", ErrorSeverity.ERROR),
CANNOT_CREATE_TARGET_GENERATOR(31, "ANTLR cannot generate <arg> code as of version "+ Tool.getVersion(), ErrorSeverity.ERROR),
CANNOT_CREATE_TARGET_GENERATOR(31, "ANTLR cannot generate <arg> code as of version "+ Tool.VERSION, ErrorSeverity.ERROR),
CODE_TEMPLATE_ARG_ISSUE(32, "code generation template <arg> has missing, misnamed, or incomplete arg list; missing <arg2>", ErrorSeverity.ERROR),
CODE_GEN_TEMPLATES_INCOMPLETE(33, "missing code generation template <arg>", ErrorSeverity.ERROR),
NO_MODEL_TO_TEMPLATE_MAPPING(34, "no mapping to template name for output model class <arg>", ErrorSeverity.ERROR),