Author Topic: ASP/VB/VBscript and PHP lexers?  (Read 8323 times)

Offline Shaft-O

  • Single posting newcomer
  • *
  • Posts: 4
ASP/VB/VBscript and PHP lexers?
« on: May 21, 2007, 03:37:58 pm »
I'm very new to Code::Blocks (and the scintilla stuff).  Just installed on Friday, as a matter of fact.

Most of my development is in classic ASP (VBscript) and PHP, though there's apparently no inherent support for syntax highlighting for either at the moment.  I've been searching high and low for references to lexers that will do the trick -- even partially finished ones that I could tinker with a bit -- but have so far come up empty.  I'm currently more interested in the VB-related lexer, as PHP is a lower priority for me at work, but both would be greatly appreciated, as I really like what I've seen out of the CB package so far, and would really like to try using it in our production environment.

Can anyone lend a hand here?

Offline Shaft-O

  • Single posting newcomer
  • *
  • Posts: 4
Re: ASP/VB/VBscript and PHP lexers?
« Reply #1 on: May 21, 2007, 04:28:58 pm »
I should probably add that I've tried using the scintilla-type indexes to define a lexer for ASP script, and have run into the same problem I saw referenced with the attempts at a PHP lexer: anything inside the <% ... %> tags was underlined and lacked any syntax highlighting.

This is a real bummer, because I'm definitely digging CB.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: ASP/VB/VBscript and PHP lexers?
« Reply #2 on: May 21, 2007, 06:06:30 pm »
It isn't so easy to implement a lexer for VB(A/SCRIPT) and/or PHP for several reasons (search the C::B forum for "PHP lexer"). I have attached my last attempt for both. Both are not working 100% but maybe a good starting point. You should read the C::B WiKi on how to write a lexer and the wxScintilla documentation if you want to improve this work. But maybe that's already enough for you... ;-)
With regards, Morten.
Ps.:
- place the files in [C::B]\share\CodeBlocks\lexers
- restart C::B
- open a vb{a/s} file, select "open inside C::B" if queried like that.

[attachment deleted by admin]
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 Shaft-O

  • Single posting newcomer
  • *
  • Posts: 4
Re: ASP/VB/VBscript and PHP lexers?
« Reply #3 on: May 21, 2007, 08:52:27 pm »
It isn't so easy to implement a lexer for VB(A/SCRIPT) and/or PHP for several reasons (search the C::B forum for "PHP lexer"). I have attached my last attempt for both. Both are not working 100% but maybe a good starting point. You should read the C::B WiKi on how to write a lexer and the wxScintilla documentation if you want to improve this work. But maybe that's already enough for you... ;-)

This is similar to what I was tinkering with, and had similar results.  It seems that what *should* work as a subset of the HTML doctype (index 4) has the underlining, no code folding, and no highlighting problem, while other doctypes get partial highlighting, presumably because most everything gets interpreted as a tag parameter rather than full code, but then bomb out on the HTML.  (I've had similar near-successes with document type index values of 8 and 15 as well, and I assume its because they all use the same engine for parsing VB-derived code.)

I just downloaded and installed the SciTE editor as well, and noticed that support for classic ASP seems to have a much cleaner implementation.  Perhaps I'm just accentuating the fact that I'm a complete neophyte in the realm of these projects, but my understanding is that scintilla is the same editor package used in the CB code.  If that's true, couldn't this all be patched together somehow without much effort?

Regardless, thanks for your post.  Your attempts will definitely come in useful.  I'll just have to continue to hack away at this stuff when real work doesn't get in the way. :)

Offline AmR EiSa

  • Multiple posting newcomer
  • *
  • Posts: 75
Re: ASP/VB/VBscript and PHP lexers?
« Reply #4 on: May 21, 2007, 09:30:05 pm »
Who saying CodeBlocks is best don't lie  :D

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: ASP/VB/VBscript and PHP lexers?
« Reply #5 on: June 01, 2007, 03:24:40 pm »
this issue should now be resolved. see here: http://forums.codeblocks.org/index.php/topic,6030.0.html