private void changeDfaState(char c) {
   dfa.changeState(c);
   handler.moveForward();
 }
 private void handleErrorState() {
   dfa.reset();
   handler.printLexicalException();
   Compiler.errorOccured();
   popToken();
 }
 private void prepareToFindNextToken() {
   dfa.reset();
   handler.moveBackward();
   removeSpaces();
 }
 private void handleNonAcceptState() {
   if (dfa.isInErrorState()) handleErrorState();
   else if (dfa.isInSpaceState()) dfa.reset();
 }
 private void processNextChar(char c) {
   changeDfaState(c);
   if (dfa.isNotInAcceptState()) handleNonAcceptState();
 }
 private TokenTuple findToken() {
   while (dfa.isNotInAcceptState()) processNextChar(handler.getCurrentChar());
   return dfa.getToken();
 }
 private void removeSpaces() {
   while (handler.hasChars() && handler.isAtSpaceChar() && dfa.isInSpaceState())
     processNextChar(handler.getCurrentChar());
 }
 public void reset() {
   dfa.reset();
 }