T - final state type (for a TokenStream, a TokenType)public class NFA<T extends java.lang.Comparable<T>>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NFA.NFAState<T>
Represents an NFA state.
|
| Constructor and Description |
|---|
NFA(java.lang.Class<T> tokenClass,
NFA.NFAState<T> initial)
Creates a new NFA with the specified initial state.
|
NFA(java.lang.String[] regexp,
T[] finals)
Converts an array of regular expressions to an NFA.
|
NFA(java.lang.String regexp,
T state)
Creates a new NFA from the specified regular expression.
|
NFA(ZList<java.lang.String> regexp,
ZList<T> finals)
Converts a list of regular expressions to an NFA.
|
| Modifier and Type | Method and Description |
|---|---|
CompiledDFA<T> |
compile()
Converts the NFA to a DFA and optimizes and compiles it into an efficient
format.
|
DFA<T> |
toDFA()
Converts this NFA to a DFA.
|
public static final int NOFINAL
public static final int EPSILON
public NFA(java.lang.Class<T> tokenClass, NFA.NFAState<T> initial)
tokenClass - token classinitial - initial statepublic NFA(java.lang.String regexp,
T state)
regexp - regular expressionstate - resulting statepublic NFA(java.lang.String[] regexp,
T[] finals)
regexp - regular expression arrayfinals - final classespublic DFA<T> toDFA()
public CompiledDFA<T> compile()