diff options
author | albert-github <albert.tests@gmail.com> | 2020-06-26 13:46:00 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2020-06-26 13:46:00 (GMT) |
commit | f2de7e59db40daf9efde55bba111e9f4a98ef59f (patch) | |
tree | 3dbfd2fc80a6391d8f7c80e2f5352deed85d97c3 /src | |
parent | d5916c06fba9667911a19cf658e7c5ab54daf72c (diff) | |
download | Doxygen-f2de7e59db40daf9efde55bba111e9f4a98ef59f.zip Doxygen-f2de7e59db40daf9efde55bba111e9f4a98ef59f.tar.gz Doxygen-f2de7e59db40daf9efde55bba111e9f4a98ef59f.tar.bz2 |
issue #7872 A define containing a doxygen start of comment breaks the parser
Not only the preprocessor suffered from the "problem" but also the source code (e.g. with `SOURCE_BROWSER`) gave some strange / missing results.
Diffstat (limited to 'src')
-rw-r--r-- | src/code.l | 33 | ||||
-rw-r--r-- | src/pre.l | 2 |
2 files changed, 23 insertions, 12 deletions
@@ -621,16 +621,22 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" yyextra->code->codify(yytext); BEGIN( SkipCPP ) ; } +<SkipCPP>\" { + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + BEGIN( SkipString ) ; + } <SkipCPP>. { yyextra->code->codify(yytext); } -<SkipCPP>[^\n\/\\]+ { +<SkipCPP>[^\n\/\\\"]+ { yyextra->code->codify(yytext); } <SkipCPP>\\[\r]?\n { codifyLines(yyscanner,yytext); } -<SkipCPP>"//" { +<SkipCPP>"//"/[^/!] { + REJECT; yyextra->code->codify(yytext); } <Body,FuncCall>"{" { @@ -1971,15 +1977,25 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" yyextra->yyLineNr+=QCString(yytext).contains('\n'); } <RemoveSpecialCComment>"*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)? { - yyextra->yyLineNr+=QCString(yytext).contains('\n'); - nextCodeLine(yyscanner); if (yyextra->lastSpecialCContext==SkipCxxComment) { // force end of C++ comment here + yyextra->yyLineNr+=QCString(yytext).contains('\n'); + nextCodeLine(yyscanner); endFontClass(yyscanner); BEGIN( yyextra->lastCContext ) ; } else { + yyextra->yyLineNr+=QCString(yytext).contains('\n'); + if (QCString(yytext).at(strlen(yytext)-1) == '\n') + { + yyextra->yyLineNr--; + unput('\n'); + } + else + { + nextCodeLine(yyscanner); + } BEGIN(yyextra->lastSpecialCContext); } } @@ -2101,14 +2117,9 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" endFontClass(yyscanner); } } -<*>"//"[!/][^\n]*\n { // strip special one-line comment +<*>"//"[!/][^\n]*/\n { // strip special one-line comment if (YY_START==SkipComment || YY_START==SkipString) REJECT; - if (Config_getBool(STRIP_CODE_COMMENTS)) - { - char c[2]; c[0]='\n'; c[1]=0; - codifyLines(yyscanner,c); - } - else + if (!Config_getBool(STRIP_CODE_COMMENTS)) { startFontClass(yyscanner,"comment"); codifyLines(yyscanner,yytext); @@ -1632,7 +1632,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } } <SkipDoubleQuote>"//"[/]? { yyextra->defText += yytext; yyextra->defLitText+=yytext; } -<SkipDoubleQuote>"/*" { yyextra->defText += yytext; yyextra->defLitText+=yytext; } +<SkipDoubleQuote>"/*"[*]? { yyextra->defText += yytext; yyextra->defLitText+=yytext; } <SkipDoubleQuote>\" { yyextra->defText += *yytext; yyextra->defLitText+=yytext; BEGIN(DefineText); |