User forums > General (but related to Code::Blocks)
Standard Header Highlighting
thomas:
--- Quote ---So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.
--- End quote ---
No way, sorry.
--- Quote ---Roman: instead of hardcoding a list, how about automatically changing to the C/C++ lexer (or the currently active lexer) if you follow a #include? that should be easy to implement
--- End quote ---
That would break languages with similar/identical preprocessor syntax. Two such examples are Cg and Objective-C (there are probably more).
dmoore:
--- Quote from: thomas on August 07, 2007, 01:17:39 pm ---
--- Quote ---Roman: instead of hardcoding a list, how about automatically changing to the C/C++ lexer (or the currently active lexer) if you follow a #include? that should be easy to implement
--- End quote ---
That would break languages with similar/identical preprocessor syntax. Two such examples are Cg and Objective-C (there are probably more).
--- End quote ---
note the alternative:
--- Quote ---(or the currently active lexer)
--- End quote ---
surely this won't break unless a language can #include code written in another language, or a language uses a different lexer for its #includes?
Biplab:
--- Quote from: thomas on August 07, 2007, 01:17:39 pm ---
--- Quote ---So my suggestion is to 'hardcode' the names of new style standard C++ library header files so they will be highlighted as C++ by default.
--- End quote ---
No way, sorry.
--- End quote ---
I do have the same opinion as of Thomas.
One way to identify is to read the file for some embedded highlighting tags. E.g., iostream begins with the following line-
--- Quote ---// Standard iostream objects -*- C++ -*-
--- End quote ---
which indicates that it's a C++ file. But this behavior is not uniform and MS supplied headers doesn't have these identifiers. :)
dmoore:
i still don't see what is wrong with assuming the same lexer as the file they are linking from. what am i missing?
Roman:
--- Quote from: dmoore on August 07, 2007, 03:54:36 pm ---i still don't see what is wrong with assuming the same lexer as the file they are linking from. what am i missing?
--- End quote ---
I'm missing it too )
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version