Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-patch] Syntax highlighting of preprocessor directives - improvements

> 
>         Hello!
>     
>     I've been playing around with CDT, and found a minor problem with syntax
> highlighting of preprocessor directives: it 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
>  
>     Feeling that this is my opportunity to contribute ;)) 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.
>  
>                      /Vic
>  

Almost missed this.  Thought you were an IBM'er.
Ok, we'll take a look a bit later.
Meanwhile, if you could put fill a Bugzilla PR that
would be fantastic so we could also move your fix to the branch.

Thanks.




Back to the top