Bugfix/escaped character parsing (#32)

So as it turns out there's a nasty little piece of code in rapidjson's
source which breaks the preprocessor and will leave things a little bit
weird.

The test "preprocessor_parses_escaped_character" should prove
its validity.
This commit is contained in:
Zsolt Erhardt 2018-01-22 11:18:38 +01:00 committed by Jonathan Müller
commit ca2fae08a2
3 changed files with 41 additions and 5 deletions

View file

@ -740,11 +740,7 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co
if (next && next > p.ptr())
p.bump(std::size_t(next - p.ptr() - 1)); // subtract one to get before that character
if (starts_with(p, "\\\"")) // starts with \"
p.bump(2u);
else if (starts_with(p, "\\'")) // starts with \'
p.bump(2u);
else if (in_char == false && starts_with(p, "\"")) // starts with "
if (in_char == false && starts_with(p, "\"")) // starts with "
{
p.bump();
in_string.toggle();
@ -756,6 +752,10 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co
}
else if (in_string == true || in_char == true)
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))
{
if (logger.is_verbose())