public class JTBJavaCCMojo extends AbstractJavaCCMojo
*.jtb
) with JTB and passes the output to JavaCC in order to
finally generate a parser with parse tree actions.Modifier and Type | Field and Description |
---|---|
private java.lang.Boolean |
descriptiveFieldNames
Setting this option to
true causes JTB to generate field names that reflect the structure of the
tree instead of generic names like f0 , f1 etc. |
private java.lang.String[] |
excludes
A set of Ant-like exclusion patterns used to prevent certain files from being processing.
|
private java.lang.String[] |
includes
A set of Ant-like inclusion patterns used to select files from the source directory for processing.
|
private java.io.File |
interimDirectory
The directory where the visitor and AST node files generated by JTB will be stored.
|
private java.lang.Boolean |
javadocFriendlyComments
If
true , all generated comments will be wrapped in <pre> tags so that they
are formatted correctly in API docs. |
private java.lang.String |
nodePackageName
This option specifies the package for the generated AST nodes.
|
private java.lang.String |
nodeParentClass
The qualified name of a user-defined class from which all AST nodes will inherit.
|
private java.io.File |
outputDirectory
The directory where the parser files generated by JavaCC will be stored.
|
private java.lang.String |
packageName
This option is short for
nodePackageName = <packageName>.syntaxtree and
visitorPackageName = <packageName>.visitor . |
private java.lang.Boolean |
parentPointers
If
true , all nodes will contain fields for its parent node. |
private java.lang.Boolean |
printer
If
true , JTB will generate a syntax tree dumping visitor. |
private java.lang.Boolean |
scheme
If
true , JTB will generate the following files to support the Schema programming language:
Scheme records representing the grammar.
A Scheme tree building visitor.
Default value is false . |
private java.io.File |
sourceDirectory
The directory where the JavaCC grammar files (
*.jtb ) are located. |
private java.lang.Boolean |
specialTokens
If
true , JTB will include JavaCC "special tokens" in the AST. |
private int |
staleMillis
The granularity in milliseconds of the last modification date for testing whether a grammar file needs
recompilation.
|
private java.lang.Boolean |
supressErrorChecking
If
true , JTB will suppress its semantic error checking. |
private java.lang.String |
visitorPackageName
This option specifies the package for the generated visitors.
|
Constructor and Description |
---|
JTBJavaCCMojo() |
Modifier and Type | Method and Description |
---|---|
protected java.io.File[] |
getCompileSourceRoots()
Gets all the output directories to register with the project for compilation.
|
protected java.lang.String[] |
getExcludes()
Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.
|
protected java.lang.String[] |
getIncludes()
Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.
|
private java.io.File |
getInterimDirectory()
Gets the absolute path to the directory where the interim output from JTB will be stored.
|
private java.lang.String |
getNodePackageName()
Gets the effective package name for the AST node files.
|
protected java.io.File |
getOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.
|
protected java.io.File |
getSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.
|
protected int |
getStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs
recompilation.
|
private java.lang.String |
getVisitorPackageName()
Gets the effective package name for the visitor files.
|
private JTB |
newJTB()
Creates a new facade to invoke JTB.
|
protected void |
processGrammar(GrammarInfo grammarInfo)
Passes the specified grammar file through the tool.
|
copyGrammarOutput, deleteTempDirectory, execute, getGrammarEncoding, getIsStatic, getJdkVersion, getParserPackage, getTempDirectory, isSourceRoot, newJavaCC
private java.lang.String packageName
nodePackageName
= <packageName>.syntaxtree
and
visitorPackageName
= <packageName>.visitor
. Note that this option takes
precedence over nodePackageName
and visitorPackageName
if specified.private java.lang.String nodePackageName
org.apache
and this
parameter is set to *.demo
, the tree node classes will be located in the package
org.apache.demo
. Default value is *.syntaxtree
.private java.lang.String visitorPackageName
org.apache
and this
parameter is set to *.demo
, the visitor classes will be located in the package
org.apache.demo
. Default value is *.visitor
.private java.lang.Boolean supressErrorChecking
true
, JTB will suppress its semantic error checking. Default value is false
.private java.lang.Boolean javadocFriendlyComments
true
, all generated comments will be wrapped in <pre>
tags so that they
are formatted correctly in API docs. Default value is false
.private java.lang.Boolean descriptiveFieldNames
true
causes JTB to generate field names that reflect the structure of the
tree instead of generic names like f0
, f1
etc. Default value is false
.private java.lang.String nodeParentClass
Node
.private java.lang.Boolean parentPointers
true
, all nodes will contain fields for its parent node. Default value is false
.private java.lang.Boolean specialTokens
true
, JTB will include JavaCC "special tokens" in the AST. Default value is false
.private java.lang.Boolean scheme
true
, JTB will generate the following files to support the Schema programming language:
false
.private java.lang.Boolean printer
true
, JTB will generate a syntax tree dumping visitor. Default value is false
.private java.io.File sourceDirectory
*.jtb
) are located. It will be recursively scanned
for input files to pass to JTB. The parameters includes
and excludes
can be used to
select a subset of files.private java.io.File interimDirectory
private java.io.File outputDirectory
private java.lang.String[] includes
**/*.jj
, **/*.JJ
, **/*.jtb
and
**/*.JTB
are used to select grammar files.private java.lang.String[] excludes
private int staleMillis
protected java.io.File getSourceDirectory()
getSourceDirectory
in class AbstractJavaCCMojo
null
.protected java.lang.String[] getIncludes()
getIncludes
in class AbstractJavaCCMojo
null
if all files should be included.protected java.lang.String[] getExcludes()
getExcludes
in class AbstractJavaCCMojo
null
if no files should be excluded.protected java.io.File getOutputDirectory()
getOutputDirectory
in class AbstractJavaCCMojo
null
.protected int getStaleMillis()
getStaleMillis
in class AbstractJavaCCMojo
private java.io.File getInterimDirectory()
protected java.io.File[] getCompileSourceRoots()
getCompileSourceRoots
in class AbstractJavaCCMojo
null
.protected void processGrammar(GrammarInfo grammarInfo) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
processGrammar
in class AbstractJavaCCMojo
grammarInfo
- The grammar info describing the grammar file to process, must not be null
.org.apache.maven.plugin.MojoExecutionException
- If the invocation of the tool failed.org.apache.maven.plugin.MojoFailureException
- If the tool reported a non-zero exit code.private java.lang.String getNodePackageName()
null
.private java.lang.String getVisitorPackageName()
null
.private JTB newJTB()
null
.