Filters: tweak colorize_cplusplus

This commit is contained in:
Maxime Coste 2011-10-07 14:28:38 +00:00
parent 868a2f8107
commit afd1ae5458

View File

@ -27,7 +27,7 @@ void colorize_regex(DisplayBuffer& display_buffer,
void colorize_cplusplus(DisplayBuffer& display_buffer) void colorize_cplusplus(DisplayBuffer& display_buffer)
{ {
static boost::regex preprocessor("(?<=\\n)\\h*#\\h*[^\\n]*(?=\\n)"); static boost::regex preprocessor("(\\`|(?<=\\n))\\h*#\\h*[^\\n]*(?=\\n)");
colorize_regex(display_buffer, preprocessor, Color::Magenta); colorize_regex(display_buffer, preprocessor, Color::Magenta);
static boost::regex comments("//[^\\n]*\\n"); static boost::regex comments("//[^\\n]*\\n");
@ -36,7 +36,7 @@ void colorize_cplusplus(DisplayBuffer& display_buffer)
static boost::regex strings("(?<!')\"(\\\\\"|[^\"])*\""); static boost::regex strings("(?<!')\"(\\\\\"|[^\"])*\"");
colorize_regex(display_buffer, strings, Color::Magenta); colorize_regex(display_buffer, strings, Color::Magenta);
static boost::regex values("\\<(true|false|NULL|nullptr)\\>|-?\\d+[fdiu]?|'[^']?'"); static boost::regex values("\\<(true|false|NULL|nullptr)\\>|-?\\d+[fdiu]?|'\\\\?[^']?'");
colorize_regex(display_buffer, values, Color::Red); colorize_regex(display_buffer, values, Color::Red);
static boost::regex builtin_types("\\<(void|int|float|bool|size_t)\\>"); static boost::regex builtin_types("\\<(void|int|float|bool|size_t)\\>");