mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Make defines stream proxy able to accept comma within parameter values that are in parenthesis
This commit is contained in:
parent
f5ed7880b0
commit
4b7a78100d
@ -513,12 +513,20 @@ void DefinesStreamProxy::ExtractParametersFromDefineUsage(const ParserLine& line
|
||||
const auto c = line.m_line[pos];
|
||||
|
||||
if (c == ',')
|
||||
{
|
||||
if (parenthesisDepth > 0)
|
||||
{
|
||||
valueHasStarted = true;
|
||||
currentValue << c;
|
||||
}
|
||||
else
|
||||
{
|
||||
parameterValues.emplace_back(currentValue.str());
|
||||
currentValue.clear();
|
||||
currentValue.str(std::string());
|
||||
valueHasStarted = false;
|
||||
}
|
||||
}
|
||||
else if(c == '(')
|
||||
{
|
||||
valueHasStarted = true;
|
||||
|
@ -705,6 +705,23 @@ namespace test::parsing::impl::defines_stream_proxy
|
||||
REQUIRE(proxy.Eof());
|
||||
}
|
||||
|
||||
TEST_CASE("DefinesStreamProxy: Ensure can use comma in parenthesis in parameters values", "[parsing][parsingstream]")
|
||||
{
|
||||
const std::vector<std::string> lines
|
||||
{
|
||||
"#define someStuff(param1) Hello param1 World",
|
||||
"someStuff(A sentence with (parenthesis and a , character) and stuff)"
|
||||
};
|
||||
|
||||
MockParserLineStream mockStream(lines);
|
||||
DefinesStreamProxy proxy(&mockStream);
|
||||
|
||||
ExpectLine(&proxy, 1, "");
|
||||
ExpectLine(&proxy, 2, "Hello A sentence with (parenthesis and a , character) and stuff World");
|
||||
|
||||
REQUIRE(proxy.Eof());
|
||||
}
|
||||
|
||||
TEST_CASE("DefinesStreamProxy: Ensure defines can go over multiple lines", "[parsing][parsingstream]")
|
||||
{
|
||||
const std::vector<std::string> lines
|
||||
|
Loading…
x
Reference in New Issue
Block a user