tylerlong / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

C/C++ preprocessor directives are not distinguished from comments #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Both preprocessor directives (#define/#include/etc) and comments are marked
with class="com" (comment). For an example, see:
http://code.google.com/p/inih/source/browse/trunk/ini.c (preprocessor
directives and comments are both red)

Not a "big issue", but this means you can't visually distinguish between
the two, which is especially important when you're using macros a lot, for
example: http://blog.brush.co.nz/2009/08/xmacros/

See also prog.reddit comment where this was noted:
http://www.reddit.com/r/programming/comments/9dqpy/dry_code_with_xmacros_a_littl
eknown_c_technique/c0cdp8n

Original issue reported on code.google.com by benh...@gmail.com on 25 Aug 2009 at 1:16

GoogleCodeExporter commented 9 years ago
Is there a list of preprocessor directives somewhere?
I could start with the usual suspects
  #include
  #define
  #ifdef
  #ifndef
  #elif
  #else
  #endif
  #pragma

Original comment by mikesamuel@gmail.com on 3 Oct 2009 at 7:49

GoogleCodeExporter commented 9 years ago
Yeah, those are the main ones -- here is a list from the gcc docs: 
http://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives

Looks like the only other relevant ones are #line, #error and #warning. I've 
never seen 
the others used, and most of them are non-standard anyway.

Original comment by benh...@gmail.com on 4 Oct 2009 at 12:40

GoogleCodeExporter commented 9 years ago
Fixed.  At http://code.google.com/p/google-code-prettify/source/detail?r=85

Original comment by mikesamuel@gmail.com on 5 Oct 2009 at 5:00

GoogleCodeExporter commented 9 years ago
The latest download still puts the style "com" despite the explicit parsing for 
preprocessor directives. In two lines, I could fix this to put in a different 
class. I chose "ppr". Still, I'd rather not maintain a fork.

Original comment by tjpal...@gmail.com on 11 Jan 2011 at 7:50