diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-06 18:54:14 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-06 19:26:28 (GMT) |
commit | 475b0c51847271b04cb0e58254bd7e420445250b (patch) | |
tree | 646a9b912d517bbb6b0e710d099e3d742e95fa79 /vhdlparser/VhdlParserTokenManager.cc | |
parent | e5076edf2c103d262a9e32d57fb40cfe210c9ddf (diff) | |
download | Doxygen-475b0c51847271b04cb0e58254bd7e420445250b.zip Doxygen-475b0c51847271b04cb0e58254bd7e420445250b.tar.gz Doxygen-475b0c51847271b04cb0e58254bd7e420445250b.tar.bz2 |
Various VHDL fixes
Diffstat (limited to 'vhdlparser/VhdlParserTokenManager.cc')
-rw-r--r-- | vhdlparser/VhdlParserTokenManager.cc | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/vhdlparser/VhdlParserTokenManager.cc b/vhdlparser/VhdlParserTokenManager.cc index a35deb2..9733acd 100644 --- a/vhdlparser/VhdlParserTokenManager.cc +++ b/vhdlparser/VhdlParserTokenManager.cc @@ -1,5 +1,6 @@ /* VhdlParserTokenManager.cc */ -#include "./VhdlParserTokenManager.h" +#include "VhdlParserTokenManager.h" +#include "TokenMgrError.h" namespace vhdl { namespace parser { static const unsigned long long jjbitVec0[] = { @@ -3307,10 +3308,10 @@ bool VhdlParserTokenManager::jjCanMove_1(int hiByte, int i1, int i2, unsigned lo Token * VhdlParserTokenManager::jjFillToken(){ Token *t; JAVACC_STRING_TYPE curTokenImage; - int beginLine; - int endLine; - int beginColumn; - int endColumn; + int beginLine = -1; + int endLine = -1; + int beginColumn = -1; + int endColumn = -1; JAVACC_STRING_TYPE im = jjstrLiteralImages[jjmatchedKind]; curTokenImage = (im.length() == 0) ? input_stream->GetImage() : im; if (input_stream->getTrackLineColumn()) { @@ -3319,7 +3320,9 @@ Token * VhdlParserTokenManager::jjFillToken(){ endLine = input_stream->getEndLine(); endColumn = input_stream->getEndColumn(); } - t = Token::newToken(jjmatchedKind, curTokenImage); + t = Token::newToken(jjmatchedKind); + t->kind = jjmatchedKind; + t->image = curTokenImage; t->specialToken = NULL; t->next = NULL; @@ -3405,7 +3408,14 @@ void VhdlParserTokenManager::SkipLexicalActions(Token *matchedToken){ } case 6 : { image.append(input_stream->GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); - ::vhdl::parser::VhdlParser::handleCommentBlock(image.data(),TRUE); + QCString doc(image.data()); + int count=doc.contains("--!"); + ::vhdl::parser::VhdlParser::setMultCommentLine(); + ::vhdl::parser::VhdlParser::lineCount(image.data()); + if (count == 1) + ::vhdl::parser::VhdlParser::oneLineComment(doc); + else + ::vhdl::parser::VhdlParser::handleCommentBlock(image.data(),FALSE); ; break; } case 7 : { @@ -3415,7 +3425,7 @@ void VhdlParserTokenManager::SkipLexicalActions(Token *matchedToken){ } case 8 : { image.append(input_stream->GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); - ::vhdl::parser::VhdlParser::lineCount(image.data()); + ::vhdl::parser::VhdlParser::lineCount(image.data()); break; } case 9 : { @@ -3560,7 +3570,7 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){ } /** Reinitialise parser. */ void VhdlParserTokenManager::ReInit(JAVACC_CHARSTREAM *stream, int lexState, VhdlParser *parserArg) { - if (input_stream) delete input_stream; + clear(); jjmatchedPos = jjnewStateCnt = 0; curLexState = lexState; input_stream = stream; @@ -3581,10 +3591,17 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){ /** Switch to specified lex state. */ void VhdlParserTokenManager::SwitchTo(int lexState) { - if (lexState >= 1 || lexState < 0) - assert(false); - //throw 1;//new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else + if (lexState >= 1 || lexState < 0) { + JAVACC_STRING_TYPE message; +#ifdef WIDE_CHAR + message += L"Error: Ignoring invalid lexical state : "; + message += lexState; message += L". State unchanged."; +#else + message += "Error: Ignoring invalid lexical state : "; + message += lexState; message += ". State unchanged."; +#endif + throw new TokenMgrError(message, INVALID_LEXICAL_STATE); + } else curLexState = lexState; } @@ -3592,14 +3609,23 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){ VhdlParserTokenManager::VhdlParserTokenManager (JAVACC_CHARSTREAM *stream, int lexState, VhdlParser *parserArg) { input_stream = NULL; + errorHandlerCreated = false; ReInit(stream, lexState, parserArg); } // Destructor VhdlParserTokenManager::~VhdlParserTokenManager () { - if (input_stream) delete input_stream; - if (errorHandlerCreated) delete errorHandler; + clear(); } + // clear + void VhdlParserTokenManager::clear() { + //Since input_stream was generated outside of TokenManager + //TokenManager should not take care of deleting it + //if (input_stream) delete input_stream; + if (errorHandlerCreated) delete errorHandler; + } + + } } |