Class JJTree
java.lang.Object
org.codehaus.mojo.javacc.ToolFacade
org.codehaus.mojo.javacc.JJTree
Provides a facade for the mojos to invoke JJTree.
- Version:
- $Id$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BooleanThe option BUILD_NODE_FILES.private StringThe option GRAMMAR_ENCODING.private FileThe input grammar.private BooleanThe option STATIC.private StringThe option JDK_VERSION.private BooleanThe option MULTI.private StringThe option NODE_CLASS.private BooleanThe option NODE_DEFAULT_VOID.private StringThe option NODE_FACTORY.private StringThe option NODE_PACKAGE.private StringThe option NODE_PREFIX.private BooleanThe option NODE_SCOPE_HOOK.private BooleanThe option NODE_USES_PARSER.private FileThe option OUTPUT_DIRECTORY.private BooleanThe option TRACK_TOKENS.private BooleanThe option VISITOR.private StringThe option VISITOR_DATA_TYPE.private StringThe option VISITOR_EXCEPTION.private StringThe option VISITOR_RETURN_TYPE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intexecute()Runs the tool using the previously set parameters.private String[]Assembles the command line arguments for the invocation of JJTree according to the configuration.Gets the absolute path to the enhanced grammar file generated by JJTree.voidsetBuildNodeFiles(Boolean value) Sets the option value BUILD_NODE_FILES.voidsetGrammarEncoding(String value) Sets the option GRAMMAR_ENCODING.voidsetInputFile(File value) Sets the absolute path to the grammar file to pass into JJTree for preprocessing.voidsetJdkVersion(String value) Sets the option JDK_VERSION.voidSets the option value MULTI.voidsetNodeClass(String value) Sets the option value NODE_CLASS.voidsetNodeDefaultVoid(Boolean value) Sets the option value NODE_DEFAULT_VOID.voidsetNodeFactory(String value) Sets the option value NODE_FACTORY.voidsetNodePackage(String value) Sets the option value NODE_PACKAGE.voidsetNodePrefix(String value) Sets the option value NODE_PREFIX.voidsetNodeScopeHook(Boolean value) Sets the option value NODE_SCOPE_HOOK.voidsetNodeUsesParser(Boolean value) Sets the option value NODE_USES_PARSER.voidsetOutputDirectory(File value) Sets the absolute path to the output directory.voidSets the option STATIC.voidsetTrackTokens(Boolean value) Sets the option value TRACK_TOKENS.voidsetVisitor(Boolean value) Sets the option value VISITOR.voidsetVisitorDataType(String value) Sets the option value VISITOR_DATA_TYPE.voidsetVisitorException(String value) Sets the option value VISITOR_EXCEPTION.voidsetVisitorReturnType(String value) Sets the option value VISITOR_RETURN_TYPE.toString()Gets a string representation of the command line arguments.Methods inherited from class ToolFacade
getLog, getToolName, run, setLog
-
Field Details
-
inputFile
The input grammar. -
outputDirectory
The option OUTPUT_DIRECTORY. -
grammarEncoding
The option GRAMMAR_ENCODING. -
jdkVersion
The option JDK_VERSION. -
isStatic
The option STATIC. -
buildNodeFiles
The option BUILD_NODE_FILES. -
multi
The option MULTI. -
nodeDefaultVoid
The option NODE_DEFAULT_VOID. -
nodeClass
The option NODE_CLASS. -
nodeFactory
The option NODE_FACTORY. -
nodePackage
The option NODE_PACKAGE. -
nodePrefix
The option NODE_PREFIX. -
nodeScopeHook
The option NODE_SCOPE_HOOK. -
nodeUsesParser
The option NODE_USES_PARSER. -
trackTokens
The option TRACK_TOKENS. -
visitor
The option VISITOR. -
visitorDataType
The option VISITOR_DATA_TYPE. -
visitorReturnType
The option VISITOR_RETURN_TYPE. -
visitorException
The option VISITOR_EXCEPTION.
-
-
Constructor Details
-
JJTree
JJTree()
-
-
Method Details
-
setInputFile
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
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
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
Sets the option GRAMMAR_ENCODING.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setJdkVersion
Sets the option JDK_VERSION.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setStatic
Sets the option STATIC.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setBuildNodeFiles
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
Sets the option value MULTI.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeDefaultVoid
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
Sets the option value NODE_CLASS.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeFactory
Sets the option value NODE_FACTORY.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodePackage
Sets the option value NODE_PACKAGE.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodePrefix
Sets the option value NODE_PREFIX.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setNodeScopeHook
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
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
Sets the option value TRACK_TOKENS.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitor
Sets the option value VISITOR.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
setVisitorDataType
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
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
Sets the option value VISITOR_EXCEPTION.- Parameters:
value- The option value, may benullto use the value provided in the grammar or the default.
-
execute
Runs the tool using the previously set parameters.- Specified by:
executein classToolFacade- Returns:
- The exit code of the tool, non-zero means failure.
- Throws:
Exception- If the tool could not be invoked.
-
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
-