From 4fbe0ad60921724faf6ba635df13983b3496f3e9 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 28 Jul 2020 09:51:41 +0200 Subject: More improvement regarding \\ilinebr handling - White space around \\ilinebr is not preserved in commentscan - Cases where \n was unput in doctokenizer are now handled in the same way for \\ilinebr --- src/commentscan.l | 14 +++++--------- src/doctokenizer.l | 6 ++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 3d0ca69..763a2dd 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -163,7 +163,6 @@ struct DocCmdMap static const std::map< std::string, DocCmdMap > docCmdMap = { // command name handler function command spacing - { "ilinebr", { &handleLineBr, CommandSpacing::Inline }}, { "addindex", { &handleAddIndex, CommandSpacing::Invisible }}, { "addtogroup", { &handleAddToGroup, CommandSpacing::Invisible }}, { "anchor", { &handleAnchor, CommandSpacing::Invisible }}, @@ -646,6 +645,9 @@ RCSTAG "$"{ID}":"[^\n$]+"$" ); yyextra->inInternalDocs = FALSE; } +{B}*"\\ilinebr"{B}* { // preserve spacing around \\ilinebr + addOutput(yyscanner,yytext); + } {B}*{CMD}[a-z_A-Z]+"{"[a-zA-Z_,:0-9\. ]*"}"{B}* | {B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command // the {B}* in the front was added for bug620924 @@ -663,8 +665,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" else // options present { cmdName = fullMatch.left(idx).stripWhiteSpace().data()+1; // to remove {CMD} - QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); - optList = QCStringList::split(',',optStr); + QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); + optList = QCStringList::split(',',optStr); } auto it = docCmdMap.find(cmdName.data()); if (it!=docCmdMap.end()) // special action is required @@ -2538,12 +2540,6 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi return FALSE; } -static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &) -{ - addOutput(yyscanner,"\\ilinebr "); - return FALSE; -} - static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 51d234b..0b14613 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -955,6 +955,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } "&"{ID}";" { /* symbol */ @@ -994,6 +995,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } "&"{ID}";" { /* symbol */ @@ -1024,6 +1026,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } {BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute @@ -1045,6 +1048,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } @@ -1077,6 +1081,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } . { // any other character @@ -1107,6 +1112,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} return 0; } "\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } . { // any other character -- cgit v0.12