mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-11-08 17:51:58 +00:00
fix: Paste tokens in arguments of nested macros (#1062)
This commit is contained in:
2 files changed
+39
-1
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include "Parsing/Simple/SimpleExpressionInterpreter.h"
|
||||
#include "Utils/StringUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@@ -879,8 +880,25 @@ void DefinesStreamProxy::ExpandMacro(ParserLine& line,
|
||||
const Define* macro,
|
||||
const std::vector<std::string>& parameterValues)
|
||||
{
|
||||
std::vector<std::string> pastedValues;
|
||||
const auto* values = ¶meterValues;
|
||||
if (std::ranges::any_of(parameterValues,
|
||||
[](const std::string& value)
|
||||
{
|
||||
return value.find("##") != std::string::npos;
|
||||
}))
|
||||
{
|
||||
pastedValues = parameterValues;
|
||||
for (auto& value : pastedValues)
|
||||
{
|
||||
if (value.find("##") != std::string::npos)
|
||||
ProcessTokenPastingOperators(line, linePos, value);
|
||||
}
|
||||
values = &pastedValues;
|
||||
}
|
||||
|
||||
std::ostringstream rawOutput;
|
||||
InsertMacroParameters(rawOutput, macro, parameterValues);
|
||||
InsertMacroParameters(rawOutput, macro, *values);
|
||||
|
||||
std::string str = rawOutput.str();
|
||||
ProcessNestedMacros(line, linePos, callstack, str);
|
||||
|
||||
Reference in new issue
Block a user