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