|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.Tool
javafe.FrontEndTool
FrontEndTool
is an abstract class for tools that use
our Java front end.
It handles parsing the standard options for setting up the
front end and initializing the front end using those options. At
the end of a run, it prints a count of how many cautions, warnings,
and errors occurred (cf. ErrorSet
). It also handles
catching FatalError
s (see
ErrorSet.fatal
). The remaining processing, if any, is
front-end-tool specific.
Field Summary | |
protected java.lang.String |
compositeClassPath
|
protected java.lang.String |
compositeSourcePath
Setup: initialize the front end using the standard front-end-tool option variables ( Options.userPath ,
Options.sysPath ).
|
Fields inherited from class javafe.Tool |
badUsageExitCode, errorExitCode, okExitCode, options, outOfMemoryExitCode |
Constructor Summary | |
FrontEndTool()
|
Method Summary | |
void |
clear(boolean complete)
Called to clear any static initializations, so that the parser can be called multiple times within one process. |
abstract void |
frontEndToolProcessing(java.util.ArrayList args)
Perform any front-end-tool-specific processing. |
int |
handleOptions(java.lang.String[] args)
Parses the options into a new instance of an Options
subclass. |
static void |
main(java.lang.String[] args)
Start up an instance of this tool using command-line arguments args .
|
Options |
makeOptions()
Called to create a new Options object. |
PragmaParser |
makePragmaParser()
Called to obtain the pragma parser to be used for parsing input files. |
PrettyPrint |
makePrettyPrint()
Called to obtain the pretty printer to set PrettyPrint.inst to. |
StandardTypeReader |
makeStandardTypeReader(java.lang.String path,
java.lang.String sourcePath,
PragmaParser P)
Called to obtain the StandardTypeReader to be used for
locating and reading in types. |
TypeCheck |
makeTypeCheck()
Called to obtain an instance of the TypeCheck
class (or a subclass thereof) to be used for typechecking. |
void |
processOptions(java.lang.String[] args)
Processes the options into the current Options instance as contained in the options field. |
int |
run(java.lang.String[] args)
A tool's main entry point, which should be overridden in derived classes to do the work of the tool. |
void |
setup()
|
void |
setupPaths()
|
Methods inherited from class javafe.Tool |
badOptionUsage, currentTime, name, spaceUsed, timeUsed, usage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String compositeSourcePath
Options.userPath
,
Options.sysPath
).
This can be done only once. The standard front-end-tool
option variables have no effect after this point. May exit
with an error (via ErrorSet.fatal(String)
).
Ensures OutsideEnv
has been properly initialized
(except if an error occurs).
Also initializes PrettyPrint.inst
and TypeCheck.inst
to their default front end values.
protected java.lang.String compositeClassPath
Constructor Detail |
public FrontEndTool()
Method Detail |
public void setupPaths()
public void setup()
public void clear(boolean complete)
public StandardTypeReader makeStandardTypeReader(java.lang.String path, java.lang.String sourcePath, PragmaParser P)
StandardTypeReader
to be used for
locating and reading in types.
public PragmaParser makePragmaParser()
null
is returned, then no pragma
parsing is done. (By default, returns null
).
public Options makeOptions()
Options
object.
public void processOptions(java.lang.String[] args) throws UsageError
args
- The command-line arguments to process
UsageError
- if the sequence of command-line arguments
is invalidpublic PrettyPrint makePrettyPrint()
PrettyPrint.inst
to. May not return null
. By
default, returns StandardPrettyPrint
.
public TypeCheck makeTypeCheck()
TypeCheck
class (or a subclass thereof) to be used for typechecking. May
not return null
. By default, returns TypeCheck
.
public static void main(java.lang.String[] args)
args
.
Note: this code needs to be copied
verbatim to each subclass of Tool
except with the name
of the actual subclass inserted after the new operator and the
comment characters (//) removed.
(This needs to be done because static methods cannot be inherited.)
public int handleOptions(java.lang.String[] args)
Options
subclass. The new instance is assigned to the options field.
If the argument is null, the tool is initialized with the
existing options (the options field is unchanged). The tool
is then initialized (by calling setup) with the designated options.
args
- Either null or an array of arguments used to
initialize the Options structure
public final int run(java.lang.String[] args)
run
in class Tool
args
- The command-line arguments the program was invoked with
Tool.run(java.lang.String[])
public abstract void frontEndToolProcessing(java.util.ArrayList args)
The remaining arguments are args[offset]
,
args[offset+1]
, ...
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |