程序包 org.antlr.tool
类 BuildDependencyGenerator
- java.lang.Object
-
- org.antlr.tool.BuildDependencyGenerator
-
public class BuildDependencyGenerator extends java.lang.Object
Given a grammar file, show the dependencies on .tokens etc... Using ST, emit a simple "make compatible" list of dependencies. For example, combined grammar T.g (no token import) generates: TParser.java : T.g T.tokens : T.g T__g : T.g For tree grammar TP with import of T.tokens: TP.g : T.tokens TP.java : TP.g If "-lib libdir" is used on command-line with -depend, then include the path like TP.g : libdir/T.tokens Pay attention to -o as well: outputdir/TParser.java : T.g So this output shows what the grammar depends on *and* what it generates. Operate on one grammar file at a time. If given a list of .g on the command-line with -depend, just emit the dependencies. The grammars may depend on each other, but the order doesn't matter. Build tools, reading in this output, will know how to organize it. This is a wee bit slow probably because the code generator has to load all of its template files in order to figure out the file extension for the generated recognizer. This code was obvious until I removed redundant "./" on front of files and had to escape spaces in filenames :(
-
-
字段概要
字段 修饰符和类型 字段 说明 protected CodeGenerator
generator
protected Grammar
grammar
protected java.lang.String
grammarFileName
protected org.stringtemplate.v4.STGroup
templates
protected java.lang.String
tokenVocab
protected Tool
tool
-
构造器概要
构造器 构造器 说明 BuildDependencyGenerator(Tool tool, java.lang.String grammarFileName)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 org.stringtemplate.v4.ST
getDependencies()
java.util.List<java.io.File>
getDependenciesFileList()
Return a list of File objects that name files ANTLR will read to process T.g; This can be .tokens files if the grammar uses the tokenVocab option as well as any imported grammar files.java.util.List<java.io.File>
getGeneratedFileList()
From T.g return a list of File objects that name files ANTLR will emit from T.g.CodeGenerator
getGenerator()
java.util.List<java.io.File>
getNonImportDependenciesFileList()
Return a list of File objects that name files ANTLR will read to process T.g; This can only be .tokens files and only if they use the tokenVocab option.java.lang.String
getTokenVocab()
java.lang.String
groomQualifiedFileName(java.lang.String outputDir, java.lang.String fileName)
void
loadDependencyTemplates()
-
-
-
字段详细资料
-
grammarFileName
protected java.lang.String grammarFileName
-
tokenVocab
protected java.lang.String tokenVocab
-
tool
protected Tool tool
-
grammar
protected Grammar grammar
-
generator
protected CodeGenerator generator
-
templates
protected org.stringtemplate.v4.STGroup templates
-
-
构造器详细资料
-
BuildDependencyGenerator
public BuildDependencyGenerator(Tool tool, java.lang.String grammarFileName) throws java.io.IOException
- 抛出:
java.io.IOException
-
-
方法详细资料
-
getGeneratedFileList
public java.util.List<java.io.File> getGeneratedFileList()
From T.g return a list of File objects that name files ANTLR will emit from T.g.
-
getDependenciesFileList
public java.util.List<java.io.File> getDependenciesFileList()
Return a list of File objects that name files ANTLR will read to process T.g; This can be .tokens files if the grammar uses the tokenVocab option as well as any imported grammar files.
-
getNonImportDependenciesFileList
public java.util.List<java.io.File> getNonImportDependenciesFileList()
Return a list of File objects that name files ANTLR will read to process T.g; This can only be .tokens files and only if they use the tokenVocab option.- 返回:
- List of dependencies other than imported grammars
-
getDependencies
public org.stringtemplate.v4.ST getDependencies()
-
loadDependencyTemplates
public void loadDependencyTemplates()
-
getTokenVocab
public java.lang.String getTokenVocab()
-
getGenerator
public CodeGenerator getGenerator()
-
groomQualifiedFileName
public java.lang.String groomQualifiedFileName(java.lang.String outputDir, java.lang.String fileName)
-
-