summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-10-12 16:46:34 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-10-12 16:46:34 (GMT)
commit036292ae469eb5106d5b5c0bbbbf5b9d77d83638 (patch)
tree4547b7876b33f7f7e01a8fb849c4e5baae4597d8 /src
parent5d8fc1c198b8c5ccffa67eaddea7398fc2939449 (diff)
downloadDoxygen-036292ae469eb5106d5b5c0bbbbf5b9d77d83638.zip
Doxygen-036292ae469eb5106d5b5c0bbbbf5b9d77d83638.tar.gz
Doxygen-036292ae469eb5106d5b5c0bbbbf5b9d77d83638.tar.bz2
Bug 709706 - Terminating C comments within markdown files breaks aliases
Diffstat (limited to 'src')
-rw-r--r--src/commentcnv.l26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l
index 09230eb..948d6e2 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -78,6 +78,7 @@ static int g_blockCount;
static bool g_lastEscaped;
static int g_lastBlockContext;
static bool g_pythonDocString;
+static int g_nestingCount;
static SrcLangExt g_lang;
static bool isFixedForm; // For Fortran
@@ -251,6 +252,7 @@ void replaceComment(int offset);
else
{
g_pythonDocString = TRUE;
+ g_nestingCount=0;
copyToOutput(yytext,(int)yyleng);
BEGIN(CComment);
}
@@ -263,6 +265,7 @@ void replaceComment(int offset);
else
{
copyToOutput(yytext,(int)yyleng);
+ g_nestingCount=0;
BEGIN(CComment);
}
}
@@ -277,6 +280,7 @@ void replaceComment(int offset);
if (isFixedForm && (g_col == 0))
{
copyToOutput(yytext,(int)yyleng);
+ g_nestingCount=0;
BEGIN(CComment);
}
else
@@ -367,6 +371,7 @@ void replaceComment(int offset);
}
<Scan>"/*"[*!]? { /* start of a C comment */
g_specialComment=(int)yyleng==3;
+ g_nestingCount=0;
copyToOutput(yytext,(int)yyleng);
BEGIN(CComment);
}
@@ -378,6 +383,7 @@ void replaceComment(int offset);
else
{
copyToOutput(yytext,(int)yyleng);
+ g_nestingCount=0;
BEGIN(CComment);
}
}
@@ -389,6 +395,7 @@ void replaceComment(int offset);
else
{
copyToOutput(yytext,(int)yyleng);
+ g_nestingCount=0;
BEGIN(CComment);
}
}
@@ -400,6 +407,7 @@ void replaceComment(int offset);
else
{
copyToOutput(yytext,(int)yyleng);
+ g_nestingCount=0;
BEGIN(CComment);
}
}
@@ -564,7 +572,7 @@ void replaceComment(int offset);
copyToOutput(yytext,(int)yyleng);
}
-<CComment>[^\\!@*\n{\"]* { /* anything that is not a '*' or command */
+<CComment>[^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */
copyToOutput(yytext,(int)yyleng);
}
<CComment>"*"+[^*/\\@\n{\"]* { /* stars without slashes */
@@ -590,6 +598,10 @@ void replaceComment(int offset);
BEGIN(Scan);
}
}
+<CComment>"/"+"*" { /* nested C comment */
+ g_nestingCount++;
+ copyToOutput(yytext,(int)yyleng);
+ }
<CComment>"*"+"/" { /* end of C comment */
if (g_lang==SrcLangExt_Python)
{
@@ -597,8 +609,15 @@ void replaceComment(int offset);
}
else
{
- copyToOutput(yytext,(int)yyleng);
- BEGIN(Scan);
+ if (g_nestingCount<=0)
+ {
+ copyToOutput(yytext,(int)yyleng);
+ BEGIN(Scan);
+ }
+ else
+ {
+ g_nestingCount--;
+ }
}
}
<CComment>"\n"/[ \t]*[^#] { /* end of Python comment */
@@ -935,6 +954,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
if (g_lang==SrcLangExt_Markdown)
{
+ g_nestingCount=0;
BEGIN(CComment);
}
else