Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ravenshade on April 12, 2013, 05:17:55 am

Title: Syntax Highlighting C++/SDL
Post by: ravenshade on April 12, 2013, 05:17:55 am
Hi,

Given the popularity of SDL... I can't quite figure out how to get the Syntax Highlighting working for it. For instance SDL_Surface isn't highlighted nor is NULL which probably should be too.

I'm also using Linux as well so how the heck can I get it working?

Thanks
Title: Re: Syntax Highlighting C++/SDL
Post by: oBFusCATed on April 12, 2013, 09:40:06 am
There is no semantic highlight in C::B yet.
Title: Re: Syntax Highlighting C++/SDL
Post by: Folco on April 12, 2013, 06:42:23 pm
You can add the SDL types to the list of the highlighted keywords.
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 12, 2013, 06:49:31 pm
Null looks a bit weird in bright green or blue, it's supposed to be red or something similar. I had thought that the different 'sets' of keywords would have different colours or styles attached to them but as far as I can tell only sets 1 & 2 do anything at all. Though I am using the sets at the moment just to get round the problem.

I'm not really looking for 'Semantic highlighting' what would be nice is if all the sets had different colour codes/styles to them. I can't seem to figure out how to add a custom lexer either, the tutorial on the wiki doesn't give much information as to where things are stored and may involve further coding (which given that I'm learning, probably isn't a good idea for me to mess with). In theory I'd like to just extend the lexer and add in my own keywords and stuff but I don't know whether that would work as such.
Title: Re: Syntax Highlighting C++/SDL
Post by: Alpha on April 12, 2013, 09:23:47 pm
Some information here (http://forums.codeblocks.org/index.php/topic,17248.0.html).
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 12, 2013, 10:05:04 pm
http://forums.codeblocks.org/index.php/topic,17248.msg118337.html#msg118337

Okay, I take that, but exactly what is set 4 supposed to do? Set 1 presents the text as Strong && Blue, Set 2 presents the text as Strong && Green. Set 4...does nothing visibly. (So far as I can tell).

Technically SDL_Surface is a global class/type def, but I can't tell the difference between it and normal black text.
Title: Re: Syntax Highlighting C++/SDL
Post by: Alpha on April 14, 2013, 07:51:27 pm
What version of Code::Blocks are you using?
If you have 12.11 or trunk/nightly, there should be a 'Global classes and typedefs' entry in the color style selection list.  (There is also 'Keyword' and 'User keyword' which control the style of sets one and two.)
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 14, 2013, 08:07:58 pm
I'm using the one from the Fedora repository...which appears to be 10.05

I don't think Code::Blocks have submitted an updated version to the repository yet... so in the color style selection list...or list of "Default, Comment, ... , Number, Keyword, User keyword..." and so on I don't have Global Classes & Typedefs...
Title: Re: Syntax Highlighting C++/SDL
Post by: oBFusCATed on April 14, 2013, 08:20:55 pm
Alpha:
Here you see a request for improving your hack.  ;D
But please don't mislead user/s, the feature he requests do not exist currently.
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 14, 2013, 08:24:20 pm
oBFusCATed:

If the sets actually changed the colour/style of the text as they appear supposed to be able to do, that would be enough. I don't really need to craft an entire new Lexer. If it were possible for me to change what those sets do, would also be satisfactory. As I could then enter the stuff I needed through the GUI.

I just don't understand why there are 9 sets, if they 7 of them don't do anything.
Title: Re: Syntax Highlighting C++/SDL
Post by: Alpha on April 14, 2013, 09:23:07 pm
I'm using the one from the Fedora repository...which appears to be 10.05
In that case, I recommend trying a nightly (http://forums.codeblocks.org/index.php/topic,17788.0.html) (binaries here (http://rpm.jenslody.de/)).

Alpha:
Here you see a request for improving your hack.  ;D
But please don't mislead user/s, the feature he requests do not exist currently.
If I understood ravenshade correctly, (s)he is just looking for additional keyword highlighting, not semantic (or pseudo semantic in my case ;)).  Keyword highlighting is something that Scintilla provides just fine, and in 12.11 and newer, three sets of keywords are available.
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 14, 2013, 09:42:26 pm
Ah, I'll wait until the next Code::Blocks is submitted to the fedora repository. The last time I installed something from binary...it went horribly wrong.

But that's exactly what I want Alpha, more keyword highlighting!
Title: Re: Syntax Highlighting C++/SDL
Post by: oBFusCATed on April 14, 2013, 10:19:11 pm
Settings -> Editor -> Syntax Highlight -> C++ -> Keywords -> Enter your keywords

This is available for quite a long time.
Title: Re: Syntax Highlighting C++/SDL
Post by: ravenshade on April 14, 2013, 10:28:59 pm
Yes, I get that. But...

Null looks a bit weird in bright green or blue, it's supposed to be red or something similar. I had thought that the different 'sets' of keywords would have different colours or styles attached to them but as far as I can tell only sets 1 & 2 do anything at all. Though I am using the sets at the moment just to get round the problem.


There are some 'words' such as NULL which shouldn't be in 'blue' because it's a value not a type or class. Which is why I'm trying to figure out how to get the other 'sets' to actually do things.
Title: Re: Syntax Highlighting C++/SDL
Post by: Jenna on April 15, 2013, 12:18:28 am
Ah, I'll wait until the next Code::Blocks is submitted to the repository. The last time I installed something from binary...it went horribly wrong.

On my server there are not just nightly binaries, it's a repo that should work fine with Fedora 16 to 18.
I personally have used it for fc17 and use it for fc18 now.

I do not provide binaries of the 12.11 release on my server (at least not for Fedora and RedHat/CentOS).