summaryrefslogtreecommitdiffstats
path: root/src/commentcnv.l
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2010-11-18 21:50:39 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2010-11-18 21:50:39 (GMT)
commitdd7602fdd31d8f3e0f88be553da084a1e3fdec45 (patch)
treea6d2454b4e6d53003fa829bb7134fe373461ed97 /src/commentcnv.l
parentbe602ee76006d9b8b0f6e5e75114f2ce34f7773e (diff)
downloadDoxygen-dd7602fdd31d8f3e0f88be553da084a1e3fdec45.zip
Doxygen-dd7602fdd31d8f3e0f88be553da084a1e3fdec45.tar.gz
Doxygen-dd7602fdd31d8f3e0f88be553da084a1e3fdec45.tar.bz2
Release-1.7.2-20101118
Diffstat (limited to 'src/commentcnv.l')
-rw-r--r--src/commentcnv.l63
1 files changed, 36 insertions, 27 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l
index 660dae6..d3a7a92 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -25,6 +25,7 @@
#include <qstack.h>
#include <qregexp.h>
#include <qtextstream.h>
+#include <qglobal.h>
#include "bufstr.h"
#include "debug.h"
@@ -33,6 +34,7 @@
#include "doxygen.h"
#include "util.h"
+#include <assert.h>
#define ADDCHAR(c) g_outBuf->addChar(c)
#define ADDARRAY(a,s) g_outBuf->addArray(a,s)
@@ -134,7 +136,7 @@ static inline void copyToOutput(const char *s,int len)
}
}
}
- else
+ else if (len>0)
{
ADDARRAY(s,len);
static int tabSize=Config_getInt("TAB_SIZE");
@@ -318,17 +320,23 @@ void replaceComment(int offset);
copyToOutput(yytext,yyleng);
}
<Scan>("//!"|"///").*/\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */
- if (g_mlBrief) REJECT; // bail out if we do not need to convert
- int i=3;
- if (yytext[2]=='/')
+ if (g_mlBrief)
{
- while (i<(int)yyleng && yytext[i]=='/') i++;
+ REJECT; // bail out if we do not need to convert
+ }
+ else
+ {
+ int i=3;
+ if (yytext[2]=='/')
+ {
+ while (i<(int)yyleng && yytext[i]=='/') i++;
+ }
+ g_blockHeadCol=g_col;
+ copyToOutput("/**",3);
+ replaceAliases(yytext+i);
+ g_inSpecialComment=TRUE;
+ BEGIN(SComment);
}
- g_blockHeadCol=g_col;
- copyToOutput("/**",3);
- replaceAliases(yytext+i);
- g_inSpecialComment=TRUE;
- BEGIN(SComment);
}
<Scan>"//##Documentation".*/\n { /* Start of Rational Rose ANSI C++ comment block */
if (g_mlBrief) REJECT;
@@ -602,7 +610,7 @@ void replaceComment(int offset);
}
<SComment>\n[ \t]*"//!" |
<SComment>\n[ \t]*"//!<"/.*\n |
-<SComment>\n[ \t]*"//!"[^<\n]/.*\n {
+<SComment>\n[ \t]*"//!"[^<\n]/.*\n {
replaceComment(1);
g_readLineCtx=YY_START;
BEGIN(ReadLine);
@@ -752,24 +760,25 @@ void replaceComment(int offset);
%%
-void replaceComment(int offset)
+void replaceComment(int offset)
{
- if (g_mlBrief)
- {
- copyToOutput(yytext,yyleng);
- }
- else
- {
+ if (g_mlBrief)
+ {
+ copyToOutput(yytext,yyleng);
+ }
+ else
+ {
//printf("replaceComment(%s)\n",yytext);
- int i=computeIndent(&yytext[offset]);
- if (i==g_blockHeadCol)
- {
- replaceCommentMarker(yytext,yyleng);
- }
- else
- {
- copyToOutput(" */",3);
- int i;for (i=yyleng-1;i>=0;i--) unput(yytext[i]);
+ int i=computeIndent(&yytext[offset]);
+ if (i==g_blockHeadCol)
+ {
+ replaceCommentMarker(yytext,yyleng);
+ }
+ else
+ {
+ copyToOutput(" */",3);
+ int i;for (i=yyleng-1;i>=0;i--) unput(yytext[i]);
+ g_inSpecialComment=FALSE;
BEGIN(Scan);
}
}