| Modifier and Type | Field and Description |
|---|---|
| public CompositeGrammarTree | |
| protected Set | lexerRules
If combined or lexer grammar, track the rules. |
| protected int | maxTokenType
Token names and literal tokens like "void" are uniquely indexed. |
| public static final int | |
| protected Vector | numberToStateList
The NFA states in the NFA built from rules across grammars in composite. |
| protected Set | refClosureBusy
Used during getRuleReferenceClosure to detect computation cycles |
| protected int | ruleIndex
Rules are uniquely labeled from 1..n among all grammars |
| protected Vector | ruleIndexToRuleList
Map a rule index to its name; use a Vector on purpose as new collections stuff won't let me setSize and make it grow. |
| public int | stateCounter
Used to assign state numbers; all grammars in composite share common NFA space. |
| public Map | stringLiteralToTypeMap
Map token literals like "while" to its token type. |
| public Map | tokenIDToTypeMap
Map token like ID (but not literals like "while") to its token type |
| public Vector | typeToStringLiteralList
Reverse index for stringLiteralToTypeMap |
| public Vector | typeToTokenList
Map a token type to its token name. |
| public boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public Set | getAllImportedRules(Grammar g)
Get all rule definitions from all direct/indirect delegate grammars of g. |
| public Set | getDelegatedRules(Grammar g)
Get set of rules for grammar g that need to have manual delegation methods. |
| public List | |
| public Grammar | |
| public List | |
| public List | |
| public Grammar | |
| public List | |
| public int | |
| public Object | |
| public Grammar | |
| public Rule | |
| public NFAState | |
| protected void | |
| public void | |
| public void | |
| public void |
| delegateGrammarTreeRoot | back to summary |
|---|---|
| public CompositeGrammarTree delegateGrammarTreeRoot | |
| lexerRules | back to summary |
|---|---|
| protected Set<String> lexerRules If combined or lexer grammar, track the rules. Track lexer rules so we can warn about undefined tokens. This is combined set of lexer rules from all lexer grammars seen in all imports. | |
| maxTokenType | back to summary |
|---|---|
| protected int maxTokenType Token names and literal tokens like "void" are uniquely indexed. with -1 implying EOF. Characters are different; they go from -1 (EOF) to . For example, 0 could be a binary byte you want to lexer. Labels of DFA/NFA transitions can be both tokens and characters. I use negative numbers for bookkeeping labels like EPSILON. Char/String literals and token types overlap in the same space, however. | |
| MIN_RULE_INDEX | back to summary |
|---|---|
| public static final int MIN_RULE_INDEX | |
| numberToStateList | back to summary |
|---|---|
| protected Vector<NFAState> numberToStateList The NFA states in the NFA built from rules across grammars in composite. Maps state number to NFAState object. This is a Vector instead of a List because I need to be able to grow this properly. After talking to Josh Bloch, Collections guy at Sun, I decided this was easiest solution. | |
| refClosureBusy | back to summary |
|---|---|
| protected Set<NFAState> refClosureBusy Used during getRuleReferenceClosure to detect computation cycles | |
| ruleIndex | back to summary |
|---|---|
| protected int ruleIndex Rules are uniquely labeled from 1..n among all grammars | |
| ruleIndexToRuleList | back to summary |
|---|---|
| protected Vector<Rule> ruleIndexToRuleList Map a rule index to its name; use a Vector on purpose as new collections stuff won't let me setSize and make it grow. :( I need a specific guaranteed index, which the Collections stuff won't let me have. | |
| stateCounter | back to summary |
|---|---|
| public int stateCounter Used to assign state numbers; all grammars in composite share common NFA space. This NFA tracks state numbers number to state mapping. | |
| stringLiteralToTypeMap | back to summary |
|---|---|
| public Map<String, Integer> stringLiteralToTypeMap Map token literals like "while" to its token type. It may be that WHILE="while"=35, in which case both tokenIDToTypeMap and this field will have entries both mapped to 35. | |
| tokenIDToTypeMap | back to summary |
|---|---|
| public Map<String, Integer> tokenIDToTypeMap Map token like ID (but not literals like "while") to its token type | |
| typeToStringLiteralList | back to summary |
|---|---|
| public Vector<String> typeToStringLiteralList Reverse index for stringLiteralToTypeMap | |
| typeToTokenList | back to summary |
|---|---|
| public Vector<String> typeToTokenList Map a token type to its token name. Must subtract MIN_TOKEN_TYPE from index. | |
| watchNFAConversion | back to summary |
|---|---|
| public boolean watchNFAConversion | |
| CompositeGrammar | back to summary |
|---|---|
public CompositeGrammar()
| |
| CompositeGrammar | back to summary |
|---|---|
public CompositeGrammar(Grammar g)
| |
| _minimizeRuleSet | back to summary |
|---|---|
| public void _minimizeRuleSet(Set<String> ruleDefs, CompositeGrammarTree p) | |
| addGrammar | back to summary |
|---|---|
| public void addGrammar(Grammar delegator, Grammar delegate) Add delegate grammar as child of delegator | |
| addState | back to summary |
|---|---|
| public void addState(NFAState state) | |
| assignTokenTypes | back to summary |
|---|---|
| public void assignTokenTypes() throws RecognitionException | |
| createNFAs | back to summary |
|---|---|
| public void createNFAs() | |
| defineGrammarSymbols | back to summary |
|---|---|
| public void defineGrammarSymbols() | |
| getAllImportedRules | back to summary |
|---|---|
| public Set Get all rule definitions from all direct/indirect delegate grammars of g. | |
| getDelegatedRules | back to summary |
|---|---|
| public Set Get set of rules for grammar g that need to have manual delegation methods. This is the list of rules collected from all direct/indirect delegates minus rules overridden in grammar g. This returns null except for the delegate root because it is the only one that has to have a complete grammar rule interface. The delegates should not be instantiated directly for use as parsers (you can create them to pass to the root parser's ctor as arguments). | |
| getDelegates | back to summary |
|---|---|
| public List Get list of all delegates from all grammars in the delegate subtree of g. The grammars are in delegation tree preorder. Don't include g itself in list as it is not a delegate of itself. | |
| getDelegator | back to summary |
|---|---|
| public Grammar getDelegator(Grammar g) Get parent of this grammar | |
| getDelegators | back to summary |
|---|---|
| public List Return list of delegate grammars from root down to g. Order is root, ..., g.parent. (g not included). | |
| getDirectDelegates | back to summary |
|---|---|
| public List | |
| getGrammar | back to summary |
|---|---|
| public Grammar getGrammar(String grammarName) | |
| getIndirectDelegates | back to summary |
|---|---|
| public List Get delegates below direct delegates of g | |
| getNewNFAStateNumber | back to summary |
|---|---|
| public int getNewNFAStateNumber() | |
| getOption | back to summary |
|---|---|
| public Object getOption(String key) | |
| getRootGrammar | back to summary |
|---|---|
| public Grammar getRootGrammar() | |
| getRule | back to summary |
|---|---|
| public Rule getRule(String ruleName) | |
| getState | back to summary |
|---|---|
| public NFAState getState(int s) | |
| initTokenSymbolTables | back to summary |
|---|---|
| protected void initTokenSymbolTables() | |
| minimizeRuleSet | back to summary |
|---|---|
| public void minimizeRuleSet() | |
| setDelegationRoot | back to summary |
|---|---|
| public void setDelegationRoot(Grammar root) | |
| translateLeftRecursiveRules | back to summary |
|---|---|
| public void translateLeftRecursiveRules() | |