views:

82

answers:

3

I have to build a software editor for Java, so think of just a very simplified Netbeans / Eclipse. The first area which I want to do is the Syntax Highlighting.

I found a few libraries / open source editors such as jEdit, BlueJ and jsyntaxpane which will be useful for building my own.

What I am looking for though is any literature / journals / books / articles which explain the process of writing a syntax highlighter.

A: 

Im not the Java guy but since you said:

What I am looking for though is any literature / journals / books / articles which explain the process of writing a syntax highlighter.

Here are some .NET links from codeproject:
http://www.codeproject.com/KB/edit/SyntaxHighlighting.aspx (Reusable Control) http://www.codeproject.com/KB/edit/SyntaxRichTextBox.aspx (Silverlight) http://www.codeproject.com/KB/silverlight/SL2TextBoxWsSynParser.aspx

Here are some .NET Intellisense links: http://www.codeproject.com/KB/combobox/JGIntelli.aspx http://www.codeproject.com/KB/cs/diy-intellisense.aspx

I couldn't find any Java links for your question on codeproject

giddy
A: 

Luckily for you, jEdit provide a syntax package, which is a Java Bean. There is also Jintilla. If you have to code this yourself, you want to parse the file and tokenize the items found. Apply different colours to the different tokens.

dekz
A: 

If you really want to write one yourself, look for a text book on parsers and compilers. What you need is a lexer to break up the code in tokens and then highlight based on the token type. It's duplicating code that's already available, but you'll learn a lot doing it.

JOTN