[Lazarus] Regex and Syntax Highlighting
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu May 27 08:29:40 CEST 2010
On 27 May 2010 02:33, Hans-Peter Diettrich wrote:
>
> Multi-line comments, or even worse: nested comments, require to pre-scan an
> file, before the highlighter can be used.
I don't think this is true. I briefly looked at the jEdit code that
manages the syntax highlighting, and it doesn't do multiple passes
over the file. It tokenizes a line, if that line contains something
that could span multiple lines (like { or (* style comments), it
carries the state and context over to the next line. Then it processes
the next line etc... only a single pass seems to be used.
jEdit also supports code-folding, but I haven't looked at how they tie
that into the whole TextEdit component yet. The more I play with jEdit
the more impressed I get regarding all it's features and how
extensible it is via it's plugin system. A pretty amazing piece of
engineering in a very small download (2.5MB).
> undo-tracking, and foldable blocks come into play, and UTF-8 and tab
> expansion, then it may take longer to retrieve the text to show, the
> highlighter must be fault-tolerant to cover temporarily invalid tokens,
jEdit supports all that and more, and it is very fast! Like I said, a
very impressive piece of engineering.
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list