fr.umlv.tatoo.runtime.tools
Class LookaheadMapFactory
java.lang.Object
fr.umlv.tatoo.runtime.tools.LookaheadMapFactory
public class LookaheadMapFactory
- extends Object
Helper methods to create a LookaheadMap
.
This class provide two implementations :
- a generic one
hashLookaheadMap(ParserTable)
that use a classical hash table.
- a enum specific one
enumLookaheadMap(ParserTable)
that only works if terminals are specified using an enum.
By default, the Tatoo java backend generates terminals as an enum.
- Author:
- Remi Forax
Method Summary |
static
|
enumLookaheadMap(ParserTable<T,?,?,V> table)
Returns a map that contains, for a specific version, the mapping
between a terminal and its lookahead set. |
static
|
hashLookaheadMap(ParserTable<T,?,?,V> table)
Returns a map that contains, for a specific version, the mapping
between a terminal and its lookahead set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LookaheadMapFactory
public LookaheadMapFactory()
enumLookaheadMap
public static <V extends Enum<V>,T extends Enum<T>> LookaheadMap<T,V> enumLookaheadMap(ParserTable<T,?,?,V> table)
- Returns a map that contains, for a specific version, the mapping
between a terminal and its lookahead set.
The terminal must be represented by an enum values.
- Type Parameters:
T
- type of terminal enumeration.V
- type of version.- Parameters:
table
- the table produced by Tatoo.
- Returns:
- a lookahead map
- See Also:
hashLookaheadMap(ParserTable)
hashLookaheadMap
public static <V,T> LookaheadMap<T,V> hashLookaheadMap(ParserTable<T,?,?,V> table)
- Returns a map that contains, for a specific version, the mapping
between a terminal and its lookahead set.
- Type Parameters:
T
- type of terminal enumeration.V
- type of version.- Parameters:
table
- the table produced by Tatoo.
.
- Returns:
- a lookahead map