About Syntax highlighting

This blog engine makes available plugin(s) for the syntax highlighting, but I can’t find one that match I want. Colorize at least Powerbuilder and Perl.

The first I found (syntaxHl) handled them on the server-side, but some Perl expression was badly broken. Then I see that search.cpan.org was using an sh system that allows to dynamically switch colorization style, on the client-side (javascript). Taking a look at that system (http://shjs.sourceforge.net/) and I was surprised of the simplicity of the language definition.

So I have decided to use it on my blog. Hopefully, Dotclear engine provides a plugin API, and this was one of the reasons I have choose it.

Take some days to build an alpha version, then I see that the Perl syntax that was broken with the previous plugin was still wrongly colorized!

Here is a screenshot :

SHJS broken on perl regexp

You can see the 3thd regular expression is colorized to the end of the split args, I suspect that the $/ variable was interpolated into the regex in the case another / close the expression before the end of the line. I may take time to investigate 

Today, it is colorized as : (fixeme)

  if($_=~/^appname "([^"]+)";$/gi){ $appName = $1; }
  if($_=~/applib "([^"]+)";$/gi){ $appLib = $1; }
  if($_=~/LibList "([^"]+)";$/gi){ @libList = split(/;/,$1); }
  if($_ eq "/LibList ('[^']+)';$/gi"){ @libList = split(/;/,$1); }
  if($_=~/LibList \/!([^!]+)!;$/gi){ @libList = split(/;/,$1); }
  if($_=~/LibList \/"([^"]+)";$/gi){ @libList = split(/;/,$1); }
  if(qr/this is \/ a test /g or qr/blabla/){ return "test - " x 10 };
  if(m/this is \/ a test /g or m/blabla/){ return "test - " x 10 };
  if(s/this is \/ a / replace test /g or s/bla/bla/){ return "test - " x 10 };

For those who are interested on that SH system with DotClear 2, you can find my alpha plugin attached to this post.