in src/main/software/amazon/event/ruler/ByteMachine.java [836:862]
private boolean doMultipleTransitionsConvergeForInputByte(ByteState byteState, InputCharacter[] characters, int i) {
if (!isByte(characters[i])) {
return false;
}
boolean isNextCharacterForSuffixMatch = isNextCharacterFirstContinuationByteForSuffixMatch(characters, i);
if (!isNextCharacterFirstByteOfMultiByte(characters, i) && !isNextCharacterForSuffixMatch) {
// If we are in the midst of a multi-byte sequence, we know that we are dealing with single transitions.
return false;
}
// Scenario 1 where multiple transitions will later converge: wildcard leads to wildcard state and following
// character can be used to skip wildcard state. Check for a non-self-referencing wildcard transition.
ByteTransition byteStateTransitionForAllBytes = byteState.getTransitionForAllBytes();
if (!byteStateTransitionForAllBytes.isEmpty() && byteStateTransitionForAllBytes != byteState) {
return true;
}
// Scenario 2 where multiple transitions will later converge: equals_ignore_case lower and upper case paths.
// Parse the next Java character into lower and upper case representations. Check if there are multiple
// multibytes (paths) and that there exists a transition that both lead to.
String value = extractNextJavaCharacterFromInputCharacters(characters, i);
MatchType matchType = isNextCharacterForSuffixMatch ? SUFFIX_EQUALS_IGNORE_CASE : EQUALS_IGNORE_CASE;
InputCharacter[] inputCharacters = getParser().parse(matchType, value);
ByteTransition transition = getTransition(byteState, inputCharacters[0]);
return inputCharacters[0] instanceof InputMultiByteSet && transition != null;
}