[Lazarus] Syntax highlighting anomalies

Martin lazarus at mfriebe.de
Fri Oct 8 21:18:08 CEST 2010


  On 08/10/2010 19:58, Sven Barth wrote:
> On 08.10.2010 20:52, Mattias Gaertner wrote:
>> On Fri, 08 Oct 2010 20:39:27 +0200
>> Sven Barth<pascaldragon at googlemail.com>  wrote:
>>
>>> [...]
>>> The only troubles make hybrids like "index" and "message".
>>
>> Actually they are more simple than you think. They are highlighted by
>> the synedit highlighter correct.
>> The trouble makers are postfix modifiers like 'default' and 'cvar'.
>
> But why do we need to highlight those two like Delphi does? Why does 
> "index" need to be bold if it's in "Foo[Index: Integer]" if I'd expect 
> it to be highlighted only in "Bar index 34"? Why does "message" need 
> to be highlighted everywhere if it is a keyword only in "procedure 
> Foo(aMsg: TMsgRec); message Bar;"?

Actually "index" and "message" are probably easy to fix.

"deprecated" and friends are a bit more complex, because they may be 
behind the ";" (property) or within the declaration/before the ";" (var 
a:byte deprecated;)
It still is easy to implement, but it adds a lot of extra states that 
the highlighter (seen as state engine) can be in. (those few alone are 
probably not enough to cause any issues, but I had speed issues before, 
when adding too many states)

real bugger though is "class"
    type
      a=class; // forward declaration

because it should not be fold-able, but it is
    type
      a=class
      // have some nice multiline comment
      //
     ; // and the semicolon

because on the line "a=class" you can not tell the difference. (unless 
you scan forward, but that means you have to scan twice)

---
Overall there are a few other things on my todo, before I revisit the 
highlighter.

Martin




More information about the Lazarus mailing list