Generate Syntax Colors for a Domain Specific Language
By Geertjan on Jan 22, 2012
In about 15 minutes of work, without typing a single line of actual code, I created syntax coloring for the domain specific language described here.
The result in a JEditorPane (and notice the non-printable characters are displayed, optionally, too) is as follows:
The user of the application is able to customize the colors:
Again, I did not type a single line of code to create the above. It was all as simple as using a lexer generator (JavaCC in this case) and then connecting the generated files into 100% standard NetBeans Lexer API implementations. I.e., all copy and paste stuff, together with a small bit of configuration and tweaking.
If anyone is interested in step by step instructions for getting to the above, again, without doing any actual coding at all, please leave a message and, based on whether there is some demand for this, I'll write a tutorial describing the procedure for this particular domain specific language.
Update: Here is a YouTube movie describing step by step how to do the above, which I created because of comments below asking for a tutorial: http://www.youtube.com/watch?v=aOwdeoOlZ7E