summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-08-03 17:39:47 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-08-03 17:39:47 (GMT)
commite61fc3cb3f777e48fbc6f95129b6a115819f260d (patch)
tree62867ea88fd5bc8eb41f55032b461888b0a43661 /src/util.cpp
parentf90a787e478c855beddcb3a626177fa11fb9244b (diff)
downloadDoxygen-e61fc3cb3f777e48fbc6f95129b6a115819f260d.zip
Doxygen-e61fc3cb3f777e48fbc6f95129b6a115819f260d.tar.gz
Doxygen-e61fc3cb3f777e48fbc6f95129b6a115819f260d.tar.bz2
Bug 704172 - Nested Aliases fail when the nested alias has two or more arguments.
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 735cc33..58214bd 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6973,6 +6973,34 @@ struct Marker
int size; // size of the marker
};
+/** For a string \a s that starts with a command name, returns the character
+ * offset within that string representing the first character after the
+ * command. For an alias with argument, this is the offset to the
+ * character just after the argument list.
+ *
+ * Examples:
+ * - s=="a b" returns 1
+ * - s=="a{2,3} b" returns 6
+ * = s=="#" returns 0
+ */
+static int findEndOfCommand(const char *s)
+{
+ const char *p = s;
+ char c;
+ int i=0;
+ if (p)
+ {
+ while ((c=*p) && isId(c)) p++;
+ if (c=='{')
+ {
+ QCString args = extractAliasArgs(p,0);
+ i+=args.length();
+ }
+ i+=p-s;
+ }
+ return i;
+}
+
/** Replaces the markers in an alias definition \a aliasValue
* with the corresponding values found in the comma separated argument
* list \a argList and the returns the result after recursive alias expansion.
@@ -6988,11 +7016,17 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString
int s=0;
for (i=0;i<l;i++)
{
- if (argList.at(i)==',' && (i==0 || argList.at(i-1)!='\\'))
+ char c = argList.at(i);
+ if (c==',' && (i==0 || argList.at(i-1)!='\\'))
{
args.append(new QCString(argList.mid(s,i-s)));
s=i+1; // start of next argument
}
+ else if (c=='@' || c=='\\')
+ {
+ // check if this is the start of another aliased command (see bug704172)
+ i+=findEndOfCommand(argList.data()+i+1);
+ }
}
if (l>s) args.append(new QCString(argList.right(l-s)));
//printf("found %d arguments\n",args.count());
@@ -7152,6 +7186,7 @@ static QCString expandAliasRec(const QCString s)
return result;
}
+
int countAliasArguments(const QCString argList)
{
int count=1;
@@ -7159,8 +7194,15 @@ int countAliasArguments(const QCString argList)
int i;
for (i=0;i<l;i++)
{
- if (argList.at(i)==',' && (i==0 || argList.at(i-1)!='\\')) count++;
+ char c = argList.at(i);
+ if (c==',' && (i==0 || argList.at(i-1)!='\\')) count++;
+ else if (c=='@' || c=='\\')
+ {
+ // check if this is the start of another aliased command (see bug704172)
+ i+=findEndOfCommand(argList.data()+i+1);
+ }
}
+ //printf("countAliasArguments=%d\n",count);
return count;
}