* Rewinds stack to the next sequence, unless we find a repetition, then we'll find to the next state
* @return BNFState - null or next state to put on stack
*/
public BNFState rewindStackUnmatchedToken() {
BNFState nextState = null;
boolean foundRepetition = false;
while (!isEmpty()) {
BNFPath sp = peek();
if (!sp.isStateDefinition()) {
BNFPathState ps = (BNFPathState) sp;
BNFState state = ps.getState();
if (state.getRepetition() != BNFRepetition.NONE) {
foundRepetition = true;
}
sp = pop();
if (foundRepetition && state.getNextState() != null) {
nextState = state.getNextState();
break;
}
} else {