Class JTBOptions

java.lang.Object
EDU.purdue.jtb.parser.Options
EDU.purdue.jtb.common.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 Details

    • 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 String grammarDirectoryName
      -d option which gives the grammar directory
    • externalGeneratorClass

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

      public String hookDirName
      -hkd invalid input: '&' -d options which defines the node scope hook directory name (default is
      invalid reference
      #DEF_HOOK_DIR_NAME
      )
    • hookPackageName

      public String hookPackageName
      -hkp invalid input: '&' -p options which defines the node scope hook package name (default is
      invalid reference
      #DEF_HOOK_PKG_NAME
      )
    • nodesDirName

      public String nodesDirName
      -nd invalid input: '&' -d options which defines the nodes directory name (default is
      invalid reference
      #DEF_ND_DIR_NAME
      )
    • nodePrefix

      public String nodePrefix
      -npfx invalid input: '&' -nsfx options which defines the node' prefix
    • nodeSuffix

      public String nodeSuffix
      -npfx invalid input: '&' -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 String nodesPackageName
      -np invalid input: '&' -p options which defines the nodes package name (default is
      invalid reference
      #DEF_ND_PKG_NAME
      )
    • nodesSuperclass

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

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

      public String visitorsDirName
      -vd invalid input: '&' -d options which defines the visitors directory name (default is
      invalid reference
      #DEF_VIS_DIR_NAME
      )
    • visitorsStr

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

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

      public String visitorsPackageName
      -vp invalid input: '&' -p options which defines the visitors package name (default is
      invalid reference
      #DEF_VIS_PKG_NAME
      )
    • jtbOutputFileName

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

      public String signatureDirName
      Signature directory name (default is visitorsDirName/
      invalid reference
      #DEF_SIG_DIR_NAME
      )
    • signaturePackageName

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

      public 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 String fileExt
      File extension
  • Constructor Details

    • JTBOptions

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

    • init

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

      public void setCmdLineOption(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(String aKey, 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(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(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