java.lang.Objectantlr.Tool
Field Summary | |
static java.lang.String |
version
|
Constructor Summary | |
Tool()
Construct a new Tool. |
Method Summary | |
void |
copyFile(java.lang.String source_name,
java.lang.String dest_name)
This example is from the book _Java in a Nutshell_ by David Flanagan. |
int |
doEverything(java.lang.String[] args)
Process args and have ANTLR do it's stuff without calling System.exit. |
void |
doEverythingWrapper(java.lang.String[] args)
Perform processing on the grammar file. |
void |
error(java.lang.String s)
Issue an error |
void |
error(java.lang.String s,
java.lang.String file,
int line,
int column)
Issue an error with line number information |
java.lang.Object |
factory(java.lang.String p)
When we are 1.1 compatible... |
void |
fatalError(java.lang.String message)
An error occured that should stop the Tool from doing any work. |
java.lang.String |
fileMinusPath(java.lang.String f)
|
boolean |
getGenHashLines()
|
java.lang.String |
getGrammarFile()
|
java.io.Reader |
getGrammarReader()
|
java.lang.String |
getLanguage(MakeGrammar behavior)
Determine the language used for this run of ANTLR This was made a method so the subclass can override it |
java.lang.String |
getLiteralsPrefix()
|
NameSpace |
getNameSpace()
|
java.lang.String |
getNamespaceAntlr()
|
java.lang.String |
getNamespaceStd()
|
java.lang.String |
getOutputDirectory()
|
boolean |
getUpperCaseMangledLiterals()
|
boolean |
hasError()
|
static void |
main(java.lang.String[] args)
|
java.io.PrintWriter |
openOutputFile(java.lang.String f)
This method is used by all code generators to create new output files. |
void |
panic()
Deprecated. as of 2.7.2 use fatalError(String) . By default
this method executes fatalError("panic"); . |
void |
panic(java.lang.String s)
Deprecated. as of 2.7.2 use fatalError(String) . By defaykt
this method executes fatalError("panic: " + s); . |
java.io.File |
parent(java.io.File f)
|
static Vector |
parseSeparatedList(java.lang.String list,
char separator)
Parse a list such as "f1.g;f2.g;..." and return a Vector of the elements. |
java.lang.String |
pathToFile(java.lang.String f)
given a filename, strip off the directory prefix (if any) and return it. |
void |
reportException(java.lang.Exception e,
java.lang.String message)
|
void |
reportProgress(java.lang.String message)
|
void |
setArgOK(int i)
|
void |
setFileLineFormatter(FileLineFormatter formatter)
|
void |
setNameSpace(java.lang.String name)
Support C++ & C# namespaces (for now). |
void |
setOutputDirectory(java.lang.String o)
|
void |
toolError(java.lang.String s)
Issue an error; used for general tool errors not for grammar stuff |
void |
warning(java.lang.String s)
Issue a warning |
void |
warning(java.lang.String[] s,
java.lang.String file,
int line,
int column)
Issue a warning with line number information |
void |
warning(java.lang.String s,
java.lang.String file,
int line,
int column)
Issue a warning with line number information |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String version
Constructor Detail |
public Tool()
Method Detail |
public java.lang.String getGrammarFile()
public boolean hasError()
public NameSpace getNameSpace()
public java.lang.String getNamespaceStd()
public java.lang.String getNamespaceAntlr()
public boolean getGenHashLines()
public java.lang.String getLiteralsPrefix()
public boolean getUpperCaseMangledLiterals()
public void setFileLineFormatter(FileLineFormatter formatter)
public void copyFile(java.lang.String source_name, java.lang.String dest_name) throws java.io.IOException
java.io.IOException
public void doEverythingWrapper(java.lang.String[] args)
public int doEverything(java.lang.String[] args)
public void error(java.lang.String s)
s
- The messagepublic void error(java.lang.String s, java.lang.String file, int line, int column)
s
- The messagefile
- The file that has the error (or null)line
- The grammar file line number on which the error occured (or -1)column
- The grammar file column number on which the error occured (or -1)public java.lang.Object factory(java.lang.String p)
public java.lang.String fileMinusPath(java.lang.String f)
public java.lang.String getLanguage(MakeGrammar behavior)
public java.lang.String getOutputDirectory()
public static void main(java.lang.String[] args)
public java.io.PrintWriter openOutputFile(java.lang.String f) throws java.io.IOException
java.io.IOException
public java.io.Reader getGrammarReader()
public void reportException(java.lang.Exception e, java.lang.String message)
public void reportProgress(java.lang.String message)
public void fatalError(java.lang.String message)
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
IllegalStateException
or another subclass of
RuntimeException
. If this method is overriden,
it must never return normally; i.e. it must always
throw an exception or call System.exit.
public void panic()
fatalError(String)
. By default
this method executes fatalError("panic");
.
public void panic(java.lang.String s)
fatalError(String)
. By defaykt
this method executes fatalError("panic: " + s);
.
s
- The messagepublic java.io.File parent(java.io.File f)
public static Vector parseSeparatedList(java.lang.String list, char separator)
public java.lang.String pathToFile(java.lang.String f)
public void setArgOK(int i)
public void setOutputDirectory(java.lang.String o)
public void toolError(java.lang.String s)
s
- The messagepublic void warning(java.lang.String s)
s
- the messagepublic void warning(java.lang.String s, java.lang.String file, int line, int column)
s
- The messagefile
- The file that has the warning (or null)line
- The grammar file line number on which the warning occured (or -1)column
- The grammar file line number on which the warning occured (or -1)public void warning(java.lang.String[] s, java.lang.String file, int line, int column)
s
- The lines of the messagefile
- The file that has the warningline
- The grammar file line number on which the warning occuredpublic void setNameSpace(java.lang.String name)