summaryrefslogtreecommitdiffstats
path: root/src/commentcnv.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2008-01-17 18:56:38 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2008-01-17 18:56:38 (GMT)
commitf000dd870b772ed6bc26ea383a8657301eb5ef17 (patch)
tree05e55417a750c1275c9139b7952de6941db168dd /src/commentcnv.l
parentb00ec8923dcf911a38323429f1744048b20a35a7 (diff)
downloadDoxygen-f000dd870b772ed6bc26ea383a8657301eb5ef17.zip
Doxygen-f000dd870b772ed6bc26ea383a8657301eb5ef17.tar.gz
Doxygen-f000dd870b772ed6bc26ea383a8657301eb5ef17.tar.bz2
Release-1.5.4-20080101
Diffstat (limited to 'src/commentcnv.l')
-rw-r--r--src/commentcnv.l77
1 files changed, 68 insertions, 9 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l
index e9a3b47..68ee64e 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -1,8 +1,8 @@
/*****************************************************************************
*
- * $Id$
+ *
*
- * Copyright (C) 1997-2007 by Dimitri van Heesch.
+ * Copyright (C) 1997-2008 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -65,6 +65,8 @@ static QCString g_aliasString;
static int g_blockCount;
static int g_lastBlockContext;
+static SrcLangExt g_lang;
+
static void replaceCommentMarker(const char *s,int len)
{
const char *p=s;
@@ -268,7 +270,7 @@ void replaceComment(int offset);
%%
-<Scan>[^"'\/\n\\]* { /* eat anything that is not " / or \n */
+<Scan>[^"'\/\n\\#\\-]* { /* eat anything that is not " / or \n */
copyToOutput(yytext,yyleng);
}
<Scan>"\"" { /* start of a string */
@@ -312,6 +314,28 @@ void replaceComment(int offset);
copyToOutput(yytext,yyleng);
BEGIN(CComment);
}
+<Scan>"##" {
+ if (g_lang!=SrcLangExt_Python)
+ {
+ REJECT;
+ }
+ else
+ {
+ copyToOutput(yytext,yyleng);
+ BEGIN(CComment);
+ }
+ }
+<Scan>"--!" {
+ if (g_lang!=SrcLangExt_VHDL)
+ {
+ REJECT;
+ }
+ else
+ {
+ copyToOutput(yytext,yyleng);
+ BEGIN(CComment);
+ }
+ }
<CComment,ReadLine>[\\@]("dot"|"code"|"msc")/[^a-z_A-Z0-9] { /* start of a verbatim block */
copyToOutput(yytext,yyleng);
g_lastCommentContext = YY_START;
@@ -414,6 +438,28 @@ void replaceComment(int offset);
copyToOutput(yytext,yyleng);
BEGIN(Scan);
}
+<CComment>"\n"/[ \t]*[^#] { /* end of Python comment */
+ if (g_lang!=SrcLangExt_Python)
+ {
+ REJECT;
+ }
+ else
+ {
+ copyToOutput(yytext,yyleng);
+ BEGIN(Scan);
+ }
+ }
+<CComment>"\n"/[ \t]*[^\-] { /* end of VHDL comment */
+ if (g_lang!=SrcLangExt_VHDL)
+ {
+ REJECT;
+ }
+ else
+ {
+ copyToOutput(yytext,yyleng);
+ BEGIN(Scan);
+ }
+ }
<CComment>. {
copyToOutput(yytext,yyleng);
}
@@ -480,8 +526,12 @@ void replaceComment(int offset);
if (YY_START==CComment && oldSkip && !g_skip)
{
//printf("** Adding start of comment!\n");
- ADDCHAR('/');
- ADDCHAR('*');
+ if (g_lang!=SrcLangExt_Python &&
+ g_lang!=SrcLangExt_VHDL)
+ {
+ ADDCHAR('/');
+ ADDCHAR('*');
+ }
}
}
<CondLine>[a-z_A-Z][a-z_A-Z0-9.\-]* {
@@ -490,8 +540,12 @@ void replaceComment(int offset);
if (g_condCtx==CComment && !oldSkip && g_skip)
{
//printf("** Adding terminator for comment!\n");
- ADDCHAR('*');
- ADDCHAR('/');
+ if (g_lang!=SrcLangExt_Python &&
+ g_lang!=SrcLangExt_VHDL)
+ {
+ ADDCHAR('*');
+ ADDCHAR('/');
+ }
}
BEGIN(g_condCtx);
}
@@ -504,8 +558,12 @@ void replaceComment(int offset);
if (g_condCtx==CComment && !oldSkip && g_skip)
{
//printf("** Adding terminator for comment!\n");
- ADDCHAR('*');
- ADDCHAR('/');
+ if (g_lang!=SrcLangExt_Python &&
+ g_lang!=SrcLangExt_VHDL)
+ {
+ ADDCHAR('*');
+ ADDCHAR('/');
+ }
}
if (*yytext=='\n') g_lineNr++;
BEGIN(g_condCtx);
@@ -587,6 +645,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
g_mlBrief = Config_getBool("MULTILINE_CPP_IS_BRIEF");
g_skip = FALSE;
g_fileName = fileName;
+ g_lang = getLanguageFromFileName(fileName);
g_lineNr = 0;
g_condStack.clear();
g_condStack.setAutoDelete(TRUE);