summaryrefslogtreecommitdiffstats
path: root/vhdlparser/VhdlParserErrorHandler.hpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2014-07-27 14:31:34 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2014-08-02 10:05:26 (GMT)
commit36122e49ed1d9e640b1ceca52536ec7c55e10474 (patch)
treec61b21164b0445eb23631aa812810f4712cd8f61 /vhdlparser/VhdlParserErrorHandler.hpp
parent6a60477b418e21dbadd3e62dc557a038e319581b (diff)
downloadDoxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.zip
Doxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.tar.gz
Doxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.tar.bz2
New VHDL parser implementation
Diffstat (limited to 'vhdlparser/VhdlParserErrorHandler.hpp')
-rw-r--r--vhdlparser/VhdlParserErrorHandler.hpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/vhdlparser/VhdlParserErrorHandler.hpp b/vhdlparser/VhdlParserErrorHandler.hpp
new file mode 100644
index 0000000..ba9a260
--- /dev/null
+++ b/vhdlparser/VhdlParserErrorHandler.hpp
@@ -0,0 +1,39 @@
+#ifndef VHDLPARSERERRORHANDLER_H
+#define VHDLPARSERERRORHANDLER_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <exception>
+#include "VhdlParser.h"
+#include "ErrorHandler.h"
+
+namespace vhdl { namespace parser {
+
+class VhdlErrorHandler: public ErrorHandler
+ {
+ 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());
+ error_count++;
+ throw std::exception();
+ }
+
+ 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());
+ 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());
+ error_count++;
+ throw std::exception();
+ }
+ };
+}
+}
+
+#endif
+