Package EDU.purdue.jtb.common
Class JTBOptions
java.lang.Object
EDU.purdue.jtb.parser.Options
EDU.purdue.jtb.common.JTBOptions
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.
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 Summary
FieldsModifier and TypeFieldDescriptionboolean
-chm option which generates children handling methods in base and user nodesboolean
-dl option which generates depthLevel field in all visitor classesboolean
-f option which generates descriptive node class child field names such as whileStatement, nodeToken2, ...-eg option which defines an external generator classFile extension-d option which gives the grammar directory-p option which gives the grammar package nameboolean
-hk option which generates enter and exit node scope hook methods in the grammar-hkd invalid input: '&' -d options which defines the node scope hook directory name (default isinvalid reference
#DEF_HOOK_DIR_NAME
-hkp invalid input: '&' -p options which defines the node scope hook package name (default isinvalid reference
#DEF_HOOK_PKG_NAME
boolean
-ia option which "inlines" the visitors accept methods on base classesboolean
Helper flag for C++ output languageboolean
Helper flag for java output languageboolean
The flag to tell if there is at least one prefix or one suffixboolean
static or not static option that comes from JavaCCboolean
-jd option which generates JavaDoc-friendly comments in generated visitors and syntax tree classesThe JavaCC output directory option (OUTPUT_DIRECTORY) name (the directory, forToken
)-o option which defines the output (generated) file name (default is jtb.out.jj)EDU.purdue.jtb.common.JTBOptions.Lang
language option that comes from JavaCC (java by default)final Messages
The messages handler-npfx invalid input: '&' -nsfx options which defines the node' prefix-nd invalid input: '&' -d options which defines the nodes directory name (default isinvalid reference
#DEF_ND_DIR_NAME
-np invalid input: '&' -p options which defines the nodes package name (default isinvalid reference
#DEF_ND_PKG_NAME
-ns option which defines the nodes superclass-npfx invalid input: '&' -nsfx options which defines the node' suffixboolean
-w options which prevents JTB from overwriting existing filesboolean
-noplg option which suppresses parallel generation of user filesboolean
-e option which suppresses JTB semantic error checkingboolean
-nosig option which suppresses generating signature control in visitorsboolean
-novis option which suppresses generating visitorsboolean
-pp option which generates parent pointer and getParent() and setParent() methods in all node classesboolean
-cl option which prints the generated classes list to System.outboolean
-printer option which generates TreeDumper and TreeFormatter visitorsboolean
-tkjj option which prints special tokens in the annotated JJ fileSignature directory name (default isvisitorsDirName
/invalid reference
#DEF_SIG_DIR_NAME
Signature package name (default isvisitorsPackageName
.invalid reference
#DEF_SIG_DIR_NAME
boolean
-tk option which stores special tokens in the tree's NodeTokens-vd invalid input: '&' -d options which defines the visitors directory name (default isinvalid reference
#DEF_VIS_DIR_NAME
The list of the visitors to be generated, deriving from the -vis option-vp invalid input: '&' -p options which defines the visitors package name (default isinvalid reference
#DEF_VIS_PKG_NAME
-vis option which defines the visitors to be generatedFields inherited from class EDU.purdue.jtb.parser.Options
optionValues
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
createVisitorsList
(String aVisitorsStr) Checks -vis / JTB_VIS option string and creates the list ofVisitorInfo
.void
init()
Initialize the JavaCC invalid input: '&' JTB options.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).void
setCmdLineOption
(String aKey, boolean aVal) Stores a boolean option.void
setCmdLineOption
(String aKey, String aVal) Process a single command line option.Methods inherited from class EDU.purdue.jtb.parser.Options
booleanValue, getBuildParser, getBuildTokenManager, getCacheTokens, getChoiceAmbiguityCheck, getCommonTokenAction, getDebugLookahead, getDebugParser, getDebugTokenManager, getErrorReporting, getForceLaCheck, getGenerateAnnotations, getGenerateChainedException, getGenerateGenerics, getGenerateStringBuilder, getIgnoreCase, getJavaUnicodeEscape, getJdkVersion, getKeepLineColumn, getLookahead, getOptions, getOptionsString, getOtherAmbiguityCheck, getOutputDirectory, getSanityCheck, getStatic, getSupportClassVisibilityPublic, getTokenExtends, getTokenFactory, getTokenManagerUsesParser, getUnicodeInput, getUserCharStream, getUserTokenManager, intValue, isOption, jdkVersionAtLeast, normalize, setCmdLineOption, setInputFileOption, stringBufOrBuild, stringValue, upgradeValue
-
Field Details
-
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 isStaticstatic or not static option that comes from JavaCC -
lang
public EDU.purdue.jtb.common.JTBOptions.Lang langlanguage option that comes from JavaCC (java by default) -
grammarDirectoryName
-d option which gives the grammar directory -
externalGeneratorClass
-eg option which defines an external generator class -
hookDirName
-hkd invalid input: '&' -d options which defines the node scope hook directory name (default isinvalid reference
#DEF_HOOK_DIR_NAME
-
hookPackageName
-hkp invalid input: '&' -p options which defines the node scope hook package name (default isinvalid reference
#DEF_HOOK_PKG_NAME
-
nodesDirName
-nd invalid input: '&' -d options which defines the nodes directory name (default isinvalid reference
#DEF_ND_DIR_NAME
-
nodePrefix
-npfx invalid input: '&' -nsfx options which defines the node' prefix -
nodeSuffix
-npfx invalid input: '&' -nsfx options which defines the node' suffix -
isPfxOrSfx
public boolean isPfxOrSfxThe flag to tell if there is at least one prefix or one suffix -
nodesPackageName
-np invalid input: '&' -p options which defines the nodes package name (default isinvalid reference
#DEF_ND_PKG_NAME
-
nodesSuperclass
-ns option which defines the nodes superclass -
grammarPackageName
-p option which gives the grammar package name -
visitorsDirName
-vd invalid input: '&' -d options which defines the visitors directory name (default isinvalid reference
#DEF_VIS_DIR_NAME
-
visitorsStr
-vis option which defines the visitors to be generated -
visitorsList
The list of the visitors to be generated, deriving from the -vis option -
visitorsPackageName
-vp invalid input: '&' -p options which defines the visitors package name (default isinvalid reference
#DEF_VIS_PKG_NAME
-
jtbOutputFileName
-o option which defines the output (generated) file name (default is jtb.out.jj) -
signatureDirName
Signature directory name (default isvisitorsDirName
/invalid reference
#DEF_SIG_DIR_NAME
-
signaturePackageName
Signature package name (default isvisitorsPackageName
.invalid reference
#DEF_SIG_DIR_NAME
-
jjOutDirName
The JavaCC output directory option (OUTPUT_DIRECTORY) name (the directory, forToken
) -
isJava
public boolean isJavaHelper flag for java output language -
isCpp
public boolean isCppHelper flag for C++ output language -
fileExt
File extension
-
-
Constructor Details
-
JTBOptions
Standard constructor.- Parameters:
aMess
- - the messages handler
-
-
Method Details
-
init
public void init()Initialize the JavaCC invalid input: '&' JTB options. -
setCmdLineOption
Stores a boolean option.- Parameters:
aKey
- - the command line option nameaVal
- - the command line option value
-
setCmdLineOption
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 nameaVal
- - the command line option value
-
loadJTBGlobalOptions
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
Checks -vis / JTB_VIS option string and creates the list ofVisitorInfo
.- Parameters:
aVisitorsStr
- - the string specifying the visitors info- Returns:
- true if valid data, false if null or invalid string
-