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 Boolean
The option BUILD_NODE_FILES.private String
The option GRAMMAR_ENCODING.private File
The input grammar.private Boolean
The option STATIC.private String
The option JDK_VERSION.private Boolean
The option MULTI.private String
The option NODE_CLASS.private Boolean
The option NODE_DEFAULT_VOID.private String
The option NODE_FACTORY.private String
The option NODE_PACKAGE.private String
The option NODE_PREFIX.private Boolean
The option NODE_SCOPE_HOOK.private Boolean
The option NODE_USES_PARSER.private File
The option OUTPUT_DIRECTORY.private Boolean
The option TRACK_TOKENS.private Boolean
The option VISITOR.private String
The option VISITOR_DATA_TYPE.private String
The option VISITOR_EXCEPTION.private String
The option VISITOR_RETURN_TYPE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
execute()
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.void
setBuildNodeFiles
(Boolean value) Sets the option value BUILD_NODE_FILES.void
setGrammarEncoding
(String value) Sets the option GRAMMAR_ENCODING.void
setInputFile
(File value) Sets the absolute path to the grammar file to pass into JJTree for preprocessing.void
setJdkVersion
(String value) Sets the option JDK_VERSION.void
Sets the option value MULTI.void
setNodeClass
(String value) Sets the option value NODE_CLASS.void
setNodeDefaultVoid
(Boolean value) Sets the option value NODE_DEFAULT_VOID.void
setNodeFactory
(String value) Sets the option value NODE_FACTORY.void
setNodePackage
(String value) Sets the option value NODE_PACKAGE.void
setNodePrefix
(String value) Sets the option value NODE_PREFIX.void
setNodeScopeHook
(Boolean value) Sets the option value NODE_SCOPE_HOOK.void
setNodeUsesParser
(Boolean value) Sets the option value NODE_USES_PARSER.void
setOutputDirectory
(File value) Sets the absolute path to the output directory.void
Sets the option STATIC.void
setTrackTokens
(Boolean value) Sets the option value TRACK_TOKENS.void
setVisitor
(Boolean value) Sets the option value VISITOR.void
setVisitorDataType
(String value) Sets the option value VISITOR_DATA_TYPE.void
setVisitorException
(String value) Sets the option value VISITOR_EXCEPTION.void
setVisitorReturnType
(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
null
if either the input file or the output directory have not been set.
-
setGrammarEncoding
Sets the option GRAMMAR_ENCODING.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setJdkVersion
Sets the option JDK_VERSION.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setStatic
Sets the option STATIC.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setBuildNodeFiles
Sets the option value BUILD_NODE_FILES.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setMulti
Sets the option value MULTI.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodeDefaultVoid
Sets the option value NODE_DEFAULT_VOID.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodeClass
Sets the option value NODE_CLASS.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodeFactory
Sets the option value NODE_FACTORY.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodePackage
Sets the option value NODE_PACKAGE.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodePrefix
Sets the option value NODE_PREFIX.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodeScopeHook
Sets the option value NODE_SCOPE_HOOK.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setNodeUsesParser
Sets the option value NODE_USES_PARSER.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setTrackTokens
Sets the option value TRACK_TOKENS.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setVisitor
Sets the option value VISITOR.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setVisitorDataType
Sets the option value VISITOR_DATA_TYPE.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setVisitorReturnType
Sets the option value VISITOR_RETURN_TYPE.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
setVisitorException
Sets the option value VISITOR_EXCEPTION.- Parameters:
value
- The option value, may benull
to use the value provided in the grammar or the default.
-
execute
Runs the tool using the previously set parameters.- Specified by:
execute
in 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
-