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