Package org.openzen.zenscript.lexer
Class NFA<T extends Comparable<T>>
java.lang.Object
org.openzen.zenscript.lexer.NFA<T>
- Type Parameters:
T- final state type (for a TokenStream, a TokenType)
Represents an NFA. NFAs can be compiled from a list of regular expressions.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
EPSILON
public static final int EPSILON- See Also:
-
UNICODE_PLACEHOLDER
public static final int UNICODE_PLACEHOLDER- See Also:
-
-
Constructor Details
-
NFA
Converts a list of regular expressions to an NFA. Each regular expression can have its own final class. The length of both arrays must match.- Parameters:
regexp- regular expression arrayfinals- final classes
-
-
Method Details
-
toDFA
Converts this NFA to a DFA. The resulting DFA is not optimal. If the NFA is ambiguous, the token with lowest value will receive preference.- Returns:
- this NFA as DFA
-
compile
Converts the NFA to a DFA and optimizes and compiles it into an efficient format.- Returns:
- compiled DFA
-