Skip to content

Commit c0e66c4

Browse files
committed
Multiple parameters with underscores and one \param command
When having a function like: ``` /// the text /// \param __a__, __b__ b_fie void b_fie(int __a__, int __b__); ``` we get warnings like: ``` .../bb.h:3: warning: argument 'strong' of command @param is not found in the argument list of b_fie(int __a__, int __b__) .../bb.h:3: warning: argument 'b' of command @param is not found in the argument list of b_fie(int __a__, int __b__) .../bb.h:3: warning: argument 'strong' of command @param is not found in the argument list of b_fie(int __a__, int __b__) .../bb.h:3: warning: The following parameter of b_fie(int __a__, int __b__) is not documented: parameter '__b__' ``` Actually this is a follow up on #6128 (Usage of underscore's in parameter names (Origin: bugzilla 775493))
1 parent 8342610 commit c0e66c4

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/markdown.cpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,33 @@ size_t Markdown::Private::isSpecialCommand(std::string_view data,size_t offset)
458458
return 0;
459459
};
460460

461+
static const auto endOfLabel2 = [](std::string_view data_,size_t offset_) -> size_t
462+
{
463+
if (offset_<data_.size() && data_[offset_]==' ') // we expect a space before the label
464+
{
465+
char c = 0;
466+
offset_++;
467+
while (true)
468+
{
469+
// skip over spaces
470+
while (offset_<data_.size() && data_[offset_]==' ') offset_++;
471+
// skip over label
472+
while (offset_<data_.size() && (c=data_[offset_])!=' ' && c!=',' && c!='\\' && c!='@' && c!='\n') offset_++;
473+
if (offset_<data_.size() && (data_[offset_]==',' || data_[offset_]==' '))
474+
{
475+
size_t offset1 = offset_;
476+
while (offset1<data_.size() && data_[offset1]==' ') offset1++;
477+
if (offset1<data_.size() && data_[offset1]==',') offset1++;
478+
else break;
479+
offset_ = offset1;
480+
}
481+
else break;
482+
};
483+
return offset_;
484+
}
485+
return 0;
486+
};
487+
461488
static const auto endOfLabelOpt = [](std::string_view data_,size_t offset_) -> size_t
462489
{
463490
size_t index=offset_;
@@ -493,7 +520,7 @@ size_t Markdown::Private::isSpecialCommand(std::string_view data,size_t offset)
493520
if (index==data_.size() || data_[index]!=']') return 0; // invalid parameter
494521
offset_=index+1; // part after [...] is the parameter name
495522
}
496-
return endOfLabel(data_,offset_);
523+
return endOfLabel2(data_,offset_);
497524
};
498525

499526
static const auto endOfFuncLike = [](std::string_view data_,size_t offset_,bool allowSpaces) -> size_t
@@ -604,7 +631,7 @@ size_t Markdown::Private::isSpecialCommand(std::string_view data,size_t offset)
604631
{ "relatedalso", endOfLabel },
605632
{ "relates", endOfLabel },
606633
{ "relatesalso", endOfLabel },
607-
{ "retval", endOfLabel },
634+
{ "retval", endOfLabel2},
608635
{ "rtfinclude", endOfLine },
609636
{ "section", endOfLabel },
610637
{ "skip", endOfLine },

0 commit comments

Comments
 (0)