From c10af45c61a1f9b25c514f397ace16c94cc7c8df Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 8 Jan 2017 10:22:40 +0100 Subject: Bug 775493 - Usage of underscore's in parameter names --- src/commentscan.l | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index fad09d9..f26cabd 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -125,6 +125,8 @@ static bool handleCopyBrief(const QCString &); static bool handleCopyDetails(const QCString &); static bool handleParBlock(const QCString &); static bool handleEndParBlock(const QCString &); +static bool handleParam(const QCString &); +static bool handleRetval(const QCString &); typedef bool (*DocCmdFunc)(const QCString &name); @@ -247,7 +249,7 @@ static DocCmdMap docCmdMap[] = { "line", 0, TRUE }, { "note", 0, TRUE }, { "par", 0, TRUE }, - { "param", 0, TRUE }, + { "param", &handleParam, TRUE }, { "tparam", 0, TRUE }, { "post", 0, TRUE }, { "pre", 0, TRUE }, @@ -257,7 +259,7 @@ static DocCmdMap docCmdMap[] = { "return", 0, TRUE }, { "returns", 0, TRUE }, { "exception", 0, TRUE }, - { "retval", 0, TRUE }, + { "retval", &handleRetval, TRUE }, { "sa", 0, TRUE }, { "see", 0, TRUE }, { "since", 0, TRUE }, @@ -971,6 +973,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" %x XRefItemParam2 %x XRefItemParam3 %x FileDocArg1 +%x ParamArg1 %x EnumDocArg1 %x NameSpaceDocArg1 %x PackageDocArg1 @@ -1564,6 +1567,30 @@ RCSTAG "$"{ID}":"[^\n$]+"$" BEGIN( Comment ); } + /* --------- handle arguments of the param command ------------ */ +{ID}/{B}*"," { + if (yytext[0]=='_' && Config_getBool(MARKDOWN_SUPPORT)) + { + addOutput('\\'); + } + addOutput(yytext); + } +"," { + addOutput(" , "); + } +{ID} { + if (yytext[0]=='_' && Config_getBool(MARKDOWN_SUPPORT)) + { + addOutput('\\'); + } + addOutput(yytext); + BEGIN( Comment ); + } +. { + unput(yytext[0]); + BEGIN( Comment ); + } + /* --------- handle arguments of the file/dir/example command ------------ */ {DOCNL} { // no file name specfied @@ -2400,6 +2427,22 @@ static bool handleFile(const QCString &) return stop; } +static bool handleParam(const QCString &) +{ + // we need process param and retval arguments to escape leading underscores in case of + // markdown processing, see bug775493 + addOutput("@param "); + BEGIN( ParamArg1 ); + return FALSE; +} + +static bool handleRetval(const QCString &) +{ + addOutput("@retval "); + BEGIN( ParamArg1 ); + return FALSE; +} + static bool handleDir(const QCString &) { bool stop=makeStructuralIndicator(Entry::DIRDOC_SEC); -- cgit v0.12