Improve fix #32
This commit is contained in:
parent
ca2fae08a2
commit
bca488c3d7
1 changed files with 8 additions and 6 deletions
|
|
@ -736,11 +736,17 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co
|
||||||
ts::flag in_string(false), in_char(false);
|
ts::flag in_string(false), in_char(false);
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
auto next = std::strpbrk(p.ptr(), "\"'#/"); // look for ", ', # or /
|
auto next = std::strpbrk(p.ptr(), R"(\"'#/)"); // look for \, ", ', # or /
|
||||||
if (next && next > p.ptr())
|
if (next && next > p.ptr())
|
||||||
p.bump(std::size_t(next - p.ptr() - 1)); // subtract one to get before that character
|
p.bump(std::size_t(next - p.ptr() - 1)); // subtract one to get before that character
|
||||||
|
|
||||||
if (in_char == false && starts_with(p, "\"")) // starts with "
|
if (starts_with(p, R"(\\)")) // starts with two backslashes
|
||||||
|
p.bump(2u);
|
||||||
|
else if (starts_with(p, R"(\")")) // starts with \"
|
||||||
|
p.bump(2u);
|
||||||
|
else if (starts_with(p, R"(\')")) // starts with \'
|
||||||
|
p.bump(2u);
|
||||||
|
else if (in_char == false && starts_with(p, R"(")")) // starts with "
|
||||||
{
|
{
|
||||||
p.bump();
|
p.bump();
|
||||||
in_string.toggle();
|
in_string.toggle();
|
||||||
|
|
@ -752,10 +758,6 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co
|
||||||
}
|
}
|
||||||
else if (in_string == true || in_char == true)
|
else if (in_string == true || in_char == true)
|
||||||
p.bump();
|
p.bump();
|
||||||
else if (starts_with(p, "\\\"")) // starts with \"
|
|
||||||
p.bump(2u);
|
|
||||||
else if (starts_with(p, "\\'")) // starts with \'
|
|
||||||
p.bump(2u);
|
|
||||||
else if (auto macro = parse_macro(p, result, file_depth == 0u))
|
else if (auto macro = parse_macro(p, result, file_depth == 0u))
|
||||||
{
|
{
|
||||||
if (logger.is_verbose())
|
if (logger.is_verbose())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue