public abstract class Grammar
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
analyzerDebug |
protected Tool |
antlrTool |
protected boolean |
buildAST |
protected Token |
classMemberAction |
protected java.lang.String |
className |
protected java.lang.String |
comment |
protected boolean |
debuggingOutput |
protected boolean |
defaultErrorHandler |
protected java.lang.String |
exportVocab
The name of the export vocabulary...used to generate the output
token types interchange file.
|
protected java.lang.String |
fileName |
protected CodeGenerator |
generator |
protected boolean |
hasSyntacticPredicate |
protected boolean |
hasUserErrorHandling |
protected java.lang.String |
importVocab
The name of the import vocabulary.
|
protected boolean |
interactive |
protected int |
maxk |
protected java.util.Hashtable |
options |
protected Token |
preambleAction |
protected Vector |
rules |
protected java.lang.String |
superClass |
protected java.util.Hashtable |
symbols |
protected LLkGrammarAnalyzer |
theLLkAnalyzer |
protected TokenManager |
tokenManager
The token manager associated with the grammar, if any.
|
protected boolean |
traceRules |
Constructor and Description |
---|
Grammar(java.lang.String className_,
Tool tool_,
java.lang.String superClass) |
Modifier and Type | Method and Description |
---|---|
void |
define(RuleSymbol rs)
Define a rule
|
abstract void |
generate()
Top-level call to generate the code for this grammar
|
protected java.lang.String |
getClassName() |
boolean |
getDefaultErrorHandler() |
java.lang.String |
getFilename() |
int |
getIntegerOption(java.lang.String key)
Get an integer option.
|
Token |
getOption(java.lang.String key)
Get an option.
|
protected abstract java.lang.String |
getSuperClass() |
GrammarSymbol |
getSymbol(java.lang.String s) |
java.util.Enumeration |
getSymbols() |
boolean |
hasOption(java.lang.String key)
Check the existence of an option in the table
|
boolean |
isDefined(java.lang.String s)
Is a rule symbol defined? (not used for tokens)
|
abstract void |
processArguments(java.lang.String[] args)
Process command line arguments.
|
void |
setCodeGenerator(CodeGenerator gen) |
void |
setFilename(java.lang.String s) |
void |
setGrammarAnalyzer(LLkGrammarAnalyzer a) |
boolean |
setOption(java.lang.String key,
Token value)
Set a generic option.
|
void |
setTokenManager(TokenManager tokenManager_) |
java.lang.String |
toString()
Print out the grammar without actions
|
protected Tool antlrTool
protected CodeGenerator generator
protected LLkGrammarAnalyzer theLLkAnalyzer
protected java.util.Hashtable symbols
protected boolean buildAST
protected boolean analyzerDebug
protected boolean interactive
protected java.lang.String superClass
protected TokenManager tokenManager
protected java.lang.String exportVocab
protected java.lang.String importVocab
protected java.util.Hashtable options
protected Vector rules
protected Token preambleAction
protected java.lang.String className
protected java.lang.String fileName
protected Token classMemberAction
protected boolean hasSyntacticPredicate
protected boolean hasUserErrorHandling
protected int maxk
protected boolean traceRules
protected boolean debuggingOutput
protected boolean defaultErrorHandler
protected java.lang.String comment
public Grammar(java.lang.String className_, Tool tool_, java.lang.String superClass)
public void define(RuleSymbol rs)
public abstract void generate() throws java.io.IOException
java.io.IOException
protected java.lang.String getClassName()
public boolean getDefaultErrorHandler()
public java.lang.String getFilename()
public int getIntegerOption(java.lang.String key) throws java.lang.NumberFormatException
key
- The name of the optionjava.lang.NumberFormatException
public Token getOption(java.lang.String key)
key
- The name of the optionprotected abstract java.lang.String getSuperClass()
public GrammarSymbol getSymbol(java.lang.String s)
public java.util.Enumeration getSymbols()
public boolean hasOption(java.lang.String key)
key
- The name of the optionpublic boolean isDefined(java.lang.String s)
public abstract void processArguments(java.lang.String[] args)
public void setCodeGenerator(CodeGenerator gen)
public void setFilename(java.lang.String s)
public void setGrammarAnalyzer(LLkGrammarAnalyzer a)
public boolean setOption(java.lang.String key, Token value)
key
- The name of the option.value
- The value to associate with the key.public void setTokenManager(TokenManager tokenManager_)
public java.lang.String toString()
toString
in class java.lang.Object