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: JJTree.java 10603 2009-09-06 15:05:08Z bentmann $
See Also:
  • Field Details

    • inputFile

      private File inputFile
      The input grammar.
    • outputDirectory

      private File outputDirectory
      The option OUTPUT_DIRECTORY.
    • grammarEncoding

      private String grammarEncoding
      The option GRAMMAR_ENCODING.
    • jdkVersion

      private String jdkVersion
      The option JDK_VERSION.
    • isStatic

      private Boolean isStatic
      The option STATIC.
    • buildNodeFiles

      private Boolean buildNodeFiles
      The option BUILD_NODE_FILES.
    • multi

      private Boolean multi
      The option MULTI.
    • nodeDefaultVoid

      private Boolean nodeDefaultVoid
      The option NODE_DEFAULT_VOID.
    • nodeClass

      private String nodeClass
      The option NODE_CLASS.
    • nodeFactory

      private String nodeFactory
      The option NODE_FACTORY.
    • nodePackage

      private String nodePackage
      The option NODE_PACKAGE.
    • nodePrefix

      private String nodePrefix
      The option NODE_PREFIX.
    • nodeScopeHook

      private Boolean nodeScopeHook
      The option NODE_SCOPE_HOOK.
    • nodeUsesParser

      private Boolean nodeUsesParser
      The option NODE_USES_PARSER.
    • trackTokens

      private Boolean trackTokens
      The option TRACK_TOKENS.
    • visitor

      private Boolean visitor
      The option VISITOR.
    • visitorDataType

      private String visitorDataType
      The option VISITOR_DATA_TYPE.
    • visitorReturnType

      private String visitorReturnType
      The option VISITOR_RETURN_TYPE.
    • visitorException

      private String visitorException
      The option VISITOR_EXCEPTION.
  • Constructor Details

    • JJTree

      JJTree()
  • Method Details

    • setInputFile

      public void setInputFile(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(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 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 null if either the input file or the output directory have not been set.
    • setGrammarEncoding

      public void setGrammarEncoding(String value)
      Sets the option GRAMMAR_ENCODING.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setJdkVersion

      public void setJdkVersion(String value)
      Sets the option JDK_VERSION.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setStatic

      public void setStatic(Boolean value)
      Sets the option STATIC.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setBuildNodeFiles

      public void setBuildNodeFiles(Boolean value)
      Sets the option value BUILD_NODE_FILES.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setMulti

      public void setMulti(Boolean value)
      Sets the option value MULTI.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodeDefaultVoid

      public void setNodeDefaultVoid(Boolean value)
      Sets the option value NODE_DEFAULT_VOID.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodeClass

      public void setNodeClass(String value)
      Sets the option value NODE_CLASS.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodeFactory

      public void setNodeFactory(String value)
      Sets the option value NODE_FACTORY.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodePackage

      public void setNodePackage(String value)
      Sets the option value NODE_PACKAGE.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodePrefix

      public void setNodePrefix(String value)
      Sets the option value NODE_PREFIX.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodeScopeHook

      public void setNodeScopeHook(Boolean value)
      Sets the option value NODE_SCOPE_HOOK.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setNodeUsesParser

      public void setNodeUsesParser(Boolean value)
      Sets the option value NODE_USES_PARSER.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setTrackTokens

      public void setTrackTokens(Boolean value)
      Sets the option value TRACK_TOKENS.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setVisitor

      public void setVisitor(Boolean value)
      Sets the option value VISITOR.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setVisitorDataType

      public void setVisitorDataType(String value)
      Sets the option value VISITOR_DATA_TYPE.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setVisitorReturnType

      public void setVisitorReturnType(String value)
      Sets the option value VISITOR_RETURN_TYPE.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • setVisitorException

      public void setVisitorException(String value)
      Sets the option value VISITOR_EXCEPTION.
      Parameters:
      value - The option value, may be null to use the value provided in the grammar or the default.
    • execute

      protected int execute() throws Exception
      Runs the tool using the previously set parameters.
      Specified by:
      execute in class ToolFacade
      Returns:
      The exit code of the tool, non-zero means failure.
      Throws:
      Exception - If the tool could not be invoked.
    • generateArguments

      private 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 String toString()
      Gets a string representation of the command line arguments.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the command line arguments.