Author Topic: Syntax highlighting - AMPL  (Read 4854 times)

Offline aaros

  • Single posting newcomer
  • *
  • Posts: 2
Syntax highlighting - AMPL
« on: March 10, 2014, 04:24:11 pm »
Hi all,

I'm a bit new to programming and I'm currently working with AMPL. I really like C:B but I can't find any extension to highlight AMPL syntax. If I'm not mistaken it is because C:B only provides highlighting mode for languages supported by Scintilla, which does not provide AMPL editing.

I saw that AMPL modes have been written for VIm and Emacs. I know that they are not like C:B, but is there hope of having AMPL in C:B?

Thanks for your help

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Syntax highlighting - AMPL
« Reply #1 on: March 10, 2014, 05:54:22 pm »
you can make it yourself: http://wiki.codeblocks.org/index.php?title=Creating_a_custom_lexer_for_Code::Blocks_editor
please provide a patch if you succeed

greetings

Offline aaros

  • Single posting newcomer
  • *
  • Posts: 2
Re: Syntax highlighting - AMPL
« Reply #2 on: March 11, 2014, 09:43:03 am »
Yep, I've seen that ;)
By saying "I'm a bit new to programming", I was also implying "it will take ages for me to do it on my own". I'm more looking for people who also thought about this feature and then maybe we'll try work it out.

Thanks for the reply anyway

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Syntax highlighting - AMPL
« Reply #3 on: March 11, 2014, 11:38:47 pm »
It actually should not be that hard to get a reasonable syntax highlight.  From a look at the Wikipedia page, the language is similar-ish to bash, so if you copy lexer_bash.xml to (for example) lexer_ampl.xml, all you should need to change in the file, is the associated file extension (*.mod ...), and replace the listed keywords with the keywords AMPL uses (data in param set var ...).