Bug 38405 - Problem with syntax highlighting of preprocessor directives
Summary: Problem with syntax highlighting of preprocessor directives
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 1.2   Edit
Assignee: Alain Magloire CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2003-06-04 06:50 EDT by Victor Mozgin CLA
Modified: 2009-01-09 14:53 EST (History)
0 users

See Also:


Attachments
Patch (12.19 KB, patch)
2003-06-04 06:54 EDT, Victor Mozgin CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Mozgin CLA 2003-06-04 06:50:01 EDT
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.
Comment 1 Victor Mozgin CLA 2003-06-04 06:54:25 EDT
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.
Comment 2 Alain Magloire CLA 2003-06-04 15:43:26 EDT
Patch applied.
status flip to Fixed