summaryrefslogtreecommitdiffstats
path: root/vhdlparser/VhdlParserErrorHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'vhdlparser/VhdlParserErrorHandler.hpp')
-rw-r--r--vhdlparser/VhdlParserErrorHandler.hpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/vhdlparser/VhdlParserErrorHandler.hpp b/vhdlparser/VhdlParserErrorHandler.hpp
index 9576ce6..0337f1f 100644
--- a/vhdlparser/VhdlParserErrorHandler.hpp
+++ b/vhdlparser/VhdlParserErrorHandler.hpp
@@ -14,42 +14,55 @@ 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, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser)
{
- warn(getVhdlFileName(),actual->beginLine,"syntax error '%s'",actual->image.data());
+ warn(m_fileName,actual->beginLine,"syntax error '%s'",actual->image.data());
error_count++;
throw std::exception();
}
virtual void handleParseError(Token *last, Token *unexpected, JAVACC_SIMPLE_STRING production, VhdlParser *parser)
{
- warn(getVhdlFileName(),last->beginLine,"unexpected token: '%s'", unexpected->image.data());
+ warn(m_fileName,last->beginLine,"unexpected token: '%s'", unexpected->image.data());
error_count++;
throw std::exception();
}
virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser)
{
- warn(getVhdlFileName(), -1, "unexpected error: '%s'", (char*)message.c_str());
+ warn(m_fileName, -1, "unexpected error: '%s'", (char*)message.c_str());
error_count++;
throw std::exception();
}
- };
-class VhdlTokenManagerErrorHandler: public TokenManagerErrorHandler {
+ 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, 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()));
+ warn(m_fileName,errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str()));
}
virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager* token_manager)
{
- warn(getVhdlFileName(),-1,"Unknown error: '%s'", (char*)errorMessage.c_str());
+ warn(m_fileName,-1,"Unknown error: '%s'", (char*)errorMessage.c_str());
}
- };
-}
-}
+
+ private:
+ QCString m_fileName;
+};
+
+} }
#endif