AbstractMacroExpander: Allow escaping of %{Macros}

Use "%{}" to put a literal "%" into the output of the macro expander.
E.g. "%{}{Macro}" will be turned into "%{Macro}"

Change-Id: I592789e5cd8f2d52df424db679baf7ba04723202
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Tobias Hunger
2014-07-14 18:05:38 +02:00
parent 4114297992
commit 0ed377466c
2 changed files with 15 additions and 0 deletions

View File

@@ -126,6 +126,11 @@ int AbstractMacroExpander::findMacro(const QString &str, int *pos, QString *ret)
if (closePos < 0)
return 0;
int varLen = closePos - varPos;
if (varLen == 0) { // replace "%{}" with "%"
*pos = openPos;
*ret = QString(QLatin1Char('%'));
return 3;
}
if (resolveMacro(str.mid(varPos, varLen), ret)) {
*pos = openPos;
return varLen + 3;