Class PureNFAState

All Implemented Interfaces:
AbstractState<PureNFAState,PureNFATransition>

public final class PureNFAState extends BasicState<PureNFAState,PureNFATransition>
Represents a state of a PureNFA. All PureNFAStates correspond to a single RegexASTNode, referenced by 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.
  • Field Details

  • Constructor Details

    • PureNFAState

      public PureNFAState(int id, Term t)
  • Method Details

    • getAstNode

      public Term getAstNode(RegexAST ast)
    • getKind

      public byte getKind()
    • isCharacterClass

      public boolean isCharacterClass()
      State represents a CharacterClass.
    • isSubMatcher

      public boolean isSubMatcher()
      State represents a LookAroundAssertion or an AtomicGroup.
    • isLookAhead

      public boolean isLookAhead(RegexAST ast)
    • isLookBehind

      public boolean isLookBehind(RegexAST ast)
    • isAtomicGroup

      public boolean isAtomicGroup()
    • isBackReference

      public boolean isBackReference()
      State represents a BackReference.
    • isEmptyMatch

      public boolean isEmptyMatch()
      State represents an empty loop iteration in a quantified expression. This kind of state is needed when a quantified expression where 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.
    • getCharSet

      public CodePointSet getCharSet()
    • getSubtreeId

      public int getSubtreeId()
    • getBackRefNumbers

      public int[] getBackRefNumbers()
    • isLookAround

      public boolean isLookAround()
    • setLookAround

      public void setLookAround(boolean value)
    • isSubMatcherNegated

      public boolean isSubMatcherNegated()
    • setSubMatcherNegated

      public void setSubMatcherNegated(boolean value)
    • isIgnoreCaseReference

      public boolean isIgnoreCaseReference()
    • setIgnoreCaseReference

      public void setIgnoreCaseReference(boolean value)
    • isRecursiveReference

      public boolean isRecursiveReference()
    • setRecursiveReference

      public void setRecursiveReference(boolean value)
    • isIgnoreCaseReferenceAlternativeMode

      public boolean isIgnoreCaseReferenceAlternativeMode()
    • setIgnoreCaseReferenceAlternativeMode

      public void setIgnoreCaseReferenceAlternativeMode(boolean value)
    • isDeterministic

      public boolean isDeterministic()
      A state is considered "deterministic" iff it either has only one successor, or all of its successors represent character classes, and none of those character classes intersect.
      See Also:
    • setDeterministic

      public void setDeterministic(boolean value)
    • initIsDeterministic

      public void initIsDeterministic(CompilationBuffer compilationBuffer)
      Initializes this state's isDeterministic()-property.
    • createTransitionsArray

      protected PureNFATransition[] createTransitionsArray(int length)
      Specified by:
      createTransitionsArray in class BasicState<PureNFAState,PureNFATransition>
    • addLoopBackNext

      public void addLoopBackNext(PureNFATransition transition)
    • removeLoopBackNext

      public void removeLoopBackNext()
    • hasTransitionToUnAnchoredFinalState

      protected boolean hasTransitionToUnAnchoredFinalState(boolean forward)
      Specified by:
      hasTransitionToUnAnchoredFinalState in class BasicState<PureNFAState,PureNFATransition>
    • canMatchZeroWidth

      public boolean canMatchZeroWidth()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJson

      public JsonObject toJson(RegexAST ast)