From 2340c1e7230b2d83ec34cb6a6a21c47b180d8a51 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 28 Jul 2020 10:21:01 +0200 Subject: More \ilinebr related cleanup and combined some rules --- src/commentscan.l | 1 - src/doctokenizer.l | 48 +++++++++++++++++++----------------------------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 763a2dd..5c49323 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -119,7 +119,6 @@ static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringList &); -static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handlePrivate(yyscan_t yyscanner,const QCString &, const QCStringList &); diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 0b14613..b1ccd23 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -810,9 +810,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->name = g_token->name.mid(i+1,g_token->name.length()-i-2); BEGIN(St_Code); } +"\\ilinebr" | \n | . { - unput(*yytext); + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); BEGIN(St_Code); } {WS}*{CMD}"endcode" { @@ -834,6 +835,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} unput(*yytext); BEGIN(St_HtmlOnly); } +"\\ilinebr" { + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); + BEGIN(St_HtmlOnly); + } {CMD}"endhtmlonly" { return RetVal_OK; } @@ -925,10 +930,15 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->sectionId = QCString(yytext).stripWhiteSpace(); return RetVal_OK; } +{BLANK}*{FILEMASK}{BLANK}*/"\\linebr" { // case 5: plain file name specified without title or attributes + g_token->sectionId = QCString(yytext).stripWhiteSpace(); + return RetVal_OK; + } +"\\ilinebr" | "\n" | . { g_token->sectionId = ""; - unput(*yytext); + for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return RetVal_OK; } {CMD}"enduml" { @@ -990,11 +1000,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->chars=yytext; return TK_WHITESPACE; } -\n { /* new line => end of title */ - unput(*yytext); - return 0; - } -"\\ilinebr" { +(\n|"\\ilinebr") { /* new line => end of title */ for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } @@ -1021,11 +1027,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} BEGIN(St_TitleA); return 0; } -\n { /* new line => end of title */ - unput(*yytext); - return 0; - } -"\\ilinebr" { +(\n|"\\ilinebr") { /* new line => end of title */ for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } @@ -1043,11 +1045,7 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} unput(*yytext); return 0; } -\n { - unput(*yytext); - return 0; - } -"\\ilinebr" { +(\n|"\\ilinebr") { for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; } @@ -1076,14 +1074,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} unput(' '); return 0; } -\n { // new line - unput(*yytext); - return 0; - } -"\\ilinebr" { +(\n|"\\ilinebr") { // new line for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; - } + } . { // any other character unput(*yytext); return 0; @@ -1107,14 +1101,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} {WS}+"\""{WS}* { // white space following by quoted string BEGIN(St_Ref2); } -\n { // new line - unput(*yytext); - return 0; - } -"\\ilinebr" { +(\n|"\\ilinebr") { // new line for (int i=yyleng-1;i>=0;i--) unput(yytext[i]); return 0; - } + } . { // any other character unput(*yytext); return 0; -- cgit v0.12