diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-03 13:11:32 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-03 13:49:24 (GMT) |
commit | 088896f27f460b6ac03c2d64df148e3617c1e519 (patch) | |
tree | 5b0c250c54a6ede082f765d507d749fad52b0756 /vhdlparser/ErrorHandler.h | |
parent | d75455eef7c91f11c2b9061d9a086ce93c4231b2 (diff) | |
download | Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.zip Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.tar.gz Doxygen-088896f27f460b6ac03c2d64df148e3617c1e519.tar.bz2 |
Switched back to version 6.2 of JavaCC for VHDL parser generation.
Diffstat (limited to 'vhdlparser/ErrorHandler.h')
-rw-r--r-- | vhdlparser/ErrorHandler.h | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/vhdlparser/ErrorHandler.h b/vhdlparser/ErrorHandler.h index 9f0d38c..2170489 100644 --- a/vhdlparser/ErrorHandler.h +++ b/vhdlparser/ErrorHandler.h @@ -1,15 +1,21 @@ -/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */ -/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.2 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,BUILD_PARSER=true,BUILD_TOKEN_MANAGER=true */ #ifndef ERRORHANDLER_H #define ERRORHANDLER_H +#include <stdio.h> #include <string> #include "JavaCC.h" #include "Token.h" namespace vhdl { namespace parser { -class VhdlParser; + +JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str); + + class VhdlParser; class ErrorHandler { + friend class VhdlParserTokenManager; + friend class VhdlParser; protected: int error_count; public: @@ -33,11 +39,41 @@ class VhdlParser; virtual int getErrorCount() { return error_count; } + virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *) { + fprintf(stderr, "Error: %s\n", (char*)message.c_str()); + } virtual ~ErrorHandler() {} ErrorHandler() { error_count = 0; } }; + + class VhdlParserTokenManager; + class TokenManagerErrorHandler { + friend class VhdlParserTokenManager; + protected: + int error_count; + public: + // Returns a detailed message for the Error when it is thrown by the + // token manager to indicate a lexical error. + // Parameters : + // EOFSeen : indicates if EOF caused the lexical error + // curLexState : lexical state in which this error occurred + // errorLine : line number when the error occurred + // errorColumn : column number when the error occurred + // errorAfter : prefix that was seen before this error occurred + // curchar : the offending character + // + virtual void lexicalError(bool EOFSeen, int, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager*) { + // by default, we just print an error message and return. + fprintf(stderr, "Lexical error at: %d:%d. Encountered: %c after: %s.\n", errorLine, errorColumn, curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str())); + } + virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager*) { + fprintf(stderr, "%s\n", (char*)errorMessage.c_str()); + } + virtual ~TokenManagerErrorHandler() {} + }; + } } #endif -/* JavaCC - OriginalChecksum=282223c3bcb53b7ff385aed35944d185 (do not edit this line) */ +/* JavaCC - OriginalChecksum=c18f1105ba178be8e21cc9f279f94496 (do not edit this line) */ |