Exemplo n.º 1
0
void  VhdlParserIF::parseVhdlfile(const char* inputBuffer,bool inLine) 
{
  JAVACC_STRING_TYPE s =inputBuffer;
  CharStream *stream = new CharStream(s.c_str(), (int)s.size(), 1, 1);
  VhdlParserTokenManager *tokenManager = new VhdlParserTokenManager(stream);
  myParser=new VhdlParser(tokenManager);
  VhdlErrorHandler *myErr=new VhdlErrorHandler();
  myParser->setErrorHandler(myErr);
  try
  {
    if(inLine)
    {
      myParser->parseInline();
    }
    else
    {
      myParser->design_file();
    }
  }
  catch( std::exception &){ /* fprintf(stderr,"\n[%s]",e.what()); */ }
  //  fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
  //  fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
  delete myParser;
  delete myErr;
 
}
 virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager* token_manager)
 {
   warn(getVhdlFileName(),-1,"Unknown error: '%s'", (char*)errorMessage.c_str());
 }
 virtual void lexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager* token_manager)
 {
   warn(getVhdlFileName(),errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str()));
 }
 virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser)
 {
   warn(getVhdlFileName(), -1, "unexpected error: '%s'", (char*)message.c_str());
   error_count++;
   throw std::exception();
 }
Exemplo n.º 5
0
 virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser)
 {
   fprintf(stderr, "\n\n unexpected error: %s\n", (char*)message.c_str());
   error_count++;
   throw std::exception();
 }