d98f029c4f92393a47200c45f437f7fb10adae9e
[platform/upstream/doxygen.git] / vhdlparser / VhdlParserErrorHandler.hpp
1 #ifndef VHDLPARSERERRORHANDLER_H
2 #define VHDLPARSERERRORHANDLER_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <exception>
7 #include "VhdlParser.h"
8 #include "ErrorHandler.h"
9 #include "vhdlstring.h"
10
11 namespace vhdl { namespace parser {
12
13 class VhdlErrorHandler: public ErrorHandler 
14   {
15     virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser) 
16     {
17       fprintf(stderr,"\n\n syntax error at line: %d : %s\n", actual->beginLine,actual->image.data());
18       error_count++;
19       throw std::exception();
20     }
21
22     virtual void handleParseError(Token *last, Token *unexpected, JAVACC_SIMPLE_STRING production, VhdlParser *parser) 
23     {
24       fprintf(stderr,"\n\n unexpected token at line: %d %s\n", last->beginLine,unexpected->image.data());
25       error_count++;
26       throw std::exception();
27     }
28
29     virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser)
30     {
31       fprintf(stderr, "\n\n unexpected error: %s\n", (char*)message.c_str());
32       error_count++;
33       throw std::exception();
34     }
35   };
36 }
37 }
38
39 #endif
40