Package org.codehaus.mojo.javacc
Class JJTree
- java.lang.Object
-
- org.codehaus.mojo.javacc.ToolFacade
-
- org.codehaus.mojo.javacc.JJTree
-
class JJTree extends ToolFacade
Provides a facade for the mojos to invoke JJTree.- Version:
- $Id$
- See Also:
- JJTree Reference
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.BooleanbuildNodeFilesThe option BUILD_NODE_FILES.private java.lang.StringgrammarEncodingThe option GRAMMAR_ENCODING.private java.io.FileinputFileThe input grammar.private java.lang.BooleanisStaticThe option STATIC.private java.lang.StringjdkVersionThe option JDK_VERSION.private java.lang.BooleanmultiThe option MULTI.private java.lang.StringnodeClassThe option NODE_CLASS.private java.lang.BooleannodeDefaultVoidThe option NODE_DEFAULT_VOID.private java.lang.StringnodeFactoryThe option NODE_FACTORY.private java.lang.StringnodePackageThe option NODE_PACKAGE.private java.lang.StringnodePrefixThe option NODE_PREFIX.private java.lang.BooleannodeScopeHookThe option NODE_SCOPE_HOOK.private java.lang.BooleannodeUsesParserThe option NODE_USES_PARSER.private java.io.FileoutputDirectoryThe option OUTPUT_DIRECTORY.private java.lang.BooleantrackTokensThe option TRACK_TOKENS.private java.lang.BooleanvisitorThe option VISITOR.private java.lang.StringvisitorDataTypeThe option VISITOR_DATA_TYPE.private java.lang.StringvisitorExceptionThe option VISITOR_EXCEPTION.private java.lang.StringvisitorReturnTypeThe option VISITOR_RETURN_TYPE.
-
Constructor Summary
Constructors Constructor Description JJTree()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intexecute()Runs the tool using the previously set parameters.private java.lang.String[]generateArguments()Assembles the command line arguments for the invocation of JJTree according to the configuration.java.io.FilegetOutputFile()Gets the absolute path to the enhanced grammar file generated by JJTree.voidsetBuildNodeFiles(java.lang.Boolean value)Sets the option value BUILD_NODE_FILES.voidsetGrammarEncoding(java.lang.String value)Sets the option GRAMMAR_ENCODING.voidsetInputFile(java.io.File value)Sets the absolute path to the grammar file to pass into JJTree for preprocessing.voidsetJdkVersion(java.lang.String value)Sets the option JDK_VERSION.voidsetMulti(java.lang.Boolean value)Sets the option value MULTI.voidsetNodeClass(java.lang.String value)Sets the option value NODE_CLASS.voidsetNodeDefaultVoid(java.lang.Boolean value)Sets the option value NODE_DEFAULT_VOID.voidsetNodeFactory(java.lang.String value)Sets the option value NODE_FACTORY.voidsetNodePackage(java.lang.String value)Sets the option value NODE_PACKAGE.voidsetNodePrefix(java.lang.String value)Sets the option value NODE_PREFIX.voidsetNodeScopeHook(java.lang.Boolean value)Sets the option value NODE_SCOPE_HOOK.voidsetNodeUsesParser(java.lang.Boolean value)Sets the option value NODE_USES_PARSER.voidsetOutputDirectory(java.io.File value)Sets the absolute path to the output directory.voidsetStatic(java.lang.Boolean value)Sets the option STATIC.voidsetTrackTokens(java.lang.Boolean value)Sets the option value TRACK_TOKENS.voidsetVisitor(java.lang.Boolean value)Sets the option value VISITOR.voidsetVisitorDataType(java.lang.String value)Sets the option value VISITOR_DATA_TYPE.voidsetVisitorException(java.lang.String value)Sets the option value VISITOR_EXCEPTION.voidsetVisitorReturnType(java.lang.String value)Sets the option value VISITOR_RETURN_TYPE.java.lang.StringtoString()Gets a string representation of the command line arguments.-
Methods inherited from class org.codehaus.mojo.javacc.ToolFacade
getLog, getToolName, run, setLog
-
-
-
-
Field Detail
-
inputFile
private java.io.File inputFile
The input grammar.
-
outputDirectory
private java.io.File outputDirectory
The option OUTPUT_DIRECTORY.
-
grammarEncoding
private java.lang.String grammarEncoding
The option GRAMMAR_ENCODING.
-
jdkVersion
private java.lang.String jdkVersion
The option JDK_VERSION.
-
isStatic
private java.lang.Boolean isStatic
The option STATIC.
-
buildNodeFiles
private java.lang.Boolean buildNodeFiles
The option BUILD_NODE_FILES.
-
multi
private java.lang.Boolean multi
The option MULTI.
-
nodeDefaultVoid
private java.lang.Boolean nodeDefaultVoid
The option NODE_DEFAULT_VOID.
-
nodeClass
private java.lang.String nodeClass
The option NODE_CLASS.
-
nodeFactory
private java.lang.String nodeFactory
The option NODE_FACTORY.
-
nodePackage
private java.lang.String nodePackage
The option NODE_PACKAGE.
-
nodePrefix
private java.lang.String nodePrefix
The option NODE_PREFIX.
-
nodeScopeHook
private java.lang.Boolean nodeScopeHook
The option NODE_SCOPE_HOOK.
-
nodeUsesParser
private java.lang.Boolean nodeUsesParser
The option NODE_USES_PARSER.
-
trackTokens
private java.lang.Boolean trackTokens
The option TRACK_TOKENS.
-
visitor
private java.lang.Boolean visitor
The option VISITOR.
-
visitorDataType
private java.lang.String visitorDataType
The option VISITOR_DATA_TYPE.
-
visitorReturnType
private java.lang.String visitorReturnType
The option VISITOR_RETURN_TYPE.
-
visitorException
private java.lang.String visitorException
The option VISITOR_EXCEPTION.
-
-
Method Detail
-
setInputFile
public void setInputFile(java.io.File value)
Sets the absolute path to the grammar file to pass into JJTree for preprocessing.- Parameters:
value- The absolute path to the grammar file to pass into JJTree for preprocessing.
-
setOutputDirectory
public void setOutputDirectory(java.io.File value)
Sets the absolute path to the output directory.- Parameters:
value- The absolute path to the output directory for the generated grammar file. If this directory does not exist yet, it is created. Note that this path should already include the desired package hierarchy because JJTree will not append the required sub directories automatically.
-
getOutputFile
public java.io.File getOutputFile()
Gets the absolute path to the enhanced grammar file generated by JJTree.- Returns:
- The absolute path to the enhanced grammar file generated by JJTree or
nullif either the input file or the output directory have not been set.
-
setGrammarEncoding
public void setGrammarEncoding(java.lang.String value)
Sets the option GRAMMAR_ENCODING.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setJdkVersion
public void setJdkVersion(java.lang.String value)
Sets the option JDK_VERSION.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setStatic
public void setStatic(java.lang.Boolean value)
Sets the option STATIC.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setBuildNodeFiles
public void setBuildNodeFiles(java.lang.Boolean value)
Sets the option value BUILD_NODE_FILES.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setMulti
public void setMulti(java.lang.Boolean value)
Sets the option value MULTI.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeDefaultVoid
public void setNodeDefaultVoid(java.lang.Boolean value)
Sets the option value NODE_DEFAULT_VOID.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeClass
public void setNodeClass(java.lang.String value)
Sets the option value NODE_CLASS.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeFactory
public void setNodeFactory(java.lang.String value)
Sets the option value NODE_FACTORY.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodePackage
public void setNodePackage(java.lang.String value)
Sets the option value NODE_PACKAGE.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodePrefix
public void setNodePrefix(java.lang.String value)
Sets the option value NODE_PREFIX.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeScopeHook
public void setNodeScopeHook(java.lang.Boolean value)
Sets the option value NODE_SCOPE_HOOK.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeUsesParser
public void setNodeUsesParser(java.lang.Boolean value)
Sets the option value NODE_USES_PARSER.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setTrackTokens
public void setTrackTokens(java.lang.Boolean value)
Sets the option value TRACK_TOKENS.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitor
public void setVisitor(java.lang.Boolean value)
Sets the option value VISITOR.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitorDataType
public void setVisitorDataType(java.lang.String value)
Sets the option value VISITOR_DATA_TYPE.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitorReturnType
public void setVisitorReturnType(java.lang.String value)
Sets the option value VISITOR_RETURN_TYPE.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitorException
public void setVisitorException(java.lang.String value)
Sets the option value VISITOR_EXCEPTION.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
execute
protected int execute() throws java.lang.ExceptionRuns the tool using the previously set parameters.- Specified by:
executein classToolFacade- Returns:
- The exit code of the tool, non-zero means failure.
- Throws:
java.lang.Exception- If the tool could not be invoked.
-
generateArguments
private java.lang.String[] generateArguments()
Assembles the command line arguments for the invocation of JJTree according to the configuration.
Note: To prevent conflicts with JavaCC options that might be set directly in the grammar file, only those parameters that have been explicitly set are passed on the command line.- Returns:
- A string array that represents the arguments to use for JJTree.
-
toString
public java.lang.String toString()
Gets a string representation of the command line arguments.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the command line arguments.
-
-