Class JTBOptions


  • public class JTBOptions
    extends Options
    A subclass of the JavaCC options class to extend it to the JTB options.
    It also handles the global variables reflecting the JTB options and some derived objects and methods.

    Class is not supposed to be run in parallel threads (on the same grammar).

    TESTCASE some to add
    • Field Detail

      • mess

        public final Messages mess
        The messages handler
      • childrenMethods

        public boolean childrenMethods
        -chm option which generates children handling methods in base and user nodes
      • printClassList

        public boolean printClassList
        -cl option which prints the generated classes list to System.out
      • depthLevel

        public boolean depthLevel
        -dl option which generates depthLevel field in all visitor classes
      • noSemanticCheck

        public boolean noSemanticCheck
        -e option which suppresses JTB semantic error checking
      • descriptiveFieldNames

        public boolean descriptiveFieldNames
        -f option which generates descriptive node class child field names such as whileStatement, nodeToken2, ... rather than f0, f1, ...
      • hook

        public boolean hook
        -hk option which generates enter and exit node scope hook methods in the grammar
      • inlineAcceptMethods

        public boolean inlineAcceptMethods
        -ia option which "inlines" the visitors accept methods on base classes
      • javaDocComments

        public boolean javaDocComments
        -jd option which generates JavaDoc-friendly comments in generated visitors and syntax tree classes
      • noParallel

        public boolean noParallel
        -noplg option which suppresses parallel generation of user files
      • noSignature

        public boolean noSignature
        -nosig option which suppresses generating signature control in visitors
      • noVisitors

        public boolean noVisitors
        -novis option which suppresses generating visitors
      • parentPointer

        public boolean parentPointer
        -pp option which generates parent pointer and getParent() and setParent() methods in all node classes
      • printerToolkit

        public boolean printerToolkit
        -printer option which generates TreeDumper and TreeFormatter visitors
      • storeSpecialTokens

        public boolean storeSpecialTokens
        -tk option which stores special tokens in the tree's NodeTokens
      • printSpecialTokensJJ

        public boolean printSpecialTokensJJ
        -tkjj option which prints special tokens in the annotated JJ file
      • noOverwrite

        public boolean noOverwrite
        -w options which prevents JTB from overwriting existing files
      • isStatic

        public boolean isStatic
        static or not static option that comes from JavaCC
      • lang

        public EDU.purdue.jtb.common.JTBOptions.Lang lang
        language option that comes from JavaCC (java by default)
      • grammarDirectoryName

        public java.lang.String grammarDirectoryName
        -d option which gives the grammar directory
      • externalGeneratorClass

        public java.lang.String externalGeneratorClass
        -eg option which defines an external generator class
      • hookDirName

        public java.lang.String hookDirName
        -hkd & -d options which defines the node scope hook directory name (default is #DEF_HOOK_DIR_NAME)
      • hookPackageName

        public java.lang.String hookPackageName
        -hkp & -p options which defines the node scope hook package name (default is #DEF_HOOK_PKG_NAME)
      • nodesDirName

        public java.lang.String nodesDirName
        -nd & -d options which defines the nodes directory name (default is #DEF_ND_DIR_NAME)
      • nodePrefix

        public java.lang.String nodePrefix
        -npfx & -nsfx options which defines the node' prefix
      • nodeSuffix

        public java.lang.String nodeSuffix
        -npfx & -nsfx options which defines the node' suffix
      • isPfxOrSfx

        public boolean isPfxOrSfx
        The flag to tell if there is at least one prefix or one suffix
      • nodesPackageName

        public java.lang.String nodesPackageName
        -np & -p options which defines the nodes package name (default is #DEF_ND_PKG_NAME)
      • nodesSuperclass

        public java.lang.String nodesSuperclass
        -ns option which defines the nodes superclass
      • grammarPackageName

        public java.lang.String grammarPackageName
        -p option which gives the grammar package name
      • visitorsDirName

        public java.lang.String visitorsDirName
        -vd & -d options which defines the visitors directory name (default is #DEF_VIS_DIR_NAME)
      • visitorsStr

        public java.lang.String visitorsStr
        -vis option which defines the visitors to be generated
      • visitorsList

        public java.util.List<VisitorInfo> visitorsList
        The list of the visitors to be generated, deriving from the -vis option
      • visitorsPackageName

        public java.lang.String visitorsPackageName
        -vp & -p options which defines the visitors package name (default is #DEF_VIS_PKG_NAME)
      • jtbOutputFileName

        public java.lang.String jtbOutputFileName
        -o option which defines the output (generated) file name (default is jtb.out.jj)
      • signatureDirName

        public java.lang.String signatureDirName
        Signature directory name (default is visitorsDirName/#DEF_SIG_DIR_NAME)
      • signaturePackageName

        public java.lang.String signaturePackageName
        Signature package name (default is visitorsPackageName.#DEF_SIG_DIR_NAME)
      • jjOutDirName

        public java.lang.String jjOutDirName
        The JavaCC output directory option (OUTPUT_DIRECTORY) name (the directory, for Token)
      • isJava

        public boolean isJava
        Helper flag for java output language
      • isCpp

        public boolean isCpp
        Helper flag for C++ output language
      • fileExt

        public java.lang.String fileExt
        File extension
    • Constructor Detail

      • JTBOptions

        public JTBOptions​(Messages aMess)
        Standard constructor.
        Parameters:
        aMess - - the messages handler
    • Method Detail

      • init

        public void init()
        Initialize the JavaCC & JTB options.
        Overrides:
        init in class Options
      • setCmdLineOption

        public void setCmdLineOption​(java.lang.String aKey,
                                     boolean aVal)
        Stores a boolean option.
        Parameters:
        aKey - - the command line option name
        aVal - - the command line option value
      • setCmdLineOption

        public void setCmdLineOption​(java.lang.String aKey,
                                     java.lang.String aVal)
        Process a single command line option. The option is parsed and stored in the optionValues map. (overriden by JTB).
        Parameters:
        aKey - - the command line option name
        aVal - - the command line option value
      • loadJTBGlobalOptions

        public void loadJTBGlobalOptions​(java.lang.String aGrammarDeclaredPackage)
        Loads the global variables with the JTB global options from the parsed grammar (which was fed with the command line options and the grammar file options).
        Parameters:
        aGrammarDeclaredPackage - - the grammar package name in the grammar
      • createVisitorsList

        public boolean createVisitorsList​(java.lang.String aVisitorsStr)
        Checks -vis / JTB_VIS option string and creates the list of VisitorInfo.
        Parameters:
        aVisitorsStr - - the string specifying the visitors info
        Returns:
        true if valid data, false if null or invalid string