fr.umlv.tatoo.runtime.tools
Class ParserLookaheadActivator<R,T,V>
java.lang.Object
fr.umlv.tatoo.runtime.tools.ParserLookaheadActivator<R,T,V>
- Type Parameters:
R - type of rule (must be an enum).T - type of terminal (must be an enum).V - type of version (must be an enum).
- All Implemented Interfaces:
- RuleActivator<R>
public class ParserLookaheadActivator<R,T,V>
- extends Object
- implements RuleActivator<R>
A rule activator that use parser lookaheads.
For each parser state, the implementation used the set of possible terminal
given by the parser to find the set corresponding rules to activate.
This implementation supposes that rules and terminals
are specified using enums. In order to improve speed
and memory usage, this activator internally
uses EnumSet and EnumMap.
This implementation pre-calculate all possibles rule set
for all parser state.
- Author:
- Remi Forax
|
Constructor Summary |
ParserLookaheadActivator(Parser<T,?,?,V> parser,
Map<T,? extends Set<? extends R>> terminalMap,
Set<? extends R> unconditionalRuleSet,
Map<V,R[][]> container,
Class<? extends R> ruleClass)
|
ParserLookaheadActivator(Parser<T,?,?,V> parser,
ToolsTable<R,T> toolsTable,
Map<V,R[][]> container)
|
|
Method Summary |
R[] |
activeRules()
Determines the set of active rules. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParserLookaheadActivator
public ParserLookaheadActivator(Parser<T,?,?,V> parser,
ToolsTable<R,T> toolsTable,
Map<V,R[][]> container)
ParserLookaheadActivator
public ParserLookaheadActivator(Parser<T,?,?,V> parser,
Map<T,? extends Set<? extends R>> terminalMap,
Set<? extends R> unconditionalRuleSet,
Map<V,R[][]> container,
Class<? extends R> ruleClass)
- Parameters:
parser - a simple parsercontainer - the container used by this activator to store the map
activeRules
public R[] activeRules()
- Description copied from interface:
RuleActivator
- Determines the set of active rules. The method
activateRules
is called before the beginning of new token recognition. The returned list
must be random access for efficiency
- Specified by:
activeRules in interface RuleActivator<R>
- Returns:
- new set of active rules; must be random access