Author Topic: Syntax Highlighting C++/SDL  (Read 15507 times)

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Syntax Highlighting C++/SDL
« 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Syntax Highlighting C++/SDL
« Reply #1 on: April 12, 2013, 09:40:06 am »
There is no semantic highlight in C::B yet.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: Syntax Highlighting C++/SDL
« Reply #2 on: April 12, 2013, 06:42:23 pm »
You can add the SDL types to the list of the highlighted keywords.
Kernel Extremist - PedroM power ©

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #3 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Syntax Highlighting C++/SDL
« Reply #4 on: April 12, 2013, 09:23:47 pm »
Some information here.

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #5 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Syntax Highlighting C++/SDL
« Reply #6 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.)

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #7 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...
« Last Edit: April 14, 2013, 08:10:48 pm by ravenshade »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Syntax Highlighting C++/SDL
« Reply #8 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #9 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.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Syntax Highlighting C++/SDL
« Reply #10 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 (binaries here).

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.

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #11 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!
« Last Edit: April 15, 2013, 12:58:14 am by ravenshade »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Syntax Highlighting C++/SDL
« Reply #12 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Syntax Highlighting C++/SDL
« Reply #13 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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Syntax Highlighting C++/SDL
« Reply #14 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).