From e31d4c8092bcac54b4b820b9d995fce8cd5a78c5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Fri, 16 Oct 2020 20:31:03 +0200 Subject: issue #8098: Python Decorator written below @brief tag and above the function leads to documentation error --- src/pycode.l | 7 +++++++ src/pyscanner.l | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/pycode.l b/src/pycode.l index ea314da..cc00447 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -168,6 +168,8 @@ EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-] NONEMPTYEXP [^ \t\n:] PARAMNONEMPTY [^ \t\n():] IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")* +SCOPE {IDENTIFIER}("."{IDENTIFIER})* +CALLANY "("[^)]*")" BORDER ([^A-Za-z0-9]) POUNDCOMMENT "##" @@ -341,6 +343,11 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU codify(yyscanner,"cls."); findMemberLink(yyscanner,*yyextra->code,&yytext[4]); } + "@"{SCOPE}{CALLANY}? { // decorator + startFontClass(yyscanner,"preprocessor"); + codify(yyscanner,yytext); + endFontClass(yyscanner); + } } {IDENTIFIER} { diff --git a/src/pyscanner.l b/src/pyscanner.l index a136b52..4a9552e 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -113,6 +113,7 @@ struct pyscannerYY_state int search_count = 0; QCString argType; bool funcParamsEnd = FALSE; + std::vector decorators; }; //----------------------------------------------------------------------------- @@ -175,6 +176,7 @@ NONEMPTYEXP [^ \t\n:] PARAMNONEMPTY [^ \t\n():] IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")* SCOPE {IDENTIFIER}("."{IDENTIFIER})* +CALL "("[^)]*")" BORDER ([^A-Za-z0-9]) TRISINGLEQUOTE {STRINGPREFIX}?"'''"(!)? @@ -335,6 +337,8 @@ STARTDOCSYMS "##" "@staticmethod" { yyextra->stat=TRUE; } + "@"{SCOPE}{CALL}? { // decorator + } {SCRIPTCOMMENT} { // Unix type script comment if (yyextra->yyLineNr != 1) REJECT; } -- cgit v0.12