summaryrefslogtreecommitdiff
path: root/vhdlparser/VhdlParserErrorHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'vhdlparser/VhdlParserErrorHandler.hpp')
-rw-r--r--vhdlparser/VhdlParserErrorHandler.hpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/vhdlparser/VhdlParserErrorHandler.hpp b/vhdlparser/VhdlParserErrorHandler.hpp
index 9576ce6..efdf20e 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
- {
- virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser)
+{
+ public:
+ VhdlErrorHandler(const char *fileName) : m_fileName(fileName) {}
+
+ virtual void handleUnexpectedToken(int expectedKind, const JJString& 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)
+ virtual void handleParseError(Token *last, Token *unexpected, const JJSimpleString& 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)
+ virtual void handleOtherError(const JJString& 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 {
- virtual void lexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager* token_manager)
+ 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(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)
+ virtual void lexicalError(const JJString& 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