Java software editor / syntax highlighter
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.
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.
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.
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
链接地址: http://www.djcxy.com/p/64362.html上一篇: 任何人都可以推荐在线代码编辑器?
下一篇: Java软件编辑器/语法突出显示器