Doxia APT language support
Written on August 5, 2009 by Allan Lykke Christensen
As I use Maven for most of my projects I end up writing a fair amount of documentation using the APT format [1]. Unfortunately NetBeans doesn’t have any built-in support (syntax highlighting, parsing) for the language yet. So yesterday I decided to looking into providing file type and language support for NetBeans. I first stumbled across a lot of tutorials regarding the Generic Language Support. However, after some researched I found that it is no longer supported. Instead I found another more recent article on the NetBeans wiki about providing language support [2]. The article was quite sketchy and confused me a lot. The confusion was mainly because of too much focus on adapting a JavaCC grammar file for Java syntax highlighting. I hope for the final version of the article will have a simpler example. Nevertheless, the article got me on my way and I’ve now managed to create very basic syntax highlighting for the APT language.
There is still a long way to go. I need to implement the parser and improve on the JavaCC grammar. Also, I’m planning to provide a “Preview” view in the editor so that the writer can get an idea of how the rendered document will look as he or she is writing.
If anyone knows of a good book or website about JavaCC, I’d very much like to hear from you.
That’s all for now!
[1] http://maven.apache.org/doxia/format.html
[2] http://wiki.netbeans.org/How_to_create_support_for_a_new_language


Cool!
Is it available for download somewhere? Are the sources public?
Can’t you use the ready-made doxia apt parser instead of javacc:
http://svn.apache.org/repos/asf/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/
mkleint> I’ve created a project for it on Kenai called nb-goodies. You can get the source directly from here: http://kenai.com/svn/nb-goodies~source-code-repository/trunk/langsupport-apt/ Don’t expect too much yet!
ltheussl> Actually I was looking into that, but the module doesn’t seem to expose the methods needed to hook it up to NetBeans. I’m going to look into a bit more as it certainly will be easier than me having to do the JavaCC grammar. For the rendering view of the page, I’ll certainly use the AptParser with the Xhtmlsink.
Forgot to mention: we also have a skeleton in the doxia sandbox:
http://svn.apache.org/repos/asf/maven/sandbox/trunk/doxia/doxia-ide/netbeans/
it’s pretty empty still though…
Ah cool. Perhaps when my code is a bit more complete (and hooked up to the AptParser), it can be migrated to the doxia-project?