Community
Participate
Working Groups
Syntax highlighting of preprocessor directives doesn't handle whitespaces around # sign (internal parser seems to work fine, though). And some people write conditional code like this: #ifdef blabla # define A #endif or #ifdef blabla #define A #endif In these examples, second #define is not highlighted in C/C++ editors.
Created attachment 5053 [details] Patch I've patched UI code to add a new rule for handling preprocessor directives, PreprocessorRule class (extends WordRule). And here I noticed that CppCodeScanner uses private class CWordRule, while CCodeScanner uses standard WordRule. They seem to do exactly the same thing, but CWordRule additionally checks for # sign to be the first character on the line. As now preprocessor directives are handled by PreprocessorRule class, CWordRule can be removed and replaced with WordRule; also, there is no need for CWordDetector to pick up # sign as a valid word start.
Patch applied. status flip to Fixed