|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--antlr.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.
Field Summary | |
protected boolean |
analyzerDebug
|
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 Tool |
tool
|
protected boolean |
traceRules
|
Constructor Summary | |
Grammar(java.lang.String className_,
Tool tool_,
java.lang.String superClass)
|
Method Summary | |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Tool tool
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
Constructor Detail |
public Grammar(java.lang.String className_, Tool tool_, java.lang.String superClass)
Method Detail |
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 option
java.lang.NumberFormatException
public Token getOption(java.lang.String key)
key
- The name of the option
protected 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 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(TokenManager tokenManager_)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |