public class NFA
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NFA.NFAState
Represents an NFA state.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
EPSILON |
static int |
NOFINAL |
static int |
UNICODE_ESCAPE |
| Constructor and Description |
|---|
NFA(NFA.NFAState initial)
Creates a new NFA with the specified initial state.
|
NFA(java.lang.String regexp)
Creates a new NFA from the specified regular expression.
|
NFA(java.lang.String[] regexp,
int[] finals)
Converts an array of regular expressions to an NFA.
|
| Modifier and Type | Method and Description |
|---|---|
DFA |
toDFA()
Converts this NFA to a DFA.
|
public static final int NOFINAL
public static final int EPSILON
public static final int UNICODE_ESCAPE
public NFA(NFA.NFAState initial)
initial - initial statepublic NFA(java.lang.String regexp)
Note: the regular expression implementation is not complete. Shorthand character classes (\s, \w, \d), hexadecimal and unicode escape sequences and unicode properties are not implemented.
Anchors, lazy plus operators, lookbehind and lookforward are not implemented since they cannot be implemented in an NFA.
regexp - regular expressionpublic NFA(java.lang.String[] regexp,
int[] finals)
regexp - regular expression arrayfinals - final classespublic DFA toDFA()