string lexicalAnalyzer::getLexeme()
{
  char currentChar;
  string lex = "";
  errorCount = 0;
  int cs = 0; //currentState
  string newLexemeValue;
  tokenType newLexemeType;

  for( int i = 0; i < lines.size(); i++ )
    {
      lineCount = i;
      cout << lineCount + 1 << ": " << lines[i];

      for( int j = 0; j < lines[i].length(); j++ )
	{
	  pos = j;
	  
	  currentChar = lines[i][j];
	  cs = state( cs, currentChar );
	  //cout << "\nTHIS IS THE CURRENT STATE " << cs << "\n";
	  if( !( isspace( currentChar ) ) && !newLex(cs) )
	    lex += currentChar;
	  if(isAccepting( cs ) ){
	    if( cs == -1 )
	      {
		lex = currentChar;
		cout << "Error at " << lineCount + 1 << ", " << pos + 1 << ": invalid character found: " << currentChar <<
		  endl;
		errorCount++;
	      }


	    newLexemeValue = lex;
	    newLexemeType = getToken( cs, lex);
	    

	    cout << "\t" << setToken(newLexemeType) << "\t" << newLexemeValue << endl;
	    
	    lex = "";

	    if(newLex(cs) && j < lines[i].size() -1 )
	      j--;

	    cs = 0;
	  }

	}

    }	
  
  cout << errorCount << " errors found in the input file." << endl;
}
 inline bool isAccepting() {
    return isAccepting(1, INF);
 }