in

ASP.NET Weblogs

Russell Pooley's .NET Blog

.NET Tools, Source and Research

Syntax Highlighting Editors and Research

Haven't posted for a while after having a lovely holiday in Majorca, its just such a shame to come home.

I've been looking for a syntax highlighting editor or any examples of how to write one for quite while with no success.

Briefly looked at the SharpDevelop for ideas but I'm keen on writing one myself. So after doing a bit more investigation I found a commercial control which is very similar to the Visual Studio .NET editor with intellisense so if you need an editor control then give this one a look in.

http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/Default.aspx

If anyone knows some good resources for syntax highlighting or any open source examples then post me a comment. Thanks

Comments

 

Pete said:

Hi,

I am interested in the same thing. Most editors use a very simple model of highlighting, one that just seems to revolve around a huge list of keywords and "blocks" (comments, etc). To get an idea of how most (closed source) editors work it's just a matter of looking at their syntax definition files.

At the opposite end of the scale you have Visual Assist style of highlighting, which is based on a full c++ parser.

Lately I've been thinking that a middle ground might be in order. Something like a finite state machine model would provide utmost flexibility, without requiring a full parser for each language you support. Then you would use a simple scripting language (in .NET we have the huge advantage here :) ) to specify the states and the given colours/tokens that are associated with them.

For example, with a comment state is fairly obvious (inputs with "/*" or "//"), but now you can trigger a move on to another state when a certain token is encountered ("TODO" could signify the need to colour this specially, as could XML comments). Adding full plugin support to your scripting language and you can now add special functionality to the state machine (picking up XML comments and storing in a database for intellisense).

Hope that helps,
-- Pete
September 4, 2003 4:19 PM
 

Jason Bunting said:

I have absolutely NO IDEA if this is what you want, but there is a nice free little editor called Crimson Editor (http://www.crimsoneditor.com/) for which you can write syntax highlighting files for import. Hope it is of some use, I may be way off base . . .
September 4, 2003 5:03 PM
 

Dumky said:

You might want to check these articles out (Multiple Language Syntax Highlighting): http://www.codeproject.com/jscript/highlight.asp .
September 4, 2003 5:35 PM
 

JosephCooney said:

Like Pete (above) I'm also kind of interested in syntax highlighting (for a small project I am working on). After following the link posted by Dumky (also above) I was lead to a number of other interesting articles. Check out

http://www.codeproject.com/editctrl/crysedit.asp

http://www.codeproject.com/editctrl/brainchild.asp

http://www.scintilla.org/
September 4, 2003 7:46 PM
 

Dan Bright said:

I'm using the syntax hilighting textarea from #Develop in my opensource project SharpEdit:

http://sourceforge.net/projects/sharpedit

Also, if you need a commercial solution, I recommend Essential Edit by Syncfusion.

http://www.syncfusion.com/products/edit.asp
September 4, 2003 7:50 PM
 

Pete said:

Many editors seem to reparse the current line while you are editing.. this could also benefit from knowing what state you are in :) (see my previous post).
September 5, 2003 7:23 AM
 

Bryant said:

If you don't mind demangling MASM32 source, Iczelion's Win32 Assembly tutorial covers basic syntax highlighting ( which can be found http://spiff.tripnet.se/~iczelion/tutorials.html ). Also, if MASM32 is too hard for ya, RADAsm (a VERY High level Assembly language) comes with a library that does the syntax highlighting for you (which could easily be transfered into an import lib for whatever language you want). Not really sure what RADAsm's site is, just search for 'syntax highlighting' on http://board.win32asmcommunity.net I know the creator of RADAsm posts updates there.
June 8, 2004 9:54 AM