void () { myDelegate.advance(); int prevStart = 0; int prevEnd = 0; int prevState = 0; IElementType prevType = null; if (myLastValuesActual) { prevStart = myLastStartOffset; prevEnd = myLastEndOffset; prevState = myLastState; prevType = myLastTokenType; } myLastValuesActual = false; getTokenType(); // cache values if (prevType != null && myLastTokenType != null) { if (myLastStartOffset > myLastEndOffset) { throwException("Incorrect token offsets returned by lexer"); } if (myLastStartOffset != prevEnd) { throwException("Discontinuous sequence of tokens is generated by lexer"); } if (myLastEndOffset == myLastStartOffset && prevEnd == prevStart && myLastState == prevState && myLastTokenType == prevType) { throwException("Lexer is not progressing after calling advance()"); } } }