| java.lang.Object persistence.antlr.Tool
Constructor Summary | |
public | Tool() Construct a new Tool. |
Method Summary | |
protected void | checkForInvalidArguments(String[] args, BitSet cmdLineArgValid) | public void | copyFile(String source_name, String dest_name) This example is from the book _Java in a Nutshell_ by David
Flanagan. | public int | doEverything(String[] args) Process args and have ANTLR do it's stuff without calling System.exit.
Just return the result code. | public void | doEverythingWrapper(String[] args) Perform processing on the grammar file. | public void | error(String s) | public void | error(String s, String file, int line, int column) | public Object | factory(String p) When we are 1.1 compatible... | public void | fatalError(String message) An error occured that should stop the Tool from doing any work.
The default implementation currently exits (via
java.lang.System.exit(int) after printing an error message to
stderr. | public String | fileMinusPath(String f) | public boolean | getGenHashLines() | public String | getGrammarFile() | public Reader | getGrammarReader() | public String | getLanguage(MakeGrammar behavior) | public String | getLiteralsPrefix() | public NameSpace | getNameSpace() | public String | getNamespaceAntlr() | public String | getNamespaceStd() | public String | getOutputDirectory() | public boolean | getUpperCaseMangledLiterals() | public boolean | hasError() | public static void | main(String[] args) | public PrintWriter | openOutputFile(String f) This method is used by all code generators to create new output
files. | public void | panic() Issue an unknown fatal error. | public void | panic(String s) Issue a fatal error message. | public File | parent(File f) | public static Vector | parseSeparatedList(String list, char separator) Parse a list such as "f1.g;f2.g;..." and return a Vector
of the elements. | public String | pathToFile(String f) given a filename, strip off the directory prefix (if any)
and return it. | protected void | processArguments(String[] args) Process the command-line arguments. | public void | reportException(Exception e, String message) | public void | reportProgress(String message) | public void | setArgOK(int i) | public void | setFileLineFormatter(FileLineFormatter formatter) | public void | setNameSpace(String name) Support C++ & C# namespaces (for now). | public void | setOutputDirectory(String o) | public void | toolError(String s) | public void | warning(String s) | public void | warning(String s, String file, int line, int column) | public void | warning(String[] s, String file, int line, int column) |
genDiagnostics | boolean genDiagnostics(Code) | | Generate diagnostics? (vs code)
|
genDocBook | boolean genDocBook(Code) | | Generate DocBook vs code?
|
genHTML | boolean genHTML(Code) | | Generate HTML vs code?
|
genHashLines | protected boolean genHashLines(Code) | | |
hasError | protected boolean hasError(Code) | | Was there an error during parsing or analysis?
|
noConstructors | protected boolean noConstructors(Code) | | |
outputDir | protected static String outputDir(Code) | | Current output directory for generated files
|
upperCaseMangledLiterals | protected static boolean upperCaseMangledLiterals(Code) | | |
Tool | public Tool()(Code) | | Construct a new Tool.
|
checkForInvalidArguments | protected void checkForInvalidArguments(String[] args, BitSet cmdLineArgValid)(Code) | | |
copyFile | public void copyFile(String source_name, String dest_name) throws IOException(Code) | | This example is from the book _Java in a Nutshell_ by David
Flanagan. Written by David Flanagan. Copyright (c) 1996
O'Reilly & Associates. You may study, use, modify, and
distribute this example for any purpose. This example is
provided WITHOUT WARRANTY either expressed or implied.
|
doEverything | public int doEverything(String[] args)(Code) | | Process args and have ANTLR do it's stuff without calling System.exit.
Just return the result code. Makes it easy for ANT build tool.
|
doEverythingWrapper | public void doEverythingWrapper(String[] args)(Code) | | Perform processing on the grammar file. Can only be called
from main() @param args The command-line arguments passed to
main(). This wrapper does the System.exit for use with command-line.
|
error | public void error(String s)(Code) | | Issue an error
Parameters: s - The message |
error | public void error(String s, String file, int line, int column)(Code) | | Issue an error with line number information
Parameters: s - The message Parameters: file - The file that has the error (or null) Parameters: line - The grammar file line number on which the error occured (or -1) Parameters: column - The grammar file column number on which the error occured (or -1) |
factory | public Object factory(String p)(Code) | | When we are 1.1 compatible...
public static Object factory2 (String p, Object[] initargs) {
Class c;
Object o = null;
try {
int argslen = initargs.length;
Class cl[] = new Class[argslen];
for (int i=0;i<argslen;i++) {
cl[i] = Class.forName(initargs[i].getClass().getName());
}
c = Class.forName (p);
Constructor con = c.getConstructor (cl);
o = con.newInstance (initargs);
} catch (Exception e) {
System.err.println ("Can't make a " + p);
}
return o;
}
|
fatalError | public void fatalError(String message)(Code) | | An error occured that should stop the Tool from doing any work.
The default implementation currently exits (via
java.lang.System.exit(int) after printing an error message to
stderr. However, the tools should expect that a subclass
will override this to throw an unchecked exception such as
java.lang.IllegalStateException or another subclass of
java.lang.RuntimeException . If this method is overriden,
it must never return normally; i.e. it must always
throw an exception or call System.exit.
since: 2.7.2 Parameters: s - The message |
getGenHashLines | public boolean getGenHashLines()(Code) | | |
getLanguage | public String getLanguage(MakeGrammar behavior)(Code) | | Determine the language used for this run of ANTLR
This was made a method so the subclass can override it
|
getUpperCaseMangledLiterals | public boolean getUpperCaseMangledLiterals()(Code) | | |
hasError | public boolean hasError()(Code) | | |
openOutputFile | public PrintWriter openOutputFile(String f) throws IOException(Code) | | This method is used by all code generators to create new output
files. If the outputDir set by -o is not present it will be created here.
|
panic | public void panic()(Code) | | Issue an unknown fatal error. If this method is overriden,
it must never return normally; i.e. it must always
throw an exception or call System.exit.
Tool.fatalError(String) |
panic | public void panic(String s)(Code) | | Issue a fatal error message. If this method is overriden,
it must never return normally; i.e. it must always
throw an exception or call System.exit.
Tool.fatalError(String) Parameters: s - The message |
parseSeparatedList | public static Vector parseSeparatedList(String list, char separator)(Code) | | Parse a list such as "f1.g;f2.g;..." and return a Vector
of the elements.
|
pathToFile | public String pathToFile(String f)(Code) | | given a filename, strip off the directory prefix (if any)
and return it. Return "./" if f has no dir prefix.
|
processArguments | protected void processArguments(String[] args)(Code) | | Process the command-line arguments. Can only be called by Tool.
A bitset is collected of all correct arguments via setArgOk.
Parameters: args - The command-line arguments passed to main() |
reportProgress | public void reportProgress(String message)(Code) | | since: 2.7.2 |
setArgOK | public void setArgOK(int i)(Code) | | |
setNameSpace | public void setNameSpace(String name)(Code) | | Support C++ & C# namespaces (for now).
C++: Add a nested namespace name to the current namespace.
C# : Specify an enclosing namespace for the generated code.
DAW: David Wagner -- C# support by kunle odutola
|
setOutputDirectory | public void setOutputDirectory(String o)(Code) | | |
toolError | public void toolError(String s)(Code) | | Issue an error; used for general tool errors not for grammar stuff
Parameters: s - The message |
warning | public void warning(String s)(Code) | | Issue a warning
Parameters: s - the message |
warning | public void warning(String s, String file, int line, int column)(Code) | | Issue a warning with line number information
Parameters: s - The message Parameters: file - The file that has the warning (or null) Parameters: line - The grammar file line number on which the warning occured (or -1) Parameters: column - The grammar file line number on which the warning occured (or -1) |
warning | public void warning(String[] s, String file, int line, int column)(Code) | | Issue a warning with line number information
Parameters: s - The lines of the message Parameters: file - The file that has the warning Parameters: line - The grammar file line number on which the warning occured |
|
|