Class GroupBoundaries
java.lang.Object
com.oracle.truffle.regex.tregex.parser.ast.GroupBoundaries
- All Implemented Interfaces:
JsonConvertible
Objects of this class represent the capture group boundaries traversed in a single
To save space, instances of this class are deduplicated in
NFAStateTransition or ASTTransition. The boundaries of one capture group
correspond to its opening and closing brackets. All capture group boundaries are mapped to
indices according to Group.getBoundaryIndexStart() and
Group.getBoundaryIndexEnd(). A transition may update or clear any
boundary when traversed. To save space, instances of this class are deduplicated in
RegexAST. Due to the deduplication, every
instance must be treated as immutable!- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidapply(int[] array, int cgOffset, int lgOffset, int index, boolean trackLastGroup) voidapplyExploded(int[] array, int cgOffset, int lgOffset, int index, boolean trackLastGroup, boolean dontOverwriteLastGroup) voidapplyToResultFactory(PreCalculatedResultFactory resultFactory, int index, boolean trackLastGroup) Updates a resultFactory in respect to a single transition and index.byte[]static GroupBoundaries[]booleanDirectly returns theTBitSetused to store the indices of all capture group boundaries that should be cleared when traversed.static GroupBoundariesgetEmptyInstance(RegexLanguage language) intstatic GroupBoundariesgetStaticInstance(RegexLanguage language, TBitSet updateIndices, TBitSet clearIndices) Used for deduplication of very common instances of this class.Directly returns theTBitSetused to store the indices of all capture group boundaries that should be updated when traversed.inthashCode()booleanbooleanbooleanbooleanisEmpty()voidtoJson()toString()voidupdateBitSets(TBitSet foreignUpdateIndices, TBitSet foreignClearIndices) Updates the givenTBitSets with the values contained in thisGroupBoundariesobject.byte[]
-
Method Details
-
createCachedGroupBoundaries
-
getStaticInstance
public static GroupBoundaries getStaticInstance(RegexLanguage language, TBitSet updateIndices, TBitSet clearIndices) Used for deduplication of very common instances of this class. -
getEmptyInstance
-
isEmpty
public boolean isEmpty() -
updatesToByteArray
public byte[] updatesToByteArray() -
clearsToByteArray
public byte[] clearsToByteArray() -
materializeArrays
public void materializeArrays() -
getUpdateIndices
-
getClearIndices
-
hasIndexUpdates
public boolean hasIndexUpdates() -
hasIndexClears
public boolean hasIndexClears() -
hasLastGroup
public boolean hasLastGroup() -
updateBitSets
Updates the givenTBitSets with the values contained in thisGroupBoundariesobject. -
getLastGroup
public int getLastGroup() -
equals
-
hashCode
-
applyToResultFactory
public void applyToResultFactory(PreCalculatedResultFactory resultFactory, int index, boolean trackLastGroup) Updates a resultFactory in respect to a single transition and index.- Parameters:
resultFactory- the resultFactory to update.index- current index. All group boundaries contained in this object will be set to this value in the resultFactory.
-
applyExploded
public void applyExploded(int[] array, int cgOffset, int lgOffset, int index, boolean trackLastGroup, boolean dontOverwriteLastGroup) -
apply
public void apply(int[] array, int cgOffset, int lgOffset, int index, boolean trackLastGroup) -
toString
-
toJson
- Specified by:
toJsonin interfaceJsonConvertible
-
indexUpdateSourceSectionsToJson
-