Commit 2da9dcc7 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 711378 - Nested Aliases fail when the nested alias has two or more arguments.

parent 182bd7cd
...@@ -7014,7 +7014,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md, ...@@ -7014,7 +7014,7 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md,
static QDict<void> aliasesProcessed; static QDict<void> aliasesProcessed;
static QCString expandAliasRec(const QCString s); static QCString expandAliasRec(const QCString s,bool allowRecursion=FALSE);
struct Marker struct Marker
{ {
...@@ -7136,7 +7136,7 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString ...@@ -7136,7 +7136,7 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString
//printf("part before marker %d: '%s'\n",i,aliasValue.mid(p,m->pos-p).data()); //printf("part before marker %d: '%s'\n",i,aliasValue.mid(p,m->pos-p).data());
if (m->number>0 && m->number<=(int)args.count()) // valid number if (m->number>0 && m->number<=(int)args.count()) // valid number
{ {
result+=*args.at(m->number-1); result+=expandAliasRec(*args.at(m->number-1),TRUE);
//printf("marker index=%d pos=%d number=%d size=%d replacement %s\n",i,m->pos,m->number,m->size, //printf("marker index=%d pos=%d number=%d size=%d replacement %s\n",i,m->pos,m->number,m->size,
// args.at(m->number-1)->data()); // args.at(m->number-1)->data());
} }
...@@ -7175,7 +7175,7 @@ static QCString escapeCommas(const QCString &s) ...@@ -7175,7 +7175,7 @@ static QCString escapeCommas(const QCString &s)
return result.data(); return result.data();
} }
static QCString expandAliasRec(const QCString s) static QCString expandAliasRec(const QCString s,bool allowRecursion)
{ {
QCString result; QCString result;
static QRegExp cmdPat("[\\\\@][a-z_A-Z][a-z_A-Z0-9]*"); static QRegExp cmdPat("[\\\\@][a-z_A-Z][a-z_A-Z0-9]*");
...@@ -7208,10 +7208,10 @@ static QCString expandAliasRec(const QCString s) ...@@ -7208,10 +7208,10 @@ static QCString expandAliasRec(const QCString s)
} }
//printf("Found command s='%s' cmd='%s' numArgs=%d args='%s' aliasText=%s\n", //printf("Found command s='%s' cmd='%s' numArgs=%d args='%s' aliasText=%s\n",
// s.data(),cmd.data(),numArgs,args.data(),aliasText?aliasText->data():"<none>"); // s.data(),cmd.data(),numArgs,args.data(),aliasText?aliasText->data():"<none>");
if (aliasesProcessed.find(cmd)==0 && aliasText) // expand the alias if ((allowRecursion || aliasesProcessed.find(cmd)==0) && aliasText) // expand the alias
{ {
//printf("is an alias!\n"); //printf("is an alias!\n");
aliasesProcessed.insert(cmd,(void *)0x8); if (!allowRecursion) aliasesProcessed.insert(cmd,(void *)0x8);
QCString val = *aliasText; QCString val = *aliasText;
if (hasArgs) if (hasArgs)
{ {
...@@ -7220,7 +7220,7 @@ static QCString expandAliasRec(const QCString s) ...@@ -7220,7 +7220,7 @@ static QCString expandAliasRec(const QCString s)
// aliasText->data(),val.data(),args.data()); // aliasText->data(),val.data(),args.data());
} }
result+=expandAliasRec(val); result+=expandAliasRec(val);
aliasesProcessed.remove(cmd); if (!allowRecursion) aliasesProcessed.remove(cmd);
p=i+l; p=i+l;
if (hasArgs) p+=argsLen+2; if (hasArgs) p+=argsLen+2;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment