[Lazarus] Regex and Syntax Highlighting
Martin
lazarus at mfriebe.de
Wed May 26 13:19:46 CEST 2010
On 26/05/2010 12:06, Graeme Geldenhuys wrote:
> 2010/5/26 Zaher Dirkey :
>
>> 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.
>>
> I doubt SynEdit only uses a line by line method. What happens when a
> comment block covers multiple lines. The syntax highlighter needs to
> keep track of when the comment block started and continue marking
> everything as a comment until it finds the matching closing comment
> block tag.
>
It keeps a general state for the end of each (beginning of next) line:
- eg: currently in comment nested 3
if a change in a line, changes the end-state, then further lines are
scanned, until they match again. In the worst case, that is the rest of
the file; but very often, it doesn't need to look over the current line.
---
try MacOsAll.pp (300000 lines) in your egex highlighter
More information about the Lazarus
mailing list