Re: New driver for Text_Highlighter
| From: | Andrey Demenev | Date: | Fri, 12 Nov 2004 08:18:45 +0000 |
| Subject: | Re: New driver for Text_Highlighter | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34346@lists.php.net to get a copy of this message | ||
Are you using latest Text_Highlighter? In your example
Text_Highlighter is about 2 times slower, while in my tests it is
about 2.5 times faster
You have done a great work, but I think it would be better to stay
with current highlighting engine (unless a faster one will be created,
preferably keeping BC with existing XML format), and create a
converter from KATE syntax. Conversion algorythm would be quite
straightforward, and "#pop#pop..." can be handled using lookahead
regexp assertions.
On Wed, 10 Nov 2004 22:57:42 +0100, Jörn Horstmann <joern_h@gmx.net> wrote:
> Hello,
>
> I have updated the highlighting driver, performance should be a bit
> better than before, although probably not as fast as Text_Highlighter.
> Caching would certainly be useful for both.
>
> In KATE's syntax files a region can be ended by several different tokens
> and the current context can return to the nth previous context.
>
> An example:
>
> <context name="php_onelinecomment"
> attribute="Comment" lineEndContext="#pop">
> <StringDetect
> attribute="Keyword" context="#pop#pop"
> String="?>" />
> </context>
>
> A line end ends the current context, the string "?>" returns to the
> context before that. I don't think this can automatically be mapped to
> the current algorithm.
>
> I also added some more examples and the option to compare the output to
> the current highlighter at
> http://planetxml.de/highlighter/index.php.
>
> Regards
> Jörn Horstmann
>
>
>
>
> Andrey Demenev wrote:
> > This is interesting suggestion. I do like the idea of adding KATE
> > syntax definition support to Text_Highlighter, although there are 2
> > points:
> >
> > 1) You may have noticed from release history that I am trying to
> > improve speed of highlighting. PHP is not the best tool for test
> > processing from speed aspect. Your class was about 2.5 times slower
> > compared to latest version of Text_Highlighter. Would be great if you
> > find a way to make it faster. I did not dive into your code, so I do
> > not have ideas on speeding it up at the moment
> >
> > 2) Support of syntax definition parsing should be added to the
> > generator -- highlighter should only highlight text.
> >
> > I have not examined the KATE files syntax deeply, but from what I have
> > seen, I think a converter can be created to transform those files to
> > native Text_Highlighter format.
>