|
||||||||||
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 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 antlr.TokenManager |
tokenManager
The token manager associated with the grammar, if any. // The token manager is responsible for maintaining the set of valid tokens, and // is conceptually shared between the lexer and parser. |
protected boolean |
traceRules
|
Constructor Summary | |
Grammar(String className_,
Tool tool_,
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 |
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()
|
antlr.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? |
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(antlr.TokenManager tokenManager_)
|
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 antlrTool
protected CodeGenerator generator
protected LLkGrammarAnalyzer theLLkAnalyzer
protected Hashtable symbols
protected boolean buildAST
protected boolean analyzerDebug
protected boolean interactive
protected String superClass
protected antlr.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
Constructor Detail |
public Grammar(String className_, Tool tool_, String superClass)
Method Detail |
public void define(antlr.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 option
NumberFormatException
public Token getOption(String key)
key
- The name of the option
protected abstract String getSuperClass()
public antlr.GrammarSymbol getSymbol(String s)
public Enumeration getSymbols()
public boolean hasOption(String key)
key
- The name of the option
public 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(antlr.TokenManager tokenManager_)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |