Thursday, June 23, 2011

Groovy syntax highlight in Programmer's Notepad

I've been using Programmer's Notepad for Groovy and Grails projects, and while there isn't built-in Groovy support (not in version 2.2.0-2240-ellington anyway) it's easy enough to do it yourself.
To expand a bit on the instructions from the pnotepad.org forums, you have to edit two sections of your cpp.scheme file, adding not only a "keyword-class" section for "groovy"(copy paste of the "java" block, rename to "groovy" and add groovy-specific keywords) but also a "language" section (again copy paste and rename of the corresponding "java" block). The only thing that won't syntax highlight properly are triple-quoted strings, which I believe would require using a different lexer than the one defined in the cpp.scheme file - for instance, WebFiles.scheme has triple-quote-handling for embedded Python and PHP. But this works well enough for me so I haven't investigated that one any further.
http://pnotepad.org/forums/topic/1127
http://pnotepad.org/docs/howto/add_support_for_your_language