mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Fix define directive not accepting define names with digits in them
This commit is contained in:
parent
e685348abd
commit
b25d64e5e7
@ -51,7 +51,7 @@ bool AbstractDirectiveStreamProxy::ExtractIdentifier(const ParserLine& line, uns
|
|||||||
const auto c = line.m_line[position];
|
const auto c = line.m_line[position];
|
||||||
if (isalpha(c)
|
if (isalpha(c)
|
||||||
|| c == '_'
|
|| c == '_'
|
||||||
|| firstChar && isdigit(c))
|
|| !firstChar && isdigit(c))
|
||||||
{
|
{
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
|
@ -338,4 +338,21 @@ namespace test::parsing::impl::defines_stream_proxy
|
|||||||
|
|
||||||
REQUIRE(proxy.Eof());
|
REQUIRE(proxy.Eof());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("DefinesStreamProxy: Ensure can define name with underscores and digits", "[parsing][parsingstream]")
|
||||||
|
{
|
||||||
|
const std::vector<std::string> lines
|
||||||
|
{
|
||||||
|
"#define __int16 short",
|
||||||
|
"unsigned __int16 value;"
|
||||||
|
};
|
||||||
|
|
||||||
|
MockParserLineStream mockStream(lines);
|
||||||
|
DefinesStreamProxy proxy(&mockStream);
|
||||||
|
|
||||||
|
ExpectLine(&proxy, 1, "");
|
||||||
|
ExpectLine(&proxy, 2, "unsigned short value;");
|
||||||
|
|
||||||
|
REQUIRE(proxy.Eof());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user