From cbf2176f3b053f3a5404b4ec1e01a6522b4ae2cd Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 14 May 2021 20:07:43 +0200 Subject: issue #8552 Javadoc: strange issue with @verbatim ... @endverbatim The end condition of a block was not detected correctly. in `scanner.l` (and thus `lexscanner.l` too) either the second part was missing or the compete test was missing. Furthermore some conditions weren't handled correctly / incomplete. --- src/lexscanner.l | 15 +++++++++++++-- src/scanner.l | 17 ++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/lexscanner.l b/src/lexscanner.l index 2b6b3a0..44219f3 100644 --- a/src/lexscanner.l +++ b/src/lexscanner.l @@ -709,10 +709,18 @@ NONLopt [^\n]* {CMD}("f$"|"f["|"f{"|"f(") { yyextra->cCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; + if (yyextra->docBlockName.at(1)=='[') + { + yyextra->docBlockName.at(1)=']'; + } if (yyextra->docBlockName.at(1)=='{') { yyextra->docBlockName.at(1)='}'; } + if (yyextra->docBlockName.at(1)=='(') + { + yyextra->docBlockName.at(1)=')'; + } yyextra->fencedSize=0; yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); @@ -777,11 +785,14 @@ NONLopt [^\n]* } [\\@]("f$"|"f]"|"f}"|"f)") { yyextra->cCodeBuffer += yytext; - BEGIN(DocBlock); + if (yyextra->docBlockName==&yytext[1]) + { + BEGIN(DocBlock); + } } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block yyextra->cCodeBuffer += yytext; - if (&yytext[4]==yyextra->docBlockName) + if (yyextra->docBlockName==&yytext[4]) { BEGIN(DocBlock); } diff --git a/src/scanner.l b/src/scanner.l index 00fa3b4..3a927be 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -4543,7 +4543,7 @@ NONLopt [^\n]* yyextra->docBlockName=&yytext[1]; if (yyextra->docBlockName.at(1)=='[') { - yyextra->docBlockName.at(1)='}'; + yyextra->docBlockName.at(1)=']'; } if (yyextra->docBlockName.at(1)=='{') { @@ -4558,7 +4558,7 @@ NONLopt [^\n]* } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode"|"f$"|"f]"|"f}"|"f)")/[^a-z_A-Z0-9\-] { // end of verbatim block yyextra->fullArgString+=yytext; - if (yytext[1]=='f') // end of formula + if (yytext[1]=='f' && yyextra->docBlockName==&yytext[1]) { BEGIN(CopyArgCommentLine); } @@ -6556,10 +6556,18 @@ NONLopt [^\n]* {CMD}("f$"|"f["|"f{"|"f(") { yyextra->docBlock << yytext; yyextra->docBlockName=&yytext[1]; + if (yyextra->docBlockName.at(1)=='[') + { + yyextra->docBlockName.at(1)=']'; + } if (yyextra->docBlockName.at(1)=='{') { yyextra->docBlockName.at(1)='}'; } + if (yyextra->docBlockName.at(1)=='(') + { + yyextra->docBlockName.at(1)=')'; + } yyextra->fencedSize=0; yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); @@ -6637,7 +6645,10 @@ NONLopt [^\n]* } [\\@]("f$"|"f]"|"f}"|"f)") { yyextra->docBlock << yytext; - BEGIN(DocBlock); + if (yyextra->docBlockName==&yytext[1]) + { + BEGIN(DocBlock); + } } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block yyextra->docBlock << yytext; -- cgit v0.12 From 4b18ac804b72a099ebeaee051da63f2826082237 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 15 May 2021 12:48:16 +0200 Subject: issue #8552 Javadoc: strange issue with @verbatim ... @endverbatim - Similar problems can occur with the `\startuml` and `msc` command. ``` /** * @startuml * {\f} @code * @enduml */ ``` - some further needed corrections (for lexcode) - `\endvhdlflow` does not exist --- src/commentscan.l | 2 +- src/lexcode.l | 24 +++++++++++++++++++++--- src/lexscanner.l | 11 +++++++++-- src/scanner.l | 20 ++++++++++++++++---- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 23a0471..2bc1b55 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1479,7 +1479,7 @@ STopt [^\n@\\]* /* ----- handle arguments of the preformatted block commands ------- */ -{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endmsc"|"endvhdlflow")/{NW} { // possible ends +{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endmsc")/{NW} { // possible ends addOutput(yyscanner,yytext); if (&yytext[4]==yyextra->blockName) // found end of the block { diff --git a/src/lexcode.l b/src/lexcode.l index 59b05b7..7400bc9 100644 --- a/src/lexcode.l +++ b/src/lexcode.l @@ -727,10 +727,18 @@ NONLopt [^\n]* {CMD}("f$"|"f["|"f{"|"f(") { yyextra->CCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; + if (yyextra->docBlockName.at(1)=='[') + { + yyextra->docBlockName.at(1)=']'; + } if (yyextra->docBlockName.at(1)=='{') { yyextra->docBlockName.at(1)='}'; } + if (yyextra->docBlockName.at(1)=='(') + { + yyextra->docBlockName.at(1)=')'; + } yyextra->fencedSize=0; yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); @@ -742,7 +750,14 @@ NONLopt [^\n]* yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } -{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) +{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim type command (which could contain nested comments!) + yyextra->CCodeBuffer += yytext; + yyextra->docBlockName="uml"; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; + BEGIN(DocCopyBlock); + } +{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) yyextra->CCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; yyextra->fencedSize=0; @@ -796,9 +811,12 @@ NONLopt [^\n]* } [\\@]("f$"|"f]"|"f}"|"f)") { yyextra->CCodeBuffer += yytext; - BEGIN(DocBlock); + if (yyextra->docBlockName==&yytext[1]) + { + BEGIN(DocBlock); + } } -[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block +[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block yyextra->CCodeBuffer += yytext; if (&yytext[4]==yyextra->docBlockName) { diff --git a/src/lexscanner.l b/src/lexscanner.l index 44219f3..b02bf8e 100644 --- a/src/lexscanner.l +++ b/src/lexscanner.l @@ -732,7 +732,14 @@ NONLopt [^\n]* yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } -{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) +{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim type command (which could contain nested comments!) + yyextra->cCodeBuffer += yytext; + yyextra->docBlockName="uml"; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; + BEGIN(DocCopyBlock); + } +{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) yyextra->cCodeBuffer += yytext; yyextra->docBlockName=&yytext[1]; yyextra->fencedSize=0; @@ -790,7 +797,7 @@ NONLopt [^\n]* BEGIN(DocBlock); } } -[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block +[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block yyextra->cCodeBuffer += yytext; if (yyextra->docBlockName==&yytext[4]) { diff --git a/src/scanner.l b/src/scanner.l index 3a927be..eee4252 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -4534,7 +4534,12 @@ NONLopt [^\n]* unput(yyextra->lastCopyArgChar); BEGIN( yyextra->lastCommentInArgContext ); } -{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) +{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim type command (which could contain nested comments!) + yyextra->docBlockName="uml"; + yyextra->fullArgString+=yytext; + BEGIN(CopyArgVerbatim); + } +{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) yyextra->docBlockName=&yytext[1]; yyextra->fullArgString+=yytext; BEGIN(CopyArgVerbatim); @@ -4556,7 +4561,7 @@ NONLopt [^\n]* yyextra->fullArgString+=yytext; BEGIN(CopyArgVerbatim); } -[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode"|"f$"|"f]"|"f}"|"f)")/[^a-z_A-Z0-9\-] { // end of verbatim block +[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"ebdmsc"|"enduml"|"endcode"|"f$"|"f]"|"f}"|"f)")/[^a-z_A-Z0-9\-] { // end of verbatim block yyextra->fullArgString+=yytext; if (yytext[1]=='f' && yyextra->docBlockName==&yytext[1]) { @@ -6579,7 +6584,14 @@ NONLopt [^\n]* yyextra->nestedComment=FALSE; BEGIN(DocCopyBlock); } -{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) +{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) + yyextra->docBlock << yytext; + yyextra->docBlockName="uml"; + yyextra->fencedSize=0; + yyextra->nestedComment=FALSE; + BEGIN(DocCopyBlock); + } +{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) yyextra->docBlock << yytext; yyextra->docBlockName=&yytext[1]; yyextra->fencedSize=0; @@ -6650,7 +6662,7 @@ NONLopt [^\n]* BEGIN(DocBlock); } } -[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block +[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block yyextra->docBlock << yytext; if (&yytext[4]==yyextra->docBlockName) { -- cgit v0.12