in src/main/software/amazon/event/ruler/ByteMachine.java [1847:1872]
private void addTransitionNextState(ByteState state, InputCharacter character, InputCharacter[] characters,
int currentIndex, ByteState prevState, Patterns pattern,
ByteState nextState, NameState nameState) {
if (isWildcard(character)) {
addTransitionNextStateForWildcard(state, nextState);
} else {
// If the last character is the wildcard character, and we're on the second last character, set a match on
// the transition (turning it into a composite) before adding transitions from state and prevState.
SingleByteTransition single = nextState;
if (isWildcard(characters[characters.length - 1]) && currentIndex == characters.length - 2) {
ByteMatch match = new ByteMatch(pattern, nameState);
single = nextState.setMatch(match);
nextState.setIndeterminatePrefix(true);
} else if (isMultiByteSet(character)) {
nextState.setIndeterminatePrefix(true);
}
addTransition(state, character, single);
// If there was a previous state and it transitioned using the wildcard character, we need to add a
// transition from the previous state to allow wildcard match on empty substring.
if (prevState != null && isWildcard(characters[currentIndex - 1])) {
addTransition(prevState, character, single);
}
}
}