Menu

Preprocessor Highlighting (C++)

2008-03-21
2012-11-13
  • Nobody/Anonymous

    How can I highlight preprocessor directives only? I mean, not whole line, i.e. preprocessor directive is highlighted in its color, and the rest tokens in the line are highlighted in their own colors.

    Is that possible?

    Thanks in advance,
    Alexander

     
    • Nobody/Anonymous

      Perhaps by changing the settings in the Styler Configurator to default for "unwanted" styles?

      Menu____ : Settings
      Option__ : Styler Configurator...
      Language : C++
      Style___ : all styles except PREPROCESSOR

      Change the Colour and Font styles to your liking.

      Perhaps the easiest way to achieve what you want is making a copy of the C++ language definition and removing all those styles, or create a User Defined Language with only the things you want highlighted.

       
      • Nobody/Anonymous

        Unfortunately, setting all styles except PREPROCESSOR to default doesn't work.

        To use a User Defined Language regexps are needed: C directives could be "#define" or "# define" and "#" must be the first non-space character in the line.

         
        • Nobody/Anonymous

          Perhaps you could define a comment (symbol or string) to show the part after the directive in another color.

           
MongoDB Logo MongoDB