summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2011-10-04 19:08:34 +0000
committerMaxime Coste <frrrwww@gmail.com>2011-10-04 19:08:34 +0000
commitf4743e08bd14c8bfdd4178f35adb3c9216beee4e (patch)
tree4c0f18517d75ccf6a534676f31193d21681e7f47 /src
parentc8cf7bbaa9c6ee1ef312ddebb407f8bb13683210 (diff)
Filters: tweaks colorize_cplusplus
Diffstat (limited to 'src')
-rw-r--r--src/filters.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 6a7d0113..e32950b3 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -30,23 +30,26 @@ void colorize_cplusplus(DisplayBuffer& display_buffer)
static boost::regex preprocessor("(?<=\\n)\\h*#\\h*[^\\n]*(?=\\n)");
colorize_regex(display_buffer, preprocessor, Color::Magenta);
- static boost::regex strings("\"(\\\\\"|[^\"])*\"");
+ static boost::regex comments("//[^\\n]*\\n");
+ colorize_regex(display_buffer, comments, Color::Cyan);
+
+ static boost::regex strings("(?<!')\"(\\\\\"|[^\"])*\"");
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);
static boost::regex builtin_types("\\<(void|int|float|bool|size_t)\\>");
colorize_regex(display_buffer, builtin_types, Color::Yellow);
- static boost::regex control_keywords("\\<(while|for|if|else|do|switch|case|default|goto|return|using|try|catch|throw)\\>");
+ static boost::regex control_keywords("\\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw)\\>");
colorize_regex(display_buffer, control_keywords, Color::Blue);
+ //static boost::regex operators("->|\\+|\\-|\\*|/|\\\\|\\&|\\|\\^|[<>=!+-]=|=|\\(|\\)|\\[|\\]|\\{|\\}|\\<(not|and|or|xor)\\>");
+ //colorize_regex(display_buffer, operators, Color::Green);
+
static boost::regex types_keywords("\\<(const|auto|namespace|static|volatile|class|struct|enum|union|public|protected|private)\\>");
colorize_regex(display_buffer, types_keywords, Color::Green);
-
- static boost::regex comments("//[^\\n]*\\n");
- colorize_regex(display_buffer, comments, Color::Cyan);
}
}