in src/main/software/amazon/event/ruler/ByteMachine.java [199:229]
private void deleteMatchStep(ByteState byteState, int charIndex, Patterns pattern,
final InputCharacter[] characters) {
final InputCharacter currentChar = characters[charIndex];
final ByteTransition trans = getTransition(byteState, currentChar);
for (SingleByteTransition eachTrans : trans.expand()) {
if (charIndex < characters.length - 1) {
// if it is shortcut trans, we delete it directly.
if (eachTrans.isShortcutTrans()) {
deleteMatch(currentChar, byteState, pattern, eachTrans);
} else {
ByteState nextByteState = eachTrans.getNextByteState();
if (nextByteState != null && nextByteState != byteState) {
deleteMatchStep(nextByteState, charIndex + 1, pattern, characters);
}
// Perform handling for certain wildcard cases.
eachTrans = deleteMatchStepForWildcard(byteState, charIndex, pattern, characters, eachTrans,
nextByteState);
if (nextByteState != null &&
(nextByteState.hasNoTransitions() || nextByteState.hasOnlySelfReferentialTransition())) {
// The transition's next state has no meaningful transitions, so compact the transition.
putTransitionNextState(byteState, currentChar, eachTrans, null);
}
}
} else {
deleteMatch(currentChar, byteState, pattern, eachTrans);
}
}
}