News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

highlight/colorize embedded code

Started by eaglecode, August 30, 2017, 10:26:17 AM

Previous topic - Next topic

eaglecode

Hi all!

I'm coding C/C++ with codeblocks for some years now, but with growing code I'am missing the possibility to highlight embedded code.

In this case I have embedded SQL strings in the code and for copy and paste reasons I have enclosed them into a MULTI_LINE_STRING() define.


bool sqladapter::get_cars(session& sql)
{
  sql << MULTI_LINE_SQL(
    SELECT * FROM cars;
  );
}


My target is now to highlight everything between the brackets (the SQL code), maybe with a different background color or something similar.
I've seen and tested the scintilla highlight options, having matching brackets in every color I like, I have highlighted the "MULTI_LINE_SQL" keyword, but what about the part between the brackets ??? ?

Any ideas (or is it so simple, that I've missed it) ?

Thanks in advance!

BlueHazzard

i am afraid, but i think without modifying the codeblocks source this won't be possible... Codeblocks uses the scintilla lexer interface so you can look at their site how to do tings.

oBFusCATed

Your only option is to modify the c/c++ lexer in scintilla or you could probably implement a plugin that overrides the styling of parts of the text, but I'm not sure how it could be done. But for sure you'll need to write some custom code that modifies or extends codeblocks.
(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!]