[Lazarus] Regex and Syntax Highlighting
Graeme Geldenhuys
graemeg.lists at gmail.com
Tue May 25 15:14:01 CEST 2010
On 25 May 2010 14:38, Marco van de Voort wrote:
>
> But the main problem IMHO is that regex is not suited to highlight many
> languages that require correct detection of matching tokens, like the Pascal
> nested comments.
mcedit (editor part of Midnight Commander) supports 68 different file
formats by default. That alone is already very impressive.
gEdit supports 85 different file formats by default (included in
Ubuntu 10.04). Even more impressive than mcedit.
In both cases, I simply had to tweak one or two lines of the pascal
syntax definition files to get the Object Pascal syntax correct for
Free Pascal specific features I use and for my code. So this is
clearly not so much of a problem and regex is sufficiently flexible
for most (if not all) languages.
I don't want to make this a debate if regex is a good choice or not. I
am going to use regex no matter what others say, I simply need to find
out more information on how to tie it into a editor component and what
is required from the editor component. I'll download the code for the
gtksourceview component (what is used in gEdit) and see if that gives
me some hints.
Thinking about it, I should also take a look at Sun's Java code. I
quite like their Document interface and how flexible it is to use...
even for something as simple as a TEdit and to as complex as a
full-blown programming editor or WYSIWYG editor.
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list