Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: ordak on March 30, 2017, 07:20:04 am

Title: C code coloring problem
Post by: ordak on March 30, 2017, 07:20:04 am
Hi,

using code::blocks svn build in Linux, I get the following mis-colored (black instead of blue):

* noreturn defined in <stdnoreturn.h>

* using typedef, the newly defined types

Title: Re: C code coloring problem
Post by: BlueHazzard on March 31, 2017, 12:37:08 am
code highlightening is static at the moment... So this is not parsed automatically. If you need it you can set (add keywords) it in the setting somewhere

If you have time and will you are free to send patches and help to improve codeblocks ;)

Title: Re: C code coloring problem
Post by: ollydbg on March 31, 2017, 07:00:18 am
* noreturn defined in <stdnoreturn.h>
So, "noreturn" should be shown in blue color? Your post is a bit hard to read.  ;)
Title: Re: C code coloring problem
Post by: ordak on April 01, 2017, 11:14:13 am
* noreturn defined in <stdnoreturn.h>
So, "noreturn" should be shown in blue color? Your post is a bit hard to read.  ;)

I expect "noreturn" and  "the newly defined types" to be shown in blue rather than black. Just as types like "int", "bool" and so on.
Title: Re: C code coloring problem
Post by: oBFusCATed on April 01, 2017, 11:23:21 am
What do you mean by newly defined types? Is this some newer C standard?
Title: Re: C code coloring problem
Post by: ordak on April 01, 2017, 04:31:31 pm
What do you mean by newly defined types? Is this some newer C standard?

As I mentioned previously in the first post, I mean the types that are defined using "typedef" specifier. For example see:

http://en.cppreference.com/w/cpp/language/typedef
Title: Re: C code coloring problem
Post by: oBFusCATed on April 01, 2017, 06:01:17 pm
So you want to do:
Code
typedef sometype mytype;
And then if you use mytype you want it different colour?
This is called semantic highlighting and it is not supported by C::B.
Title: Re: C code coloring problem
Post by: ordak on April 02, 2017, 12:44:14 pm
So you want to do:
Code
typedef sometype mytype;
And then if you use mytype you want it different colour?
This is called semantic highlighting and it is not supported by C::B.

I want "mytype" to be colored as "sometype" , which is blue in my Linux PC. Is not there a plugin for this "semantic highlighting" ?
Title: Re: C code coloring problem
Post by: ordak on April 03, 2017, 09:05:29 am
Ok, I added those as keywords, manually and they are colored correctly now:

"Settings->Editor->Syntax highlighting->Keywords"

Select appreciate "Set" and add the keywords.