Class JJTree

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Boolean buildNodeFiles
      The option BUILD_NODE_FILES.
      private java.lang.String grammarEncoding
      The option GRAMMAR_ENCODING.
      private java.io.File inputFile
      The input grammar.
      private java.lang.Boolean isStatic
      The option STATIC.
      private java.lang.String jdkVersion
      The option JDK_VERSION.
      private java.lang.Boolean multi
      The option MULTI.
      private java.lang.String nodeClass
      The option NODE_CLASS.
      private java.lang.Boolean nodeDefaultVoid
      The option NODE_DEFAULT_VOID.
      private java.lang.String nodeFactory
      The option NODE_FACTORY.
      private java.lang.String nodePackage
      The option NODE_PACKAGE.
      private java.lang.String nodePrefix
      The option NODE_PREFIX.
      private java.lang.Boolean nodeScopeHook
      The option NODE_SCOPE_HOOK.
      private java.lang.Boolean nodeUsesParser
      The option NODE_USES_PARSER.
      private java.io.File outputDirectory
      The option OUTPUT_DIRECTORY.
      private java.lang.Boolean trackTokens
      The option TRACK_TOKENS.
      private java.lang.Boolean visitor
      The option VISITOR.
      private java.lang.String visitorDataType
      The option VISITOR_DATA_TYPE.
      private java.lang.String visitorException
      The option VISITOR_EXCEPTION.
      private java.lang.String visitorReturnType
      The option VISITOR_RETURN_TYPE.
    • Constructor Summary

      Constructors 
      Constructor Description
      JJTree()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int execute()
      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.File getOutputFile()
      Gets the absolute path to the enhanced grammar file generated by JJTree.
      void setBuildNodeFiles​(java.lang.Boolean value)
      Sets the option value BUILD_NODE_FILES.
      void setGrammarEncoding​(java.lang.String value)
      Sets the option GRAMMAR_ENCODING.
      void setInputFile​(java.io.File value)
      Sets the absolute path to the grammar file to pass into JJTree for preprocessing.
      void setJdkVersion​(java.lang.String value)
      Sets the option JDK_VERSION.
      void setMulti​(java.lang.Boolean value)
      Sets the option value MULTI.
      void setNodeClass​(java.lang.String value)
      Sets the option value NODE_CLASS.
      void setNodeDefaultVoid​(java.lang.Boolean value)
      Sets the option value NODE_DEFAULT_VOID.
      void setNodeFactory​(java.lang.String value)
      Sets the option value NODE_FACTORY.
      void setNodePackage​(java.lang.String value)
      Sets the option value NODE_PACKAGE.
      void setNodePrefix​(java.lang.String value)
      Sets the option value NODE_PREFIX.
      void setNodeScopeHook​(java.lang.Boolean value)
      Sets the option value NODE_SCOPE_HOOK.
      void setNodeUsesParser​(java.lang.Boolean value)
      Sets the option value NODE_USES_PARSER.
      void setOutputDirectory​(java.io.File value)
      Sets the absolute path to the output directory.
      void setStatic​(java.lang.Boolean value)
      Sets the option STATIC.
      void setTrackTokens​(java.lang.Boolean value)
      Sets the option value TRACK_TOKENS.
      void setVisitor​(java.lang.Boolean value)
      Sets the option value VISITOR.
      void setVisitorDataType​(java.lang.String value)
      Sets the option value VISITOR_DATA_TYPE.
      void setVisitorException​(java.lang.String value)
      Sets the option value VISITOR_EXCEPTION.
      void setVisitorReturnType​(java.lang.String value)
      Sets the option value VISITOR_RETURN_TYPE.
      java.lang.String toString()
      Gets a string representation of the command line arguments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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.
    • Constructor Detail

      • JJTree

        JJTree()
    • 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 null if 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to 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 be null to use the value provided in the grammar or the default.
      • execute

        protected int execute()
                       throws java.lang.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:
        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:
        toString in class java.lang.Object
        Returns:
        A string representation of the command line arguments.