diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-07-27 14:31:34 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-08-02 10:05:26 (GMT) |
commit | 36122e49ed1d9e640b1ceca52536ec7c55e10474 (patch) | |
tree | c61b21164b0445eb23631aa812810f4712cd8f61 /vhdlparser/ErrorHandler.h | |
parent | 6a60477b418e21dbadd3e62dc557a038e319581b (diff) | |
download | Doxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.zip Doxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.tar.gz Doxygen-36122e49ed1d9e640b1ceca52536ec7c55e10474.tar.bz2 |
New VHDL parser implementation
Diffstat (limited to 'vhdlparser/ErrorHandler.h')
-rw-r--r-- | vhdlparser/ErrorHandler.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vhdlparser/ErrorHandler.h b/vhdlparser/ErrorHandler.h new file mode 100644 index 0000000..9f0d38c --- /dev/null +++ b/vhdlparser/ErrorHandler.h @@ -0,0 +1,43 @@ +/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +#ifndef ERRORHANDLER_H +#define ERRORHANDLER_H +#include <string> +#include "JavaCC.h" +#include "Token.h" + +namespace vhdl { +namespace parser { +class VhdlParser; + class ErrorHandler { + protected: + int error_count; + public: + // Called when the parser encounters a different token when expecting to + // consume a specific kind of token. + // expectedKind - token kind that the parser was trying to consume. + // expectedToken - the image of the token - tokenImages[expectedKind]. + // actual - the actual token that the parser got instead. + virtual void handleUnexpectedToken(int, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *) { + error_count++; + fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str()); + } + // Called when the parser cannot continue parsing. + // last - the last token successfully parsed. + // unexpected - the token at which the error occurs. + // production - the production in which this error occurrs. + virtual void handleParseError(Token *, Token *unexpected, JAVACC_SIMPLE_STRING production, VhdlParser *) { + error_count++; + fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str()); + } + virtual int getErrorCount() { + return error_count; + } + virtual ~ErrorHandler() {} + ErrorHandler() { error_count = 0; } + }; +} +} + +#endif +/* JavaCC - OriginalChecksum=282223c3bcb53b7ff385aed35944d185 (do not edit this line) */ |