summaryrefslogtreecommitdiffstats
path: root/src/commentcnv.l
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2012-09-30 13:51:29 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2012-09-30 13:51:29 (GMT)
commitceb4115c7b941039411e1793e01239610ff112a2 (patch)
treed18c06222e0f84d6077b586e5633053a8bc09da8 /src/commentcnv.l
parentf6d511e52eb55c5d5b980c4d226f2ea80b396095 (diff)
downloadDoxygen-ceb4115c7b941039411e1793e01239610ff112a2.zip
Doxygen-ceb4115c7b941039411e1793e01239610ff112a2.tar.gz
Doxygen-ceb4115c7b941039411e1793e01239610ff112a2.tar.bz2
Release-1.8.2-20120930
Diffstat (limited to 'src/commentcnv.l')
-rw-r--r--src/commentcnv.l41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l
index 6da02db..e9fc74b 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -41,6 +41,12 @@
#define ADDCHAR(c) g_outBuf->addChar(c)
#define ADDARRAY(a,s) g_outBuf->addArray(a,s)
+enum GuardType
+{
+ Guard_Cond,
+ Guard_CondNot
+};
+
struct CondCtx
{
CondCtx(int line,QCString id,bool b)
@@ -77,6 +83,7 @@ static bool g_lastEscaped;
static int g_lastBlockContext;
static bool g_pythonDocString;
+static GuardType guardType; // kind of guard for conditional section
static SrcLangExt g_lang;
@@ -118,7 +125,7 @@ static void replaceCommentMarker(const char *s,int len)
ADDCHAR(' ');
}
// copy comment line to output
- ADDARRAY(p,len-(p-s));
+ ADDARRAY(p,len-(int)(p-s));
}
static inline int computeIndent(const char *s)
@@ -172,14 +179,29 @@ static inline void copyToOutput(const char *s,int len)
static void startCondSection(const char *sectId)
{
g_condStack.push(new CondCtx(g_lineNr,sectId,g_skip));
- if (Config_getList("ENABLED_SECTIONS").find(sectId)!=-1)
+ if (guardType == Guard_Cond)
{
- //printf("*** Section is enabled!\n");
+ if (Config_getList("ENABLED_SECTIONS").find(sectId)!=-1)
+ {
+ //printf("*** Section is enabled!\n");
+ }
+ else
+ {
+ //printf("*** Section is disabled!\n");
+ g_skip=TRUE;
+ }
}
- else
+ else if (guardType == Guard_CondNot)
{
- //printf("*** Section is disabled!\n");
- g_skip=TRUE;
+ if (Config_getList("ENABLED_SECTIONS").find(sectId)!=-1)
+ {
+ //printf("*** Section is disabled!\n");
+ g_skip=TRUE;
+ }
+ else
+ {
+ //printf("*** Section is enabled!\n");
+ }
}
}
@@ -660,6 +682,12 @@ void replaceComment(int offset);
}
<CComment,ReadLine>[\\@]"cond"[ \t]+ { // conditional section
g_condCtx = YY_START;
+ guardType = Guard_Cond;
+ BEGIN(CondLine);
+ }
+<CComment,ReadLine>[\\@]"condnot"[ \t]+ { // conditional section
+ g_condCtx = YY_START;
+ guardType = Guard_CondNot;
BEGIN(CondLine);
}
<CComment,ReadLine>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
@@ -700,6 +728,7 @@ void replaceComment(int offset);
<CondLine>[ \t]*
<CComment,ReadLine>[\\@]"cond"[ \t\r]*/\n |
<CondLine>. { // forgot section id?
+ guardType = Guard_Cond;
if (YY_START!=CondLine) g_condCtx=YY_START;
bool oldSkip=g_skip;
startCondSection(" "); // fake section id causing the section to be hidden unconditionally