Skip to content

Commit a2de89b

Browse files
committed
Properly handle digit separators while preprocessing
Fixes #153.
1 parent 62e5f01 commit a2de89b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libclang/preprocessor.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,17 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co
11261126
}
11271127
else if (in_string == false && starts_with(p, "'"))
11281128
{
1129+
if (in_char == false && p.ptr() != preprocessed.file.c_str()
1130+
&& std::isdigit(p.ptr()[-1]))
1131+
{
1132+
// It's a digit separator, not a char literal.
1133+
}
1134+
else
1135+
{
1136+
in_char.toggle();
1137+
}
1138+
11291139
p.bump();
1130-
in_char.toggle();
11311140
}
11321141
else if (in_string == true || in_char == true)
11331142
p.bump();

0 commit comments

Comments
 (0)