mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Make comment removing preprocessor not recognize comments when inside a string
This commit is contained in:
parent
8a227d1171
commit
cff70daccb
@ -17,7 +17,9 @@ ParserLine CommentRemovingStreamProxy::NextLine()
|
|||||||
return ParserLine(line.m_filename, line.m_line_number, std::string());
|
return ParserLine(line.m_filename, line.m_line_number, std::string());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned multiLineCommentStart = 0;
|
auto multiLineCommentStart = 0u;
|
||||||
|
auto inString = false;
|
||||||
|
auto isEscaped = false;
|
||||||
for (auto i = 0u; i < line.m_line.size(); i++)
|
for (auto i = 0u; i < line.m_line.size(); i++)
|
||||||
{
|
{
|
||||||
const auto c = line.m_line[i];
|
const auto c = line.m_line[i];
|
||||||
@ -31,9 +33,22 @@ ParserLine CommentRemovingStreamProxy::NextLine()
|
|||||||
m_inside_multi_line_comment = false;
|
m_inside_multi_line_comment = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(inString)
|
||||||
|
{
|
||||||
|
if (isEscaped)
|
||||||
|
isEscaped = false;
|
||||||
|
else if (c == '\\')
|
||||||
|
isEscaped = true;
|
||||||
|
else if (c == '"')
|
||||||
|
inString = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(c == '/' && i + 1 < line.m_line.size())
|
if(c == '"')
|
||||||
|
{
|
||||||
|
inString = true;
|
||||||
|
}
|
||||||
|
else if(c == '/' && i + 1 < line.m_line.size())
|
||||||
{
|
{
|
||||||
const auto c1 = line.m_line[i + 1];
|
const auto c1 = line.m_line[i + 1];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user