| Modifier and Type | Field and Description |
|---|---|
| public final Properties | |
| private boolean | |
| protected boolean | |
| private boolean | |
| private static boolean | |
| private boolean | |
| public String | |
| private boolean | |
| private boolean | |
| private boolean | |
| private List | |
| private String | |
| private boolean | |
| private boolean | |
| private String | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| private String | |
| private boolean | make
Don't process grammar file if generated files are newer than grammar |
| private String | |
| private String | |
| private boolean | |
| private boolean | |
| private boolean | |
| private static boolean | |
| private boolean | |
| private boolean | |
| public static final String | |
| private boolean | |
| public final String |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public boolean | buildRequired(String
The grammar file we are checking grammarFileName)Checks to see if the list of outputFiles all exist, and have last-modified timestamps which are later than the last-modified timestamp of all the grammar files involved in build the output (imports must be checked). |
| public void | |
| protected void | |
| protected void | |
| public int | Returns: DFA creation timeout value in millisecondsProvide the current setting of the conversion timeout on DFA creation. |
| public static String | |
| public String | |
| public List | Returns: the grammarFileNamesProvide the List of all grammar file names that the ANTLR tool will process or has processed. |
| public File | |
| public String | Returns: the lib DirectoryReturn the Path to the directory in which ANTLR will search for ancillary files such as .tokens vocab files and imported grammar files. |
| public String | Returns: Path to file that we think shuold be the import fileinput name we are looking for fileName)Name a file from the -lib dir. |
| public boolean | Returns: true if the tool is currently configured to analyze and sort grammar files.Indicate whether the tool will analyze the dependencies of the provided grammar file list and ensure that grammars with dependencies are built after any of the other gramamrs in the list that they are dependent on. |
| public String | Returns: Current message formatReturns the current setting of the message format descriptor |
| public int | Returns: Error countReturns the number of errors that the analysis/processing threw up. |
| public File | getOutputDirectory(String
path to input source fileNameWithPath)Return the location where ANTLR will generate output files for a given file. |
| public String | Returns: the output DirectoryReturn the Path to the base output directory, where ANTLR will generate all the output files for the current language target as well as any ancillary files such as .tokens vocab files. |
| public Writer | getOutputFile(Grammar g, String fileName)
This method is used by all code generators to create new output files. |
| public Grammar | |
| private static void | |
| public boolean | Returns: the debug flagIndicate if ANTLR has generated, or will generate a debug version of the recognizer. |
| public boolean | Returns: the depend flagIndicates whether ANTLR has supplied, or will supply, a list of all the things that the input grammar depends upon and all the things that will be generated when that grammar is successfully analyzed. |
| public boolean | Returns: the forceAllFilesToOutputDir flagIndicates whether ANTLR will force all files to the output directory, even if the input files have relative paths from the input directory. |
| public boolean | Returns: the generate_DFA_dotIndicates whether ANTLR has generated or will generate a description of all the NFAs in Dot format |
| public boolean | Returns: the generate_NFA_dotIndicates whether ANTLR has gnerated or will generate a description of all the NFAs in Dot format |
| public boolean | Returns: the printGrammar flagIndicates whether ANTLR has printed, or will print, a version of the input grammar file(s) that is stripped of any action code embedded within. |
| public boolean | Returns: the profileIndicates whether ANTLR has generated or will generate a version of the recognizer that gathers statistics about its execution, which it prints when it terminates. |
| public boolean | Returns: the report flagIndicates whether ANTLR has generated or will generate a report of various elements of the grammar analysis, once it it has finished analyzing a grammar file. |
| public boolean | Returns: the trace flagIndicate whether ANTLR has generated, or will generate a version of the recognizer that prints trace messages on entry and exit of each rule. |
| public boolean | Returns: the verbose flagIndicates whether ANTLR will be verbose when analyzing grammar files, such as displaying the names of the files it is generating and similar information. |
| private void | loadResources()
Load the properties file org/antlr/antlr.properties and populate any variables that must be initialized from it, such as the version of ANTLR. |
| public static void | |
| public void | |
| public void | |
| public void | |
| public void | setDebug(boolean
true to generate a debug mode parser debug)Indicate whether ANTLR should generate a debug version of the recognizer. |
| public void | setDepend(boolean
true to get depends set rather than process the grammar depend)Indicate whether ANTLR should supply a list of all the things that the input grammar depends upon and all the things that will be generated when that gramamr is successfully analyzed. |
| public void | setForceAllFilesToOutputDir(boolean
true to force files to output directory forceAllFilesToOutputDir)Indicates whether ANTLR will force all files to the output directory, even if the input files have relative paths from the input directory. |
| public void | setForceRelativeOutput(boolean
true if output files hould always be relative to base output directory forceRelativeOutput)Used by build tools to force the output files to always be relative to the base output directory, even though the tool had to set the output directory to an absolute path as it cannot rely on the workign directory like command line invocation can. |
| public void | setGenerate_DFA_dot(boolean
True to generate dot descriptions generate_DFA_dot)Indicates whether ANTLR should generate a description of all the NFAs in Dot format |
| public void | setGenerate_NFA_dot(boolean
True to generate dot descriptions generate_NFA_dot)Indicate whether ANTLR should generate a description of all the NFAs in Dot format |
| public void | setGrammarFileNames(List<String>
The list of grammar files to process grammarFileNames)Provide the List of all grammar file names that the ANTLR tool should process. |
| public void | setInputDirectory(String
Input source base directory inputDirectory)Set the base location of input files. |
| public void | setLibDirectory(String
the libDirectory to set libDirectory)Set the Path to the directory in which ANTLR will search for ancillary files such as .tokens vocab files and imported grammar files. |
| public void | setMake(boolean make)
Indicate whether the tool should analyze the dependencies of the provided grammar file list and ensure that the grammars with dependencies are built after any of the other gramamrs in the list that they are dependent on. |
| public void | setMaxSwitchCaseLabels(int
Maximum number of case lables that ANTLR should allow the target code maxSwitchCaseLabels)Set the threshold of case labels beyond which ANTLR will not instruct the target template to generate switch() { case xxx: ... |
| public void | |
| public void | setMinSwitchAlts(int
the minimum number of alts required to use a switch staement minSwitchAlts)Set the threshold of the number alts, below which ANTLR will not instruct the target template to use a switch statement. |
| public void | setOutputDirectory(String outputDirectory)
Set the location (base directory) where output files should be produced by the ANTLR tool. |
| public void | setPrintGrammar(boolean
true to generate a stripped file printGrammar)Indicate whether ANTLR should print a version of the input grammar file(s) that is stripped of any action code embedded within. |
| public void | setProfile(boolean
true to generate a profiling parser profile)Indicate whether ANTLR should generate a version of the recognizer that gathers statistics about its execution, which it prints when it terminates. |
| public void | setReport(boolean
true to generate the analysis report report)Indicate whether ANTLR should generate a report of various elements of the grammar analysis, once it it has finished analyzing a grammar file. |
| public void | setTrace(boolean
true to generate a tracing parser trace)Indicate whether ANTLR should generate a version of the recognizer that prints trace messages on entry and exit of each rule |
| public void | setVerbose(boolean
true to be verbose verbose)Indicate whether ANTLR should be verbose when analyzing grammar files, such as displaying the names of the files it is generating and similar information. |
| public void | |
| private static void | |
| protected void | |
| protected void | |
| private static void |
| antlrSettings | back to summary |
|---|---|
| public final Properties antlrSettings | |
| debug | back to summary |
|---|---|
| private boolean debug | |
| deleteTempLexer | back to summary |
|---|---|
| protected boolean deleteTempLexer | |
| depend | back to summary |
|---|---|
| private boolean depend | |
| exitNow | back to summary |
|---|---|
| private static boolean exitNow | |
| forceAllFilesToOutputDir | back to summary |
|---|---|
| private boolean forceAllFilesToOutputDir | |
| forcedLanguageOption | back to summary |
|---|---|
| public String forcedLanguageOption | |
| forceRelativeOutput | back to summary |
|---|---|
| private boolean forceRelativeOutput | |
| generate_DFA_dot | back to summary |
|---|---|
| private boolean generate_DFA_dot | |
| generate_NFA_dot | back to summary |
|---|---|
| private boolean generate_NFA_dot | |
| grammarFileNames | back to summary |
|---|---|
| private List<String> grammarFileNames | |
| grammarOutputDirectory | back to summary |
|---|---|
| private String grammarOutputDirectory | |
| haveInputDir | back to summary |
|---|---|
| private boolean haveInputDir | |
| haveOutputDir | back to summary |
|---|---|
| private boolean haveOutputDir | |
| inputDirectory | back to summary |
|---|---|
| private String inputDirectory | |
| internalOption_PrintDFA | back to summary |
|---|---|
| public static boolean internalOption_PrintDFA | |
| internalOption_PrintGrammarTree | back to summary |
|---|---|
| public static boolean internalOption_PrintGrammarTree | |
| internalOption_ShowNFAConfigsInDFA | back to summary |
|---|---|
| public static boolean internalOption_ShowNFAConfigsInDFA | |
| internalOption_watchNFAConversion | back to summary |
|---|---|
| public static boolean internalOption_watchNFAConversion | |
| libDirectory | back to summary |
|---|---|
| private String libDirectory | |
| make | back to summary |
|---|---|
| private boolean make Don't process grammar file if generated files are newer than grammar | |
| outputDirectory | back to summary |
|---|---|
| private String outputDirectory | |
| parentGrammarDirectory | back to summary |
|---|---|
| private String parentGrammarDirectory | |
| printGrammar | back to summary |
|---|---|
| private boolean printGrammar | |
| profile | back to summary |
|---|---|
| private boolean profile | |
| report | back to summary |
|---|---|
| private boolean report | |
| return_dont_exit | back to summary |
|---|---|
| private static boolean return_dont_exit | |
| showBanner | back to summary |
|---|---|
| private boolean showBanner | |
| trace | back to summary |
|---|---|
| private boolean trace | |
| UNINITIALIZED_DIR | back to summary |
|---|---|
| public static final String UNINITIALIZED_DIR | |
| verbose | back to summary |
|---|---|
| private boolean verbose | |
| VERSION | back to summary |
|---|---|
| public final String VERSION | |
| Tool | back to summary |
|---|---|
| public Tool() | |
| Tool | back to summary |
|---|---|
public Tool(String[] args)
| |
| addGrammarFile | back to summary |
|---|---|
| public void addGrammarFile(String grammarFileName) | |
| buildRequired | back to summary |
|---|---|
| public boolean buildRequired(String grammarFileName) throws IOException Checks to see if the list of outputFiles all exist, and have last-modified timestamps which are later than the last-modified timestamp of all the grammar files involved in build the output (imports must be checked). If these conditions hold, the method returns false, otherwise, it returns true.
| |
| generateDFAs | back to summary |
|---|---|
| public void generateDFAs(Grammar g) | |
| generateNFAs | back to summary |
|---|---|
| protected void generateNFAs(Grammar g) | |
| generateRecognizer | back to summary |
|---|---|
| protected void generateRecognizer(Grammar grammar) Create NFA, DFA and generate code for grammar. Create NFA for any delegates first. Once all NFA are created, it's ok to create DFA, which must check for left-recursion. That check is done by walking the full NFA, which therefore must be complete. After all NFA, comes DFA conversion for root grammar then code gen for root grammar. DFA and code gen for delegates comes next. | |
| getConversionTimeout | back to summary |
|---|---|
| public int getConversionTimeout() Provide the current setting of the conversion timeout on DFA creation.
| |
| getCurrentTimeStamp | back to summary |
|---|---|
| public static String getCurrentTimeStamp() Return a time stamp string accurate to sec: yyyy-mm-dd hh:mm:ss | |
| getFileDirectory | back to summary |
|---|---|
| public String getFileDirectory(String fileName) Return the directory containing the grammar file for this grammar. normally this is a relative path from current directory. People will often do "java org.antlr.Tool grammars/*.g3" So the file will be "grammars/foo.g3" etc... This method returns "grammars". If we have been given a specific input directory as a base, then we must find the directory relative to this directory, unless the file name is given to us in absolute terms. | |
| getGrammarFileNames | back to summary |
|---|---|
| public List Provide the List of all grammar file names that the ANTLR tool will process or has processed. | |
| getImportedVocabFile | back to summary |
|---|---|
| public File getImportedVocabFile(String vocabName) Return a File descriptor for vocab file. Look in library or in -o output path. antlr -o foo T.g U.g where U needs T.tokens won't work unless we look in foo too. If we do not find the file in the lib directory then must assume that the .tokens file is going to be generated as part of this build and we have defined .tokens files so that they ALWAYS are generated in the base output directory, which means the current directory for the command line tool if there was no output directory specified. | |
| getLibraryDirectory | back to summary |
|---|---|
| public String getLibraryDirectory() Return the Path to the directory in which ANTLR will search for ancillary files such as .tokens vocab files and imported grammar files.
| |
| getLibraryFile | back to summary |
|---|---|
| public String getLibraryFile(String fileName) throws IOException Name a file from the -lib dir. Imported grammars and .tokens files If we do not locate the file in the library directory, then we try the location of the originating grammar. | |
| getMake | back to summary |
|---|---|
| public boolean getMake() Indicate whether the tool will analyze the dependencies of the provided grammar file list and ensure that grammars with dependencies are built after any of the other gramamrs in the list that they are dependent on. Setting this option also has the side effect that any grammars that are includes for other grammars in the list are excluded from individual analysis, which allows the caller to invoke the tool via org.antlr.tool -make *.g and not worry about the inclusion of grammars that are just includes for other grammars or what order the grammars appear on the command line. This option was coded to make life easier for tool integration (such as Maven) but may also be useful at the command line.
| |
| getMessageFormat | back to summary |
|---|---|
| public String getMessageFormat() Returns the current setting of the message format descriptor
| |
| getNumErrors | back to summary |
|---|---|
| public int getNumErrors() Returns the number of errors that the analysis/processing threw up.
| |
| getOutputDirectory | back to summary |
|---|---|
| public File getOutputDirectory(String fileNameWithPath) Return the location where ANTLR will generate output files for a given file. This is a base directory and output files will be relative to here in some cases such as when -o option is used and input files are given relative to the input directory.
| |
| getOutputDirectory | back to summary |
|---|---|
| public String getOutputDirectory() Return the Path to the base output directory, where ANTLR will generate all the output files for the current language target as well as any ancillary files such as .tokens vocab files.
| |
| getOutputFile | back to summary |
|---|---|
| public Writer getOutputFile(Grammar g, String fileName) throws IOException 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. The final filename is sensitive to the output directory and the directory where the grammar file was found. If -o is /tmp and the original grammar file was foo/t.g then output files go in /tmp/foo. The output dir -o spec takes precedence if it's absolute. E.g., if the grammar file dir is absolute the output dir is given precendence. "-o /tmp /usr/lib/t.g" results in "/tmp/T.java" as output (assuming t.g holds T.java). If no -o is specified, then just write to the directory where the grammar file was found. If outputDirectory==null then write a String. | |
| getRootGrammar | back to summary |
|---|---|
| public Grammar getRootGrammar(String grammarFileName) throws IOException Get a grammar mentioned on the command-line and any delegates | |
| help | back to summary |
|---|---|
| private static void help() | |
| isDebug | back to summary |
|---|---|
| public boolean isDebug() Indicate if ANTLR has generated, or will generate a debug version of the recognizer. Debug versions of a parser communicate with a debugger such as that contained in ANTLRWorks and at start up will 'hang' waiting for a connection on an IP port (49100 by default).
| |
| isDepend | back to summary |
|---|---|
| public boolean isDepend() Indicates whether ANTLR has supplied, or will supply, a list of all the things that the input grammar depends upon and all the things that will be generated when that grammar is successfully analyzed.
| |
| isForceAllFilesToOutputDir | back to summary |
|---|---|
| public boolean isForceAllFilesToOutputDir() Indicates whether ANTLR will force all files to the output directory, even if the input files have relative paths from the input directory.
| |
| isGenerate_DFA_dot | back to summary |
|---|---|
| public boolean isGenerate_DFA_dot() Indicates whether ANTLR has generated or will generate a description of all the NFAs in Dot format
| |
| isGenerate_NFA_dot | back to summary |
|---|---|
| public boolean isGenerate_NFA_dot() Indicates whether ANTLR has gnerated or will generate a description of all the NFAs in Dot format
| |
| isPrintGrammar | back to summary |
|---|---|
| public boolean isPrintGrammar() Indicates whether ANTLR has printed, or will print, a version of the input grammar file(s) that is stripped of any action code embedded within.
| |
| isProfile | back to summary |
|---|---|
| public boolean isProfile() Indicates whether ANTLR has generated or will generate a version of the recognizer that gathers statistics about its execution, which it prints when it terminates.
| |
| isReport | back to summary |
|---|---|
| public boolean isReport() Indicates whether ANTLR has generated or will generate a report of various elements of the grammar analysis, once it it has finished analyzing a grammar file.
| |
| isTrace | back to summary |
|---|---|
| public boolean isTrace() Indicate whether ANTLR has generated, or will generate a version of the recognizer that prints trace messages on entry and exit of each rule.
| |
| isVerbose | back to summary |
|---|---|
| public boolean isVerbose() Indicates whether ANTLR will be verbose when analyzing grammar files, such as displaying the names of the files it is generating and similar information.
| |
| loadResources | back to summary |
|---|---|
| private void loadResources() Load the properties file org/antlr/antlr.properties and populate any variables that must be initialized from it, such as the version of ANTLR. | |
| main | back to summary |
|---|---|
| public static void main(String[] args) A list of dependency generators that are accumulated aaaas (and if) the tool is required to sort the provided grammars into build dependency order. protected Map<String, BuildDependencyGenerator> buildDependencyGenerators; | |
| panic | back to summary |
|---|---|
| public void panic() If the tool needs to panic/exit, how do we do that? | |
| process | back to summary |
|---|---|
| public void process() | |
| processArgs | back to summary |
|---|---|
| public void processArgs(String[] args) | |
| setDebug | back to summary |
|---|---|
| public void setDebug(boolean debug) Indicate whether ANTLR should generate a debug version of the recognizer. Debug versions of a parser communicate with a debugger such as that contained in ANTLRWorks and at start up will 'hang' waiting for a connection on an IP port (49100 by default).
| |
| setDepend | back to summary |
|---|---|
| public void setDepend(boolean depend) Indicate whether ANTLR should supply a list of all the things that the input grammar depends upon and all the things that will be generated when that gramamr is successfully analyzed.
| |
| setForceAllFilesToOutputDir | back to summary |
|---|---|
| public void setForceAllFilesToOutputDir(boolean forceAllFilesToOutputDir) Indicates whether ANTLR will force all files to the output directory, even if the input files have relative paths from the input directory.
| |
| setForceRelativeOutput | back to summary |
|---|---|
| public void setForceRelativeOutput(boolean forceRelativeOutput) Used by build tools to force the output files to always be relative to the base output directory, even though the tool had to set the output directory to an absolute path as it cannot rely on the workign directory like command line invocation can.
| |
| setGenerate_DFA_dot | back to summary |
|---|---|
| public void setGenerate_DFA_dot(boolean generate_DFA_dot) Indicates whether ANTLR should generate a description of all the NFAs in Dot format
| |
| setGenerate_NFA_dot | back to summary |
|---|---|
| public void setGenerate_NFA_dot(boolean generate_NFA_dot) Indicate whether ANTLR should generate a description of all the NFAs in Dot format
| |
| setGrammarFileNames | back to summary |
|---|---|
| public void setGrammarFileNames(List<String> grammarFileNames) Provide the List of all grammar file names that the ANTLR tool should process. | |
| setInputDirectory | back to summary |
|---|---|
| public void setInputDirectory(String inputDirectory) Set the base location of input files. Normally (when the tool is invoked from the command line), the inputDirectory is not set, but for build tools such as Maven, we need to be able to locate the input files relative to the base, as the working directory could be anywhere and changing workig directories is not a valid concept for JVMs because of threading and so on. Setting the directory just means that the getFileDirectory() method will try to open files relative to this input directory.
| |
| setLibDirectory | back to summary |
|---|---|
| public void setLibDirectory(String libDirectory) Set the Path to the directory in which ANTLR will search for ancillary files such as .tokens vocab files and imported grammar files.
| |
| setMake | back to summary |
|---|---|
| public void setMake(boolean make) Indicate whether the tool should analyze the dependencies of the provided grammar file list and ensure that the grammars with dependencies are built after any of the other gramamrs in the list that they are dependent on. Setting this option also has the side effect that any grammars that are includes for other grammars in the list are excluded from individual analysis, which allows the caller to invoke the tool via org.antlr.tool -make *.g and not worry about the inclusion of grammars that are just includes for other grammars or what order the grammars appear on the command line. This option was coded to make life easier for tool integration (such as Maven) but may also be useful at the command line. | |
| setMaxSwitchCaseLabels | back to summary |
|---|---|
| public void setMaxSwitchCaseLabels(int maxSwitchCaseLabels) Set the threshold of case labels beyond which ANTLR will not instruct the target template to generate switch() { case xxx: ...
| |
| setMessageFormat | back to summary |
|---|---|
| public void setMessageFormat(String format) Set the message format to one of ANTLR, gnu, vs2005 | |
| setMinSwitchAlts | back to summary |
|---|---|
| public void setMinSwitchAlts(int minSwitchAlts) Set the threshold of the number alts, below which ANTLR will not instruct the target template to use a switch statement.
| |
| setOutputDirectory | back to summary |
|---|---|
| public void setOutputDirectory(String outputDirectory) Set the location (base directory) where output files should be produced by the ANTLR tool. | |
| setPrintGrammar | back to summary |
|---|---|
| public void setPrintGrammar(boolean printGrammar) Indicate whether ANTLR should print a version of the input grammar file(s) that is stripped of any action code embedded within.
| |
| setProfile | back to summary |
|---|---|
| public void setProfile(boolean profile) Indicate whether ANTLR should generate a version of the recognizer that gathers statistics about its execution, which it prints when it terminates.
| |
| setReport | back to summary |
|---|---|
| public void setReport(boolean report) Indicate whether ANTLR should generate a report of various elements of the grammar analysis, once it it has finished analyzing a grammar file.
| |
| setTrace | back to summary |
|---|---|
| public void setTrace(boolean trace) Indicate whether ANTLR should generate a version of the recognizer that prints trace messages on entry and exit of each rule
| |
| setVerbose | back to summary |
|---|---|
| public void setVerbose(boolean verbose) Indicate whether ANTLR should be verbose when analyzing grammar files, such as displaying the names of the files it is generating and similar information.
| |
| sortGrammarFiles | back to summary |
|---|---|
| public void sortGrammarFiles() throws IOException | |
| version | back to summary |
|---|---|
| private static void version() | |
| writeDOTFile | back to summary |
|---|---|
| protected void writeDOTFile(Grammar g, Rule r, String dot) throws IOException | |
| writeDOTFile | back to summary |
|---|---|
| protected void writeDOTFile(Grammar g, String name, String dot) throws IOException | |
| Xhelp | back to summary |
|---|---|
| private static void Xhelp() | |