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