[Lazarus] Regex and Syntax Highlighting
Martin
lazarus at mfriebe.de
Wed May 26 14:41:58 CEST 2010
On 26/05/2010 13:24, Mattias Gärtner wrote:
> Zitat von Graeme Geldenhuys <graemeg.lists at gmail.com>:
>
>> 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
>
> LFH normally comes with a line state (some booleans or counters). Same
> as synedit. But synedit supports arbitrary states (the default
> implementation implements one stack). You need a stack for different
> keyword sets. For example for the method modifiers. This is not fully
> used in the synedit pascal highlighter, because IMO highlighting some
> variables as keywords is not a big deal and because IFDEFs and macros
> make it hard to implement fully.
> For example:
>
> procedure DoIt(
> {$IFNDEF FPC} );
> {$ELSE} i: integer = 0); inline; macro_modifier;
> {$ENDIF}
IFDEF pose a bigger problem
if foo then begin
bar();
{$IFDEF a} end; {$endif}
xyz();
{$IFnDEF a} end; {$endif}
The ifdef maynot be possible to evaluate (within the highlighter,
codetool could)
for xyz => 2 states are possible, and would need to be maintained.
with more ifdef, any number of states for a single line are possible.
So IFDEf should always balance egin/end correctly => otherwise there is
currently no way to deal with them.
----
As for using special colors for "inactive" code => that isn't something
the highlighte would do (because the highlighter is per file => it does
have no way to know)
A special IDE specific SynEdit extension (that combines info from the
highlighter and codetools) will one day deal with this
Martin
More information about the Lazarus
mailing list