Hi,
Does anybody know of a website or article I can read about how to integrate regular expressions with an editor to end up with a editor that can handle syntax highlighting. It doesn't need to be specific to Object Pascal (that would be too easy and ideal). ;-)
For example, mcedit (from Midnight Commander), gEdit (Gnome's default editor) etc all use regex to handle there syntax highlighting. What I would like to find out is how to use regex with an editor component. Both are new to me, so yes, I'm down on both counts, but I am very eager to learn. :-)
As far as I can see, I need to find out about the following requirements:
* What events must the editor component make available (eg: OnLineDraw)
* how to use regular expressions with such events
* what if syntax highlighting spans multiple lines (eg: a multi-line comment in Object Pascal)
* syntax definition file layout. I guess I can look at gEdit's spec. They use XML files to define
each syntax highlighter. If I can piggy-back on there definition file, I'll instantly have a whole
bunch of syntax highlighters available.
And yes I was told before that using regex for syntax highlighting is slow, but I think that's a matter of implementation. The editors I have seen and used are more that fast enough even on large files. The huge benefit of external (runtime) syntax highlighting via something like regex is that it is very simple to extend by anybody that knows regex. This means, no need for custom components to do syntax highlighting like SynEdit, no recompiling of components or applications etc.
Anyway, this editor component will form part of a larger project I am working on. I already have the basics of a editor component and need to find out what else I need to implement for syntax highlighting to be possible in that editor component.
Any thoughts, suggestions, pointers - any information or links to information would be very helpful.
I found a very nice article that explains the design of an editor that must support Unicode and Syntax Highlighting. So far the author has implemented the basic editor, Unicode support, but hasn't reaching the part I am interested in - syntax highlighting. :-( None the less, this is an interesting tutorial to read. You can find it at the following URL.
http://www.catch22.net/tuts/neatpad/1
