mirror of
https://github.com/siemens-mobile-hacks/doxygen.git
synced 2026-11-25 22:27:34 +00:00
When having a vhdl construct like: ``` entity _H_ is ``` we get the, a bit unclear, warnings like: ``` Lexical error at: 16:8. Encountered: _ after: . ``` with version 1.8.17 we got the warning: ``` .../vhdl.vhd:16: warning: Lexical error, Encountered: '_' after: '' ``` not 100% clear either but at least clear which file is involved and what the meaning of the '16' is. Also the message didn't conform the doxygen style / place / handling of warnings / errors anymore (didn't go to the WARN_LOGFILE anymore). (The message is correct as a vhdl identifier cannot start or end with an underscore. Between the used javaCC versions (now 7.05) and the previously used version 6.xx apparently a small in the error handler prototypes has been introduces, and thus not finding the doxygen version anymore.
68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
#ifndef VHDLPARSERERRORHANDLER_H
|
|
#define VHDLPARSERERRORHANDLER_H
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <exception>
|
|
#include "VhdlParser.h"
|
|
#include "ErrorHandler.h"
|
|
#include "vhdlstring.h"
|
|
#include "message.h"
|
|
|
|
const char *getVhdlFileName(void);
|
|
|
|
namespace vhdl { namespace parser {
|
|
|
|
class VhdlErrorHandler: public ErrorHandler
|
|
{
|
|
public:
|
|
VhdlErrorHandler(const char *fileName) : m_fileName(fileName) {}
|
|
|
|
virtual void handleUnexpectedToken(int expectedKind, const JJString& expectedToken, Token *actual, VhdlParser *parser)
|
|
{
|
|
warn(m_fileName,actual->beginLine,"syntax error '%s'",actual->image.data());
|
|
error_count++;
|
|
throw std::exception();
|
|
}
|
|
|
|
virtual void handleParseError(Token *last, Token *unexpected, const JJSimpleString& production, VhdlParser *parser)
|
|
{
|
|
warn(m_fileName,last->beginLine,"unexpected token: '%s'", unexpected->image.data());
|
|
error_count++;
|
|
throw std::exception();
|
|
}
|
|
|
|
virtual void handleOtherError(const JJString& message, VhdlParser *parser)
|
|
{
|
|
warn(m_fileName, -1, "unexpected error: '%s'", (char*)message.c_str());
|
|
error_count++;
|
|
throw std::exception();
|
|
}
|
|
|
|
private:
|
|
QCString m_fileName;
|
|
};
|
|
|
|
class VhdlTokenManagerErrorHandler: public TokenManagerErrorHandler
|
|
{
|
|
public:
|
|
VhdlTokenManagerErrorHandler(const char *fileName) : m_fileName(fileName) {}
|
|
|
|
virtual void lexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, const JJString& errorAfter, JJChar curChar, VhdlParserTokenManager* token_manager)
|
|
{
|
|
warn(m_fileName,errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str()));
|
|
}
|
|
|
|
virtual void lexicalError(const JJString& errorMessage, VhdlParserTokenManager* token_manager)
|
|
{
|
|
warn(m_fileName,-1,"Unknown error: '%s'", (char*)errorMessage.c_str());
|
|
}
|
|
|
|
private:
|
|
QCString m_fileName;
|
|
};
|
|
|
|
} }
|
|
|
|
#endif
|
|
|