Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
VhdlParserErrorHandler.hpp
Go to the documentation of this file.
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
#include "
message.h
"
11
12
const
char
*
getVhdlFileName
(
void
);
13
14
namespace
vhdl
{
namespace
parser {
15
16
class
VhdlErrorHandler
:
public
ErrorHandler
17
{
18
public
:
19
VhdlErrorHandler
(
const
char
*fileName) :
m_fileName
(fileName) {}
20
21
virtual
void
handleUnexpectedToken
(
int
/* expectedKind */
,
const
JJString
&
/* expectedToken */
,
Token
*actual,
VhdlParser
*
/* parser */
)
22
{
23
warn
(
m_fileName
,actual->
beginLine
,
"syntax error '{}'"
,(
const
char
*)actual->
image
.c_str());
24
error_count
++;
25
throw
std::exception();
26
}
27
28
virtual
void
handleParseError
(
Token
*last,
Token
*unexpected,
const
JJSimpleString
&
/* production */
,
VhdlParser
*
/* parser */
)
29
{
30
warn
(
m_fileName
,last->
beginLine
,
"unexpected token: '{}'"
, (
const
char
*)unexpected->
image
.c_str());
31
error_count
++;
32
throw
std::exception();
33
}
34
35
virtual
void
handleOtherError
(
const
JJString
& message,
VhdlParser
*
/* parser */
)
36
{
37
warn
(
m_fileName
, -1,
"unexpected error: '{}'"
, (
const
char
*)message.c_str());
38
error_count
++;
39
throw
std::exception();
40
}
41
42
private
:
43
QCString
m_fileName
;
44
};
45
46
class
VhdlTokenManagerErrorHandler
:
public
TokenManagerErrorHandler
47
{
48
public
:
49
VhdlTokenManagerErrorHandler
(
const
char
*fileName) :
m_fileName
(fileName) {}
50
51
virtual
void
lexicalError
(
bool
EOFSeen,
int
/* lexState */
,
int
errorLine,
int
/* errorColumn */
,
const
JJString
& errorAfter,
JJChar
curChar,
VhdlParserTokenManager
*
/* token_manager */
)
52
{
53
warn
(
m_fileName
,errorLine,
"Lexical error, Encountered: '{:c}' after: '{}'"
,(
char
)curChar, (EOFSeen?
"EOF"
: (
const
char
*)errorAfter.c_str()));
54
}
55
56
virtual
void
lexicalError
(
const
JJString
& errorMessage,
VhdlParserTokenManager
*
/* token_manager */
)
57
{
58
warn
(
m_fileName
,-1,
"Unknown error: '{}'"
, (
const
char
*)errorMessage.c_str());
59
}
60
61
private
:
62
QCString
m_fileName
;
63
};
64
65
} }
66
67
#endif
68
ErrorHandler.h
JJString
JAVACC_STRING_TYPE JJString
Definition
JavaCC.h:22
JJChar
JAVACC_CHAR_TYPE JJChar
Definition
JavaCC.h:21
JJSimpleString
JAVACC_SIMPLE_STRING JJSimpleString
Definition
JavaCC.h:24
VhdlParser.h
getVhdlFileName
const char * getVhdlFileName(void)
QCString
This is an alternative implementation of QCString.
Definition
qcstring.h:101
vhdl::parser::ErrorHandler::ErrorHandler
ErrorHandler()
Definition
ErrorHandler.h:47
vhdl::parser::ErrorHandler::VhdlParser
friend class VhdlParser
Definition
ErrorHandler.h:19
vhdl::parser::ErrorHandler::error_count
int error_count
Definition
ErrorHandler.h:21
vhdl::parser::Token
Describes the input token stream.
Definition
Token.h:17
vhdl::parser::Token::image
JJString image
The string image of the token.
Definition
Token.h:39
vhdl::parser::Token::beginLine
int beginLine
The line number of the first character of this Token.
Definition
Token.h:28
vhdl::parser::TokenManagerErrorHandler
Definition
ErrorHandler.h:51
vhdl::parser::TokenManagerErrorHandler::VhdlParserTokenManager
friend class VhdlParserTokenManager
Definition
ErrorHandler.h:52
vhdl::parser::VhdlErrorHandler::handleParseError
virtual void handleParseError(Token *last, Token *unexpected, const JJSimpleString &, VhdlParser *)
Definition
VhdlParserErrorHandler.hpp:28
vhdl::parser::VhdlErrorHandler::handleOtherError
virtual void handleOtherError(const JJString &message, VhdlParser *)
Definition
VhdlParserErrorHandler.hpp:35
vhdl::parser::VhdlErrorHandler::m_fileName
QCString m_fileName
Definition
VhdlParserErrorHandler.hpp:43
vhdl::parser::VhdlErrorHandler::handleUnexpectedToken
virtual void handleUnexpectedToken(int, const JJString &, Token *actual, VhdlParser *)
Definition
VhdlParserErrorHandler.hpp:21
vhdl::parser::VhdlErrorHandler::VhdlErrorHandler
VhdlErrorHandler(const char *fileName)
Definition
VhdlParserErrorHandler.hpp:19
vhdl::parser::VhdlTokenManagerErrorHandler::VhdlTokenManagerErrorHandler
VhdlTokenManagerErrorHandler(const char *fileName)
Definition
VhdlParserErrorHandler.hpp:49
vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError
virtual void lexicalError(const JJString &errorMessage, VhdlParserTokenManager *)
Definition
VhdlParserErrorHandler.hpp:56
vhdl::parser::VhdlTokenManagerErrorHandler::lexicalError
virtual void lexicalError(bool EOFSeen, int, int errorLine, int, const JJString &errorAfter, JJChar curChar, VhdlParserTokenManager *)
Definition
VhdlParserErrorHandler.hpp:51
vhdl::parser::VhdlTokenManagerErrorHandler::m_fileName
QCString m_fileName
Definition
VhdlParserErrorHandler.hpp:62
message.h
warn
#define warn(file, line, fmt,...)
Definition
message.h:97
vhdl
Token literal values and constants.
Definition
CharStream.h:12
vhdlstring.h
vhdlparser
VhdlParserErrorHandler.hpp
Generated by
1.17.0