File: VhdlParserErrorHandler.hpp

package info (click to toggle)
doxygen 1.8.12-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 19,856 kB
  • ctags: 30,758
  • sloc: cpp: 237,683; lex: 35,587; xml: 8,286; python: 2,768; ansic: 629; tcl: 594; php: 446; perl: 370; makefile: 241; yacc: 235; objc: 14; sh: 11; java: 1
file content (40 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef VHDLPARSERERRORHANDLER_H
#define VHDLPARSERERRORHANDLER_H

#include <stdio.h>
#include <stdlib.h>
#include <exception>
#include "VhdlParser.h"
#include "ErrorHandler.h"
#include "vhdlstring.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