Zitat von Graeme Geldenhuys <graemeg.li...@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}
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.
That's good for logs and csv files.
That does not work well for sources, where blocks span many lines. You
need the line state.
[...]
Like I said in my first post, I don't know how they currently
integrate regex with a syntax highlighter - that's the whole point of
the exercise, to find out how. You can very easily run a regex on a
line by line basis, but I doubt that is the best way of doing it,
because it will also produce problems with things like comment blocks.
AFAIK they do. Because regex can not count nor save states, you need a
state machine, which selects which set of regex to use.
http://www.hvge.sk/scripts/fshl/
http://code.google.com/p/fshl/
Their configs are php. I think the gtksourceview (gedit) syntax is
easier to understand. As far as I can see it is powerful enough. It is
not as fast and flexible as synedit, but it is enough to highlight
even blocks.
Graeme, when you start implementing a highlighting machine, you might
want to consider code folding too.
Mattias
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus