diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2013-05-25 15:20:04 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-05-25 15:20:04 (GMT) |
commit | ae845dea83a92093c18081db96014eb604f76d79 (patch) | |
tree | 276078a91caa231f2e62437278a181ea884c9bec | |
parent | 9a72b1b6ed89e678dfa78b9c79bdd913e15da534 (diff) | |
download | Doxygen-ae845dea83a92093c18081db96014eb604f76d79.zip Doxygen-ae845dea83a92093c18081db96014eb604f76d79.tar.gz Doxygen-ae845dea83a92093c18081db96014eb604f76d79.tar.bz2 |
Bug 700908 - code after \@cond is removed
-rw-r--r-- | src/pre.l | 35 |
1 files changed, 31 insertions, 4 deletions
@@ -59,6 +59,16 @@ #define DBG_CTX(x) do { } while(0) #define YY_NEVER_INTERACTIVE 1 + +struct CondCtx +{ + CondCtx(int line,QCString id,bool b) + : lineNr(line),sectionId(id), skip(b) {} + int lineNr; + QCString sectionId; + bool skip; +}; + struct FileState { FileState(int size) : fileBuf(size), @@ -360,7 +370,7 @@ static bool g_isImported; static QCString g_blockName; static int g_condCtx; static bool g_skip; -static QStack<bool> g_condStack; +static QStack<CondCtx> g_condStack; static bool g_insideCS; // C# has simpler preprocessor static bool g_isSource; @@ -1613,7 +1623,7 @@ static void startCondSection(const char *sectId) //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); CondParser prs; bool expResult = prs.parse(g_yyFileName,g_yyLineNr,sectId); - g_condStack.push(new bool(g_skip)); + g_condStack.push(new CondCtx(g_yyLineNr,sectId,g_skip)); if (!expResult) { g_skip=TRUE; @@ -1629,8 +1639,8 @@ static void endCondSection() } else { - bool *ctx = g_condStack.pop(); - g_skip=*ctx; + CondCtx *ctx = g_condStack.pop(); + g_skip=ctx->skip; } //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); } @@ -2457,6 +2467,9 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } BEGIN(SkipVerbatim); } +<SkipCComment,SkipCPPComment>[\\@][\\@]"cond"[ \t]+ { // escaped @cond + outputArray(yytext,(int)yyleng); + } <SkipCPPComment>[\\@]"cond"[ \t]+ { // conditional section g_ccomment=TRUE; g_condCtx=YY_START; @@ -2530,6 +2543,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <SkipCond>[^\/\!*\\@\n]+ { } <SkipCond>"//"[/!] { g_ccomment=FALSE; } <SkipCond>"/*"[*!] { g_ccomment=TRUE; } +<SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-z_A-Z0-9] { + if (!g_skip) + { + outputArray(yytext,(int)yyleng); + } + } <SkipCond>[\\@]"endcond"/[^a-z_A-Z0-9] { bool oldSkip = g_skip; endCondSection(); @@ -3088,6 +3107,14 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) preYYlex(); g_lexInit=TRUE; + while (!g_condStack.isEmpty()) + { + CondCtx *ctx = g_condStack.pop(); + QCString sectionInfo = " "; + if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label %s ",ctx->sectionId.data()); + warn(fileName,ctx->lineNr,"Conditional section%sdoes not have " + "a corresponding \\endcond command within this file.",sectionInfo.data()); + } // make sure we don't extend a \cond with missing \endcond over multiple files (see bug 624829) forceEndCondSection(); |