summaryrefslogtreecommitdiffstats
path: root/vhdlparser/VhdlParserErrorHandler.hpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2018-03-27 16:22:58 (GMT)
committeralbert-github <albert.tests@gmail.com>2018-03-27 16:22:58 (GMT)
commit12ea0367d27b47280e8d768d04c8c332e9657491 (patch)
treeab80c9b5357b12716ee6331a1e6bb2e8c48d05ed /vhdlparser/VhdlParserErrorHandler.hpp
parent7e2fcd305c8c9377aa958a3d812cc31bc81c0e32 (diff)
downloadDoxygen-12ea0367d27b47280e8d768d04c8c332e9657491.zip
Doxygen-12ea0367d27b47280e8d768d04c8c332e9657491.tar.gz
Doxygen-12ea0367d27b47280e8d768d04c8c332e9657491.tar.bz2
Making VHDL error messages more doxygen like
Diffstat (limited to 'vhdlparser/VhdlParserErrorHandler.hpp')
-rw-r--r--vhdlparser/VhdlParserErrorHandler.hpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/vhdlparser/VhdlParserErrorHandler.hpp b/vhdlparser/VhdlParserErrorHandler.hpp
index d98f029..9576ce6 100644
--- a/vhdlparser/VhdlParserErrorHandler.hpp
+++ b/vhdlparser/VhdlParserErrorHandler.hpp
@@ -7,32 +7,47 @@
#include "VhdlParser.h"
#include "ErrorHandler.h"
#include "vhdlstring.h"
+#include "message.h"
+
+const char *getVhdlFileName(void);
namespace vhdl { namespace parser {
-class VhdlErrorHandler: public ErrorHandler
+class VhdlErrorHandler: public ErrorHandler
{
- virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser)
+ virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser)
{
- fprintf(stderr,"\n\n syntax error at line: %d : %s\n", actual->beginLine,actual->image.data());
+ warn(getVhdlFileName(),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, JAVACC_SIMPLE_STRING production, VhdlParser *parser)
{
- fprintf(stderr,"\n\n unexpected token at line: %d %s\n", last->beginLine,unexpected->image.data());
+ warn(getVhdlFileName(),last->beginLine,"unexpected token: '%s'", unexpected->image.data());
error_count++;
throw std::exception();
}
virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser)
{
- fprintf(stderr, "\n\n unexpected error: %s\n", (char*)message.c_str());
+ warn(getVhdlFileName(), -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)
+ {
+ warn(getVhdlFileName(),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());
+ }
+ };
}
}