diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2003-12-15 18:58:39 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2003-12-15 18:58:39 (GMT) |
commit | 4369f8dfd78c7d6666a604026017cfe6e4c9fbc4 (patch) | |
tree | 1cb1b44f09351116c7ebe409fef462341fac2ff3 /src/pre.l | |
parent | e25c1a6e6ea8548f91c3b18ed8337e8f8661e0e2 (diff) | |
download | Doxygen-4369f8dfd78c7d6666a604026017cfe6e4c9fbc4.zip Doxygen-4369f8dfd78c7d6666a604026017cfe6e4c9fbc4.tar.gz Doxygen-4369f8dfd78c7d6666a604026017cfe6e4c9fbc4.tar.bz2 |
Release-1.3.5-20031215
Diffstat (limited to 'src/pre.l')
-rw-r--r-- | src/pre.l | 84 |
1 files changed, 77 insertions, 7 deletions
@@ -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>"/*" |