diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-01-03 09:36:17 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-01-03 09:36:17 (GMT) |
commit | 5b9bf6e3549ac9011f607cc50e764da6af347689 (patch) | |
tree | dd3dc39e4a58b02a9f75b66b1b25401c40fd5c49 /vhdlparser/VhdlParserErrorHandler.hpp | |
parent | 76613eb3154778cc1b34efc338cc2ba05e88b645 (diff) | |
download | Doxygen-5b9bf6e3549ac9011f607cc50e764da6af347689.zip Doxygen-5b9bf6e3549ac9011f607cc50e764da6af347689.tar.gz Doxygen-5b9bf6e3549ac9011f607cc50e764da6af347689.tar.bz2 |
Make VHDL parser reentrant
Diffstat (limited to 'vhdlparser/VhdlParserErrorHandler.hpp')
-rw-r--r-- | vhdlparser/VhdlParserErrorHandler.hpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/vhdlparser/VhdlParserErrorHandler.hpp b/vhdlparser/VhdlParserErrorHandler.hpp index 9576ce6..0337f1f 100644 --- a/vhdlparser/VhdlParserErrorHandler.hpp +++ b/vhdlparser/VhdlParserErrorHandler.hpp @@ -14,42 +14,55 @@ const char *getVhdlFileName(void); namespace vhdl { namespace parser { class VhdlErrorHandler: public ErrorHandler - { +{ + public: + VhdlErrorHandler(const char *fileName) : m_fileName(fileName) {} + virtual void handleUnexpectedToken(int expectedKind, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *parser) { - warn(getVhdlFileName(),actual->beginLine,"syntax error '%s'",actual->image.data()); + warn(m_fileName,actual->beginLine,"syntax error '%s'",actual->image.data()); error_count++; throw std::exception(); } virtual void handleParseError(Token *last, Token *unexpected, JAVACC_SIMPLE_STRING production, VhdlParser *parser) { - warn(getVhdlFileName(),last->beginLine,"unexpected token: '%s'", unexpected->image.data()); + warn(m_fileName,last->beginLine,"unexpected token: '%s'", unexpected->image.data()); error_count++; throw std::exception(); } virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *parser) { - warn(getVhdlFileName(), -1, "unexpected error: '%s'", (char*)message.c_str()); + warn(m_fileName, -1, "unexpected error: '%s'", (char*)message.c_str()); error_count++; throw std::exception(); } - }; -class VhdlTokenManagerErrorHandler: public TokenManagerErrorHandler { + private: + QCString m_fileName; +}; + +class VhdlTokenManagerErrorHandler: public TokenManagerErrorHandler +{ + public: + VhdlTokenManagerErrorHandler(const char *fileName) : m_fileName(fileName) {} + virtual void lexicalError(bool EOFSeen, int lexState, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager* token_manager) { - warn(getVhdlFileName(),errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str())); + warn(m_fileName,errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str())); } virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager* token_manager) { - warn(getVhdlFileName(),-1,"Unknown error: '%s'", (char*)errorMessage.c_str()); + warn(m_fileName,-1,"Unknown error: '%s'", (char*)errorMessage.c_str()); } - }; -} -} + + private: + QCString m_fileName; +}; + +} } #endif |