diff options
Diffstat (limited to 'src/commentcnv.l')
-rw-r--r-- | src/commentcnv.l | 206 |
1 files changed, 116 insertions, 90 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l index b5f8e41..23611a9 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -27,11 +27,8 @@ #include <stdio.h> #include <stdlib.h> - -#include <qstack.h> -#include <qregexp.h> -#include <qtextstream.h> -#include <qglobal.h> +#include <stack> +#include <algorithm> #include "bufstr.h" #include "debug.h" @@ -80,8 +77,8 @@ struct commentcnvYY_state QCString fileName; int lineNr = 0; int condCtx = 0; - QStack<CondCtx> condStack; - QStack<CommentCtx> commentStack; + std::stack<CondCtx> condStack; + std::stack<int> commentStack; QCString blockName; int lastCommentContext = 0; bool inSpecialComment = FALSE; @@ -111,12 +108,13 @@ static inline int computeIndent(const char *s); static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len); -static void startCondSection(yyscan_t yyscanner,const char *sectId); +static void startCondSection(yyscan_t yyscanner,const QCString §Id); static void endCondSection(yyscan_t yyscanner); static void handleCondSectionId(yyscan_t yyscanner,const char *expression); -static void replaceAliases(yyscan_t yyscanner,const char *s); +static void replaceAliases(yyscan_t yyscanner,const QCString &s); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void replaceComment(yyscan_t yyscanner,int offset); +static void clearCommentStack(yyscan_t yyscanner); @@ -170,6 +168,23 @@ FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL} NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} //- end: NUMBER --------------------------------------------------------------------------- + // C start comment +CCS "/\*" + // C end comment +CCE "*\/" + // Cpp comment +CPPC "/\/" + + // Optional any character +ANYopt .* + + // Optional white space +WSopt [ \t\r]* + // readline non special +RLopt [^\\@\n\*\/]* + // Optional slash +SLASHopt [/]* + %% <Scan>{NUMBER} { //Note similar code in code.l @@ -191,10 +206,10 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} { yyextra->pythonDocString = TRUE; yyextra->nestingCount=1; - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } } <Scan>![><!]/.*\n { @@ -206,9 +221,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} { copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->nestingCount=0; // Fortran doesn't have an end comment - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } } <Scan>[Cc\*][><!]/.*\n { @@ -223,9 +238,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} { copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->nestingCount=0; // Fortran doesn't have an end comment - yyextra->commentStack.clear(); /* to be on the safe side */ + clearCommentStack(yyscanner); /* to be on the save side */ BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } else { @@ -276,8 +291,8 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} <Scan>\n { /* new line */ copyToOutput(yyscanner,yytext,(int)yyleng); } -<Scan>"//!"/.*\n[ \t]*"//"[\/!][^\/] | /* start C++ style special comment block */ -<Scan>("///"[/]*)/[^/].*\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */ +<Scan>{CPPC}"!"/.*\n[ \t]*{CPPC}[\/!][^\/] | /* start C++ style special comment block */ +<Scan>({CPPC}"/"[/]*)/[^/].*\n[ \t]*{CPPC}[\/!][^\/] { /* start C++ style special comment block */ if (yyextra->mlBrief) { REJECT; // bail out if we do not need to convert @@ -291,48 +306,48 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} } yyextra->blockHeadCol=yyextra->col; copyToOutput(yyscanner,"/**",3); - replaceAliases(yyscanner,yytext+i); + replaceAliases(yyscanner,QCString(yytext+i)); yyextra->inSpecialComment=TRUE; //BEGIN(SComment); yyextra->readLineCtx=SComment; BEGIN(ReadLine); } } -<Scan>"//##Documentation".*/\n { /* Start of Rational Rose ANSI C++ comment block */ +<Scan>{CPPC}"##Documentation"{ANYopt}/\n { /* Start of Rational Rose ANSI C++ comment block */ if (yyextra->mlBrief) REJECT; int i=17; //=strlen("//##Documentation"); yyextra->blockHeadCol=yyextra->col; copyToOutput(yyscanner,"/**",3); - replaceAliases(yyscanner,yytext+i); + replaceAliases(yyscanner,QCString(yytext+i)); yyextra->inRoseComment=TRUE; BEGIN(SComment); } -<Scan>"//"[!\/]/.*\n[ \t]*"//"[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712 +<Scan>{CPPC}[!\/]/.*\n[ \t]*{CPPC}[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712 yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<Scan>"//"/.*\n { /* one line C++ comment */ +<Scan>{CPPC}/.*\n { /* one line C++ comment */ yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<Scan>"/**/" { /* avoid matching next rule for empty C comment, see bug 711723 */ +<Scan>{CCS}{CCE} { /* avoid matching next rule for empty C comment, see bug 711723 */ copyToOutput(yyscanner,yytext,(int)yyleng); } -<Scan>"/*"[*!]? { /* start of a C comment */ +<Scan>{CCS}[*!]? { /* start of a C comment */ if (yyextra->lang==SrcLangExt_Python) { REJECT; } yyextra->specialComment=(int)yyleng==3; yyextra->nestingCount=1; - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } <Scan>"#"("#")? { if (yyextra->lang!=SrcLangExt_Python) @@ -343,9 +358,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} { copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->nestingCount=0; // Python doesn't have an end comment for # - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } } <Scan>"--"[^!][^\n]* { @@ -368,9 +383,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} yyextra->vhdl = TRUE; copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->nestingCount=0; // VHDL doesn't have an end comment - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } } <Scan>![><!] { @@ -382,9 +397,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} { copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->nestingCount=0; // Fortran doesn't have an end comment - yyextra->commentStack.clear(); /* to be on the save side */ + clearCommentStack(yyscanner); /* to be on the save side */ BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } } <CComment,ReadLine>{MAILADR} | @@ -443,8 +458,14 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} yyextra->lastCommentContext = YY_START; BEGIN(Verbatim); } +<Scan>"\\\"" { /* escaped double quote */ + copyToOutput(yyscanner,yytext,(int)yyleng); + } +<Scan>"\\\\" { /* escaped backslash */ + copyToOutput(yyscanner,yytext,(int)yyleng); + } <Scan>. { /* any other character */ - copyToOutput(yyscanner,yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } <Verbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */ copyToOutput(yyscanner,yytext,(int)yyleng); @@ -501,7 +522,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} BEGIN(yyextra->lastCommentContext); } } -<VerbatimCode>^[ \t]*"//"[\!\/]? { /* skip leading comments */ +<VerbatimCode>^[ \t]*{CPPC}[\!\/]? { /* skip leading comments */ if (!yyextra->inSpecialComment) { copyToOutput(yyscanner,yytext,(int)yyleng); @@ -530,7 +551,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} <Verbatim,VerbatimCode>\n { /* new line in verbatim block */ copyToOutput(yyscanner,yytext,(int)yyleng); } -<Verbatim>^[ \t]*"//"[/!] { +<Verbatim>^[ \t]*{CPPC}[/!] { if (yyextra->blockName=="dot" || yyextra->blockName=="msc" || yyextra->blockName=="uml" || yyextra->blockName.at(0)=='f') { // see bug 487871, strip /// from dot images and formulas. @@ -596,7 +617,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} <CComment>[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } -<CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */ +<CComment>"*"+[^*\/\\@\n{\"]* { /* stars without slashes */ copyToOutput(yyscanner,yytext,(int)yyleng); } <CComment>"\"\"\"" { /* end of Python docstring */ @@ -627,7 +648,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} REJECT; } yyextra->nestingCount++; - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); copyToOutput(yyscanner,yytext,(int)yyleng); } <CComment>"*"+"/" { /* end of C comment */ @@ -647,7 +668,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} else { //yyextra->nestingCount--; - delete yyextra->commentStack.pop(); + yyextra->commentStack.pop(); } } } @@ -728,18 +749,18 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} <CComment>. { copyToOutput(yyscanner,yytext,(int)yyleng); } -<SComment>^[ \t]*"///"[\/]*/\n { +<SComment>^[ \t]*{CPPC}"/"{SLASHopt}/\n { replaceComment(yyscanner,0); } -<SComment>\n[ \t]*"///"[\/]*/\n { +<SComment>\n[ \t]*{CPPC}"/"{SLASHopt}/\n { replaceComment(yyscanner,1); } -<SComment>^[ \t]*"///"[^\/\n]/.*\n { +<SComment>^[ \t]*{CPPC}"/"[^\/\n]/.*\n { replaceComment(yyscanner,0); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<SComment>\n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n { +<SComment>\n[ \t]*{CPPC}[\/!]("<")?[ \t]*[\\@]"}".*\n { /* See Bug 752712: end the multiline comment when finding a @} or \} command */ copyToOutput(yyscanner," */",3); copyToOutput(yyscanner,yytext,(int)yyleng); @@ -747,26 +768,26 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} yyextra->inRoseComment=FALSE; BEGIN(Scan); } -<SComment>\n[ \t]*"///"[^\/\n]/.*\n { +<SComment>\n[ \t]*{CPPC}"/"[^\/\n]/.*\n { replaceComment(yyscanner,1); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<SComment>^[ \t]*"//!" | // just //! -<SComment>^[ \t]*"//!<"/.*\n | // or //!< something -<SComment>^[ \t]*"//!"[^<]/.*\n { // or //!something +<SComment>^[ \t]*{CPPC}"!" | // just //! +<SComment>^[ \t]*{CPPC}"!<"/.*\n | // or //!< something +<SComment>^[ \t]*{CPPC}"!"[^<]/.*\n { // or //!something replaceComment(yyscanner,0); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<SComment>\n[ \t]*"//!" | -<SComment>\n[ \t]*"//!<"/.*\n | -<SComment>\n[ \t]*"//!"[^<\n]/.*\n { +<SComment>\n[ \t]*{CPPC}"!" | +<SComment>\n[ \t]*{CPPC}"!<"/.*\n | +<SComment>\n[ \t]*{CPPC}"!"[^<\n]/.*\n { replaceComment(yyscanner,1); yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } -<SComment>^[ \t]*"//##"/.*\n { +<SComment>^[ \t]*{CPPC}"##"/.*\n { if (!yyextra->inRoseComment) { REJECT; @@ -778,7 +799,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} BEGIN(ReadLine); } } -<SComment>\n[ \t]*"//##"/.*\n { +<SComment>\n[ \t]*{CPPC}"##"/.*\n { if (!yyextra->inRoseComment) { REJECT; @@ -797,19 +818,19 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} yyextra->inRoseComment=FALSE; BEGIN(Scan); } -<ReadLine>"/**" { +<ReadLine>{CCS}"*" { copyToOutput(yyscanner,"/‍**",8); } -<ReadLine>"*/" { +<ReadLine>{CCE} { copyToOutput(yyscanner,"*‍/",7); } <ReadLine>"*" { copyToOutput(yyscanner,yytext,(int)yyleng); } -<ReadLine>[^\\@\n\*/]* { +<ReadLine>{RLopt} { copyToOutput(yyscanner,yytext,(int)yyleng); } -<ReadLine>[^\\@\n\*/]*/\n { +<ReadLine>{RLopt}/\n { copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(yyextra->readLineCtx); } @@ -843,7 +864,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} <CondLine>[!()&| \ta-z_A-Z0-9.\-]+ { handleCondSectionId(yyscanner,yytext); } -<CComment,ReadLine>[\\@]"cond"[ \t\r]*/\n { +<CComment,ReadLine>[\\@]"cond"{WSopt}/\n { yyextra->condCtx=YY_START; handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally } @@ -852,7 +873,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} if (*yytext=='\n') yyextra->lineNr++; } <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments - replaceAliases(yyscanner,yytext); + replaceAliases(yyscanner,QCString(yytext)); } <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments yyextra->lastBlockContext=YY_START; @@ -861,16 +882,16 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER} yyextra->lastEscaped=0; BEGIN( ReadAliasArgs ); } -<ReadAliasArgs>^[ \t]*"//"[/!]/[^\n]+ { // skip leading special comments (see bug 618079) +<ReadAliasArgs>^[ \t]*{CPPC}[/!]/[^\n]+ { // skip leading special comments (see bug 618079) } -<ReadAliasArgs>"*/" { // oops, end of comment in the middle of an alias? +<ReadAliasArgs>{CCE} { // oops, end of comment in the middle of an alias? if (yyextra->lang==SrcLangExt_Python) { REJECT; } else // abort the alias, restart scanning { - copyToOutput(yyscanner,yyextra->aliasString,yyextra->aliasString.length()); + copyToOutput(yyscanner,yyextra->aliasString.data(),yyextra->aliasString.length()); copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } @@ -1016,13 +1037,19 @@ static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len) } } -static void startCondSection(yyscan_t yyscanner,const char *sectId) +static void clearCommentStack(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + while (!yyextra->commentStack.empty()) yyextra->commentStack.pop(); +} + +static void startCondSection(yyscan_t yyscanner,const QCString §Id) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); CondParser prs; bool expResult = prs.parse(yyextra->fileName,yyextra->lineNr,sectId); - yyextra->condStack.push(new CondCtx(yyextra->lineNr,sectId,yyextra->skip)); + yyextra->condStack.push(CondCtx(yyextra->lineNr,sectId,yyextra->skip)); if (!expResult) // not enabled { yyextra->skip=TRUE; @@ -1032,15 +1059,16 @@ static void startCondSection(yyscan_t yyscanner,const char *sectId) static void endCondSection(yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - if (yyextra->condStack.isEmpty()) + if (yyextra->condStack.empty()) { warn(yyextra->fileName,yyextra->lineNr,"Found \\endcond command without matching \\cond"); yyextra->skip=FALSE; } else { - CondCtx *ctx = yyextra->condStack.pop(); - yyextra->skip=ctx->skip; + const CondCtx &ctx = yyextra->condStack.top(); + yyextra->skip=ctx.skip; + yyextra->condStack.pop(); } //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); } @@ -1049,7 +1077,7 @@ static void handleCondSectionId(yyscan_t yyscanner,const char *expression) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; bool oldSkip=yyextra->skip; - startCondSection(yyscanner,expression); + startCondSection(yyscanner,QCString(expression)); if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && !oldSkip && yyextra->skip) { @@ -1075,11 +1103,11 @@ static void handleCondSectionId(yyscan_t yyscanner,const char *expression) /** copies string \a s with length \a len to the output, while * replacing any alias commands found in the string. */ -static void replaceAliases(yyscan_t yyscanner,const char *s) +static void replaceAliases(yyscan_t yyscanner,const QCString &s) { QCString result = resolveAliasCmd(s); //printf("replaceAliases(%s)->'%s'\n",s,result.data()); - copyToOutput(yyscanner,result,result.length()); + copyToOutput(yyscanner,result.data(),result.length()); } @@ -1087,7 +1115,7 @@ static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; yy_size_t bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; - yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf); + yy_size_t bytesToCopy = std::min(max_size,bytesInBuf); memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy); yyextra->inBufPos+=bytesToCopy; return bytesToCopy; @@ -1124,7 +1152,7 @@ static void replaceComment(yyscan_t yyscanner,int offset) * -# It replaces aliases with their definition (see ALIASES) * -# It handles conditional sections (cond...endcond blocks) */ -void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) +void convertCppComments(BufStr *inBuf,BufStr *outBuf,const QCString &fileName) { yyscan_t yyscanner; commentcnvYY_state extra; @@ -1144,65 +1172,63 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) yyextra->lang = getLanguageFromFileName(fileName); yyextra->pythonDocString = FALSE; yyextra->lineNr = 1; - yyextra->condStack.clear(); - yyextra->condStack.setAutoDelete(TRUE); - yyextra->commentStack.clear(); - yyextra->commentStack.setAutoDelete(TRUE); + while (!yyextra->condStack.empty()) yyextra->condStack.pop(); + clearCommentStack(yyscanner); yyextra->vhdl = FALSE; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); + printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName)); yyextra->isFixedForm = FALSE; if (yyextra->lang==SrcLangExt_Fortran) { FortranFormat fmt = convertFileNameFortranParserCode(fileName); - yyextra->isFixedForm = recognizeFixedForm(inBuf->data(),fmt); + yyextra->isFixedForm = recognizeFixedForm(QCString(inBuf->data()),fmt); } if (yyextra->lang==SrcLangExt_Markdown) { yyextra->nestingCount=0; BEGIN(CComment); - yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + yyextra->commentStack.push(yyextra->lineNr); } else { BEGIN(Scan); } yylex(yyscanner); - while (!yyextra->condStack.isEmpty()) + while (!yyextra->condStack.empty()) { - CondCtx *ctx = yyextra->condStack.pop(); - QCString sectionInfo = " "; - if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data()); - warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have " + const CondCtx &ctx = yyextra->condStack.top(); + QCString sectionInfo(" "); + if (ctx.sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx.sectionId.stripWhiteSpace().data()); + warn(yyextra->fileName,ctx.lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); + yyextra->condStack.pop(); } if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown && yyextra->lang!=SrcLangExt_Fortran) { - QCString tmp= "(probable line reference: "; + QCString tmp("(probable line reference: "); bool first = TRUE; - while (!yyextra->commentStack.isEmpty()) + while (!yyextra->commentStack.empty()) { - CommentCtx *ctx = yyextra->commentStack.pop(); + int lineNr = yyextra->commentStack.top(); if (!first) tmp += ", "; - tmp += QCString().setNum(ctx->lineNr); + tmp += QCString().setNum(lineNr); first = FALSE; - delete ctx; + yyextra->commentStack.pop(); } tmp += ")"; warn(yyextra->fileName,yyextra->lineNr,"Reached end of file while still inside a (nested) comment. " "Nesting level %d %s",yyextra->nestingCount,tmp.data()); } - yyextra->commentStack.clear(); yyextra->nestingCount = 0; if (Debug::isFlagSet(Debug::CommentCnv)) { yyextra->outBuf->at(yyextra->outBuf->curPos())='\0'; Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n" - "output=[\n%s]\n-----------\n",fileName,yyextra->outBuf->data() + "output=[\n%s]\n-----------\n",qPrint(fileName),yyextra->outBuf->data() ); } - printlex(yy_flex_debug, FALSE, __FILE__, fileName); + printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName)); commentcnvYYlex_destroy(yyscanner); } |