summaryrefslogtreecommitdiffstats
path: root/src/pre.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2003-12-15 18:58:39 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2003-12-15 18:58:39 (GMT)
commit104be290eb99ab3277906a57fb4673dfa1850bc6 (patch)
tree1cb1b44f09351116c7ebe409fef462341fac2ff3 /src/pre.l
parent4d3dea2f08f3bed73db5c3b8dc3772e46decb479 (diff)
downloadDoxygen-104be290eb99ab3277906a57fb4673dfa1850bc6.zip
Doxygen-104be290eb99ab3277906a57fb4673dfa1850bc6.tar.gz
Doxygen-104be290eb99ab3277906a57fb4673dfa1850bc6.tar.bz2
Release-1.3.5-20031215
Diffstat (limited to 'src/pre.l')
-rw-r--r--src/pre.l84
1 files changed, 77 insertions, 7 deletions
diff --git a/src/pre.l b/src/pre.l
index 2855190..4704a93 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -636,6 +636,23 @@ static int getNextId(const QCString &expr,int p,int *l)
p++;
}
}
+ else if (c=='/') // skip C Comment
+ {
+ char pc=c;
+ if (p<(int)expr.length())
+ {
+ c=expr.at(++p);
+ if (c=='*') // Start of C comment
+ {
+ while (p<(int)expr.length() && !(pc=='*' && c=='/'))
+ {
+ pc=c;
+ c=expr.at(++p);
+ }
+ p++;
+ }
+ }
+ }
}
return -1;
}
@@ -777,6 +794,20 @@ QCString removeIdsAndMarkers(const char *s)
p++;
while ((c=*p) && isId(c)) p++;
}
+ else if (c=='/') // skip C comments
+ {
+ char pc=c;
+ c=*++p;
+ if (c=='*') // start of C comment
+ {
+ while (*p && !(pc=='*' && c=='/')) // search end of comment
+ {
+ pc=c;
+ c=*++p;
+ }
+ p++;
+ }
+ }
else
{
result+=c;
@@ -786,6 +817,7 @@ QCString removeIdsAndMarkers(const char *s)
}
}
}
+ //printf("removeIdsAndMarkers(%s)=%s\n",s,result.data());
return result;
}
@@ -810,6 +842,23 @@ QCString removeMarkers(const char *s)
}
p+=2;
}
+ else if (c=='/') // skip C comments
+ {
+ result+=c;
+ char pc=c;
+ c=*++p;
+ if (c=='*') // start of C comment
+ {
+ while (*p && !(pc=='*' && c=='/')) // search end of comment
+ {
+ result+=c;
+ pc=c;
+ c=*++p;
+ }
+ result+=c;
+ p++;
+ }
+ }
else
{
result+=c;
@@ -817,6 +866,7 @@ QCString removeMarkers(const char *s)
}
}
}
+ //printf("RemoveMarkers(%s)=%s\n",s,result.data());
return result;
}
@@ -1061,6 +1111,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
%x Ifdef
%x Ifndef
%x SkipCComment
+%x CopyCComment
%x SkipVerbatim
%x SkipCPPComment
%x RemoveCComment
@@ -1622,23 +1673,24 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
g_argDict->insert(argName,new int(g_defArgs));
g_defArgs++;
}
-<DefineText>"/**"|"/*!" {
+ /*
+<DefineText>"/ **"|"/ *!" {
g_defText+=yytext;
g_defLitText+=yytext;
g_insideComment=TRUE;
}
-<DefineText>"*/" {
+<DefineText>"* /" {
g_defText+=yytext;
g_defLitText+=yytext;
g_insideComment=FALSE;
}
-<DefineText>"/*"|"/**<"|"/*!<" {
- outputArray(yytext,yyleng);
- g_defText+=' ';
- g_defLitText+=' ';
+ */
+<DefineText>"/*" {
+ g_defText+=yytext;
+ g_defLitText+=yytext;
g_lastCContext=YY_START;
g_commentCount=1;
- BEGIN(SkipCComment);
+ BEGIN(CopyCComment);
}
<DefineText>"//" {
outputChar('/');outputChar('/');
@@ -1679,6 +1731,24 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
<SkipCComment,SkipVerbatim>. {
outputChar(*yytext);
}
+<CopyCComment>[^*]+ {
+ g_defLitText+=yytext;
+ g_defText+=yytext;
+ }
+<CopyCComment>"*/" {
+ g_defLitText+=yytext;
+ g_defText+=yytext;
+ BEGIN(g_lastCContext);
+ }
+<CopyCComment>\n {
+ g_yyLineNr++;
+ g_defLitText+=yytext;
+ g_defText+=yytext;
+ }
+<CopyCComment>. {
+ g_defLitText+=yytext;
+ g_defText+=yytext;
+ }
<RemoveCComment>"*/" { BEGIN(g_lastCContext); }
<RemoveCComment>"//"
<RemoveCComment>"/*"