BUG: string expand swallowing '$(..)' construct

- this regression caused dynamic code with includes to fail since they
  often have -I$(LIB_SRC)/...  content
This commit is contained in:
Mark Olesen
2019-12-13 14:17:32 +01:00
parent 7aa2bf832f
commit 8ece5f7aae

View File

@ -537,7 +537,7 @@ static Foam::string recursiveExpand
}
else
{
// Perhaps received something like '$[ ]' ? - pass through
// Something like '$()', '$[]', etc - pass through
out += s[index]; // Append char
}
}
@ -654,8 +654,9 @@ static void expandString
s.replace(replaceBeg, varBeg - replaceBeg, varValue);
varBeg = replaceBeg+varValue.size();
}
else
else if (validVariableChar(s[varBeg+1]))
{
// A regular $var expansion without surrounding {}.
const auto varLen(findVariableLen(s, varBeg, sigil));
const word varName(s.substr(varBeg+1, varLen), false);
@ -674,6 +675,10 @@ static void expandString
s.replace(varBeg, varName.size()+1, varValue);
varBeg += varValue.size();
}
else
{
++varBeg;
}
}
else
{
@ -794,8 +799,8 @@ void Foam::stringOps::inplaceExpand
}
else if (varEnd == varBeg)
{
// Parsed '${}' or $badChar - skip over
varBeg = varEnd + 1;
// Something like '$()', '$[]', etc - pass through
++varBeg;
}
else
{