[Lazarus] Regex and Syntax Highlighting

Zaher Dirkey parmaja at gmail.com
Wed May 26 12:11:17 CEST 2010


On Wed, May 26, 2010 at 11:43 AM, Graeme Geldenhuys <graemeg.lists at gmail.com
> wrote:

> 2010/5/25 Zaher Dirkey :
> > I beleave regex is not a good choice.
> > If you compare the speed you will find SynEdit is more faster.
>
> Again, I think this is more related to implementation details. Some
> editors do it great, some others don't. Some of the editors I looked
> at that uses regular expressions for syntax highlighting, managed to
> open 10MB source code files (like the old macosall.pp unit) and syntax
> highlighting was instant (even when you scroll to the end of the
> file).
>
> So it is definitely *not* a hard and fast rule that if an editor uses
> regular expressions for syntax highlighting, that it is immediately
> slower than others.
>

I meant the mechanism of SynEdit not SynEdit it self, Let us call "Line
Feeding Highlighting", LFH if you like :P
RegEx used on whale file in memory, but that LFH do it line by line, you can
generate the colored and syntax online without load it in memory, just line
by line.
SynEdit use that way the LFH one.

in fact i like FSHL (PHP), you can make the rules by the engine create the
scanner source from it and it use the generated one, the rules is more easy
than (SynEdit mechanism)
http://www.hvge.sk/scripts/fshl/
http://code.google.com/p/fshl/

Best Regards

-- 
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100526/0e03b72b/attachment-0004.html>


More information about the Lazarus mailing list