Author Topic: Adding new syntax highlight  (Read 20470 times)

Offline gazzel

  • Single posting newcomer
  • *
  • Posts: 2
Adding new syntax highlight
« on: December 25, 2012, 12:25:21 pm »
Hi, i would like to add new syntax highlight to Code::Blocks ( so to Scintilla code), is there any manual step by step where in C++ code should i made changes. Ofcourse I can read code but it would take "little" longer.

Thanks for your help in advance.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Adding new syntax highlight
« Reply #1 on: December 25, 2012, 12:55:32 pm »
...please be more precise. What do you want to extend for what? The scintilla lexer is already really powerful and easily extensible by configuration.

So for your needs there might not even be any need for programming at all.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline gazzel

  • Single posting newcomer
  • *
  • Posts: 2
Re: Adding new syntax highlight
« Reply #2 on: December 25, 2012, 02:33:43 pm »
i was looking for example for ttcn3 and gnu assembler syntax. There is not such thing in sdk/wxscintilla/include/wx/wxscintilla.h. Code::Blocks xml syntah files are based on scientilla syntax (you set it for example in index="xx") as i read in wiki. I can ofcourse modify 34 index for assembler but it's already used by MASM which i sometimes use, so i guess solution is to extend Scientilla syntax.

Regards

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Adding new syntax highlight
« Reply #3 on: December 25, 2012, 04:28:45 pm »
i was looking for example for ttcn3 and gnu assembler syntax.
Ok - at least for the first you need to update scintilla, indeed. Note scintilla first, not wxScintilla. I would suggest you talk to the maintainer of scintilla first (Neil Hodgson, "nyamatongwe", https://sourceforge.net/projects/scintilla/develop) to see if he is willing to support such lexers. To be honest: If thats not the case it is unlikely that we will start a fork as it will be very hard to maintain (we already have too much customisations for the base scintilla).

If he is willing (he may also give you some guidelines) come back here and we'll see how we can support that.

We will be happy (however) to host patches in that direction for other users...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Adding new syntax highlight
« Reply #4 on: December 26, 2012, 04:04:09 pm »
I can ofcourse modify 34 index for assembler but it's already used by MASM which i sometimes use, so i guess solution is to extend Scientilla syntax.
If the syntax of the languages are similar, you could just create another lexer_*.xml file, using the same index (Squirrel and C/C++ both use the same Scintilla lexer).  Also, certain languages that are completely different may just work (the Hitachi assembler apparently uses the C/C++ lexer?!).