public final class PureNFAState extends BasicState<PureNFAState,PureNFATransition>
PureNFA. All PureNFAStates correspond to a single
RegexASTNode, referenced by PureNFAState.getAstNodeId(). Initial and final states correspond
to the NFA helper nodes contained in RegexASTSubtreeRootNode. All other states correspond
to either CharacterClasses, BackReferences, LookAroundAssertions or
AtomicGroups.| Modifier and Type | Field and Description |
|---|---|
static byte |
KIND_BACK_REFERENCE |
static byte |
KIND_CHARACTER_CLASS |
static byte |
KIND_EMPTY_MATCH |
static byte |
KIND_INITIAL_OR_FINAL_STATE |
static byte |
KIND_SUB_MATCHER |
FLAG_ANCHORED_FINAL_STATE, FLAG_ANCHORED_INITIAL_STATE, FLAG_ANY_FINAL_STATE, FLAG_ANY_INITIAL_OR_FINAL_STATE, FLAG_ANY_INITIAL_STATE, FLAG_UN_ANCHORED_FINAL_STATE, FLAG_UN_ANCHORED_INITIAL_STATE, N_FLAGS| Constructor and Description |
|---|
PureNFAState(int id,
Term t) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLoopBackNext(PureNFATransition transition) |
boolean |
canMatchZeroWidth() |
protected PureNFATransition[] |
createTransitionsArray(int length) |
Term |
getAstNode(RegexAST ast) |
int |
getBackRefNumber() |
CodePointSet |
getCharSet() |
byte |
getKind() |
int |
getSubtreeId() |
protected boolean |
hasTransitionToUnAnchoredFinalState(boolean forward) |
void |
initIsDeterministic(boolean forward,
CompilationBuffer compilationBuffer)
Initializes this state's
PureNFAState.isDeterministic()-property, depending on forward. |
boolean |
isAtomicGroup() |
boolean |
isBackReference()
State represents a
BackReference. |
boolean |
isCharacterClass()
State represents a
CharacterClass. |
boolean |
isDeterministic()
A state is considered "deterministic" iff it either has only one successor, or all of its
successors/predecessors (depending on
forward) represent character classes, and none of those character classes intersect. |
boolean |
isEmptyMatch()
State represents an empty loop iteration in a quantified expression.
|
boolean |
isLookAhead(RegexAST ast) |
boolean |
isLookAround() |
boolean |
isLookBehind(RegexAST ast) |
boolean |
isSubMatcher()
State represents a
LookAroundAssertion or an AtomicGroup. |
boolean |
isSubMatcherNegated() |
void |
removeLoopBackNext() |
void |
setDeterministic(boolean value) |
void |
setLookAround(boolean value) |
void |
setSubMatcherNegated(boolean value) |
JsonObject |
toJson(RegexAST ast) |
String |
toString() |
addPredecessor, addPredecessorUnchecked, getFlag, getFlags, getId, getNPredecessors, getPredecessors, getPredecessors, getSuccessors, getSuccessors, hasPredecessors, hasSuccessors, incPredecessors, isAnchoredFinalState, isAnchoredFinalState, isAnchoredInitialState, isAnchoredInitialState, isDead, isFinalState, isFinalState, isInitialState, isInitialState, isUnAnchoredFinalState, isUnAnchoredFinalState, isUnAnchoredInitialState, isUnAnchoredInitialState, setAnchoredFinalState, setAnchoredInitialState, setFlag, setFlag, setPredecessors, setSuccessors, setUnAnchoredFinalState, setUnAnchoredInitialState, setUnAnchoredInitialStatepublic static final byte KIND_INITIAL_OR_FINAL_STATE
public static final byte KIND_CHARACTER_CLASS
public static final byte KIND_SUB_MATCHER
public static final byte KIND_BACK_REFERENCE
public static final byte KIND_EMPTY_MATCH
public PureNFAState(int id,
Term t)
public byte getKind()
public boolean isCharacterClass()
CharacterClass.public boolean isSubMatcher()
LookAroundAssertion or an AtomicGroup.public boolean isLookAhead(RegexAST ast)
public boolean isLookBehind(RegexAST ast)
public boolean isAtomicGroup()
public boolean isBackReference()
BackReference.public boolean isEmptyMatch()
Token.Quantifier.getMin() > 0 can match the empty
string - e.g. (a|){10,20}. In such expressions, the quantifier must match the
empty string until the minimum number of iterations is reached, but after that it is no
longer allowed to match the empty string. To model this behavior, we insert an "empty match"
state whenever a quantified expression that can match the empty string is encountered.public CodePointSet getCharSet()
public int getSubtreeId()
public int getBackRefNumber()
public boolean isLookAround()
public void setLookAround(boolean value)
public boolean isSubMatcherNegated()
public void setSubMatcherNegated(boolean value)
public boolean isDeterministic()
forward) represent character classes, and none of those character classes intersect.public void setDeterministic(boolean value)
public void initIsDeterministic(boolean forward,
CompilationBuffer compilationBuffer)
PureNFAState.isDeterministic()-property, depending on forward.protected PureNFATransition[] createTransitionsArray(int length)
createTransitionsArray in class BasicState<PureNFAState,PureNFATransition>public void addLoopBackNext(PureNFATransition transition)
public void removeLoopBackNext()
protected boolean hasTransitionToUnAnchoredFinalState(boolean forward)
hasTransitionToUnAnchoredFinalState in class BasicState<PureNFAState,PureNFATransition>public boolean canMatchZeroWidth()
public JsonObject toJson(RegexAST ast)