From c5bed41cb7e8a6fa5ecd2b2c318ec96dc32ac831 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 18 May 2021 13:39:02 +0200 Subject: Incorrect handling normal C comment in comment converter In normal C-comment (i.e. `/*` without extra `*` of `!` etc.) doxygen commands should be ignored. This was notr te case see e.g.: ``` const char * /* O - or @code NULL@ */ zipcXMLGetAttribute(); ``` --- src/commentcnv.l | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index d331fa4..aaf1162 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -134,6 +134,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z %x SkipChar %x SComment %x CComment +%x CNComment %x Verbatim %x VerbatimCode %x ReadLine @@ -346,7 +347,10 @@ SLASHopt [/]* yyextra->nestingCount=1; clearCommentStack(yyscanner); /* to be on the save side */ copyToOutput(yyscanner,yytext,(int)yyleng); - BEGIN(CComment); + if (yyextra->specialComment) + BEGIN(CComment); + else + BEGIN(CNComment); yyextra->commentStack.push(yyextra->lineNr); } "#"("#")? { @@ -402,8 +406,8 @@ SLASHopt [/]* yyextra->commentStack.push(yyextra->lineNr); } } -{MAILADR} | -"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block +{MAILADR} | +"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block copyToOutput(yyscanner,yytext,(int)yyleng); } "{@code"/[ \t\n] { @@ -618,10 +622,10 @@ SLASHopt [/]* copyToOutput(yyscanner,yytext,(int)yyleng); } -[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ +[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } -"*"+[^*\/\\@\n{\"]* { /* stars without slashes */ +"*"+[^*\/\\@\n{\"]* { /* stars without slashes */ copyToOutput(yyscanner,yytext,(int)yyleng); } "\"\"\"" { /* end of Python docstring */ @@ -637,7 +641,7 @@ SLASHopt [/]* BEGIN(Scan); } } -\n { /* new line in comment */ +\n { /* new line in comment */ copyToOutput(yyscanner,yytext,(int)yyleng); /* in case of Fortran always end of comment */ if (yyextra->lang==SrcLangExt_Fortran) @@ -645,7 +649,7 @@ SLASHopt [/]* BEGIN(Scan); } } -"/"+"*" { /* nested C comment */ +"/"+"*" { /* nested C comment */ if (yyextra->lang==SrcLangExt_Python || yyextra->lang==SrcLangExt_Markdown) { @@ -655,7 +659,7 @@ SLASHopt [/]* yyextra->commentStack.push(yyextra->lineNr); copyToOutput(yyscanner,yytext,(int)yyleng); } -"*"+"/" { /* end of C comment */ +"*"+"/" { /* end of C comment */ if (yyextra->lang==SrcLangExt_Python || yyextra->lang==SrcLangExt_Markdown) { @@ -676,8 +680,8 @@ SLASHopt [/]* } } } - /* Python an VHDL share CComment, so special attention for ending comments is required */ -"\n"/[ \t]*"#" { + /* Python an VHDL share CComment,CNComment, so special attention for ending comments is required */ +"\n"/[ \t]*"#" { if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; @@ -696,7 +700,7 @@ SLASHopt [/]* } } } -"\n"/[ \t]*"-" { +"\n"/[ \t]*"-" { if (yyextra->lang!=SrcLangExt_Python || yyextra->pythonDocString) { REJECT; @@ -707,7 +711,7 @@ SLASHopt [/]* BEGIN(Scan); } } -"\n"/[ \t]*[^ \t#\-] { +"\n"/[ \t]*[^ \t#\-] { if (yyextra->lang==SrcLangExt_Python) { if (yyextra->pythonDocString) @@ -739,18 +743,18 @@ SLASHopt [/]* } } /* removed for bug 674842 (bug was introduced in rev 768) -"'" { +"'" { yyextra->charContext = YY_START; copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipChar); } -"\"" { +"\"" { yyextra->stringContext = YY_START; copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipString); } */ -. { +. { copyToOutput(yyscanner,yytext,(int)yyleng); } ^[ \t]*{CPPC}"/"{SLASHopt}/\n { @@ -838,7 +842,7 @@ SLASHopt [/]* copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(yyextra->readLineCtx); } -[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command +[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command copyToOutput(yyscanner,yytext,(int)yyleng); } [\\@]"cond"/[^a-z_A-Z0-9] { // conditional section -- cgit v0.12 From 0e5b8b49e39508bc5a30d20dcaa7118f95ffd8aa Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 18 May 2021 16:32:40 +0200 Subject: Issue #8556 Removed bracket '(' in HTML an XML output The opening bracket was "forgotten" when the sharp count > 0 (in this case 1). the closing bracket was later on added to the name so the opening bracket is also be added to the name. --- src/scanner.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner.l b/src/scanner.l index 00fa3b4..4fb625f 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -1955,7 +1955,7 @@ NONLopt [^\n]* //printf("Found %s\n",qPrint(yyextra->current->name)); BEGIN( ReadFuncArgType ) ; } - else if (yyextra->sharpCount<=0) + else { yyextra->current->name+="("; yyextra->roundCount++; -- cgit v0.12