java.lang.Objectantlr.Grammar
A Grammar holds a set of rules (which are stored in a symbol table). Most of the time a grammar needs a code generator and an LLkAnalyzer too.
Constructor Summary | |
Grammar(java.lang.String className_,
Tool tool_,
java.lang.String superClass)
|
Method Summary | |
void |
define(antlr.RuleSymbol rs)
Define a rule |
abstract void |
generate()
Top-level call to generate the code for this grammar |
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. |
antlr.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(antlr.TokenManager tokenManager_)
|
java.lang.String |
toString()
Print out the grammar without actions |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Grammar(java.lang.String className_, Tool tool_, java.lang.String superClass)
Method Detail |
public void define(antlr.RuleSymbol rs)
public abstract void generate() throws java.io.IOException
java.io.IOException
public boolean getDefaultErrorHandler()
public java.lang.String getFilename()
public int getIntegerOption(java.lang.String key) throws java.lang.NumberFormatException
key
- The name of the option
java.lang.NumberFormatException
public Token getOption(java.lang.String key)
key
- The name of the option
public antlr.GrammarSymbol getSymbol(java.lang.String s)
public java.util.Enumeration getSymbols()
public boolean hasOption(java.lang.String key)
key
- The name of the option
public 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(antlr.TokenManager tokenManager_)
public java.lang.String toString()