Author Topic: Lexer for C only?  (Read 35894 times)

Offline omnishambles

  • Multiple posting newcomer
  • *
  • Posts: 12
Lexer for C only?
« on: July 30, 2020, 07:40:26 pm »
Hi,

When I saw some variables in C code like 'class' get highlighted I realised the lexer is C/C++. Before I start deleting C++ keywords, has anyone already created a lexer specifically for C that they'd be willing share, or think it's a useful idea to implement? Failing that, am I right in thinking it would be as simple as deleting words specific to C++? (I know creating a new C lexer would be best but I'm really short on time and don't need C++). Thanks.

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: Lexer for C only?
« Reply #1 on: May 22, 2025, 02:12:00 pm »
I am having the same problem. There is no such language as C/C++. Where is a proper C lexer?

Offline Evan

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Lexer for C only?
« Reply #2 on: March 14, 2026, 07:54:26 pm »
I'm also a C coder.

Did you find any solution?

Offline Hyena

  • Multiple posting newcomer
  • *
  • Posts: 34
Re: Lexer for C only?
« Reply #3 on: March 14, 2026, 08:13:23 pm »
I'm also a C coder.

Did you find any solution?

Kind of. I started using KDevelop and constructed a custom color theme for it using the colors from Code::Blocks. You can get it from here:
https://github.com/1Hyena/kdevelop-theme

KDevelop is actually good IDE for large projects (more then 50k lines of code)

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: Lexer for C only?
« Reply #4 on: Yesterday at 06:45:39 pm »
For C coders, patch https://github.com/josephch/codeblocks/commit/c44cbfaeb666a3eb205dc23bae547c7db849d879.patch can be used.

It cannot be used for those who code in C++ as lexer is applied based on extensions and .h can have only one type of lexer. Extension .h supporting C and C++ based on project  would be a nice feature.