public class CompiledDFA
extends java.lang.Object
A compiled DFA can be converted to a compact integer array. This array can then be hardcoded in an application.
| Modifier and Type | Field and Description |
|---|---|
int[] |
finals |
static int |
NOFINAL |
HashMapII[] |
transitions |
| Constructor and Description |
|---|
CompiledDFA(HashMapII[] transitions,
int[] finals)
Constructs a compiled DFA from the specified transition graph and finals
arrays.
|
CompiledDFA(int[] definition)
Converts an integer array with a DFA definition (generated by toArray())
to a CompiledDFA.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
toArray()
Converts the DFA to an integer array.
|
java.lang.String |
toString() |
public static final int NOFINAL
public HashMapII[] transitions
public int[] finals
public CompiledDFA(HashMapII[] transitions, int[] finals)
The transition array specifies all transitions for each state. The finals array specifies the final class index of each state, or NOFINAL if the state is not a final. There can multiple final classes, which can, for example, be used to distinguish token types.
transitions - transitions graphfinals - finalspublic CompiledDFA(int[] definition)
definition - definition array