- Learn Linux
- Learn Electronics
- Raspberry Pi
- LPI certification
- News & Reviews
16 February 2010
I've recently been learning the Processing programming language. This is a programming language created for artists which is also the basis for the programming language used to program the Arduino. Processing includes an IDE called the Processing Development Environment (PDE), but the editor is quite basic.
The IDE has an option to use an external editor. One of my preferred editors is jEdit due to it's cross-platform support. Jedit has built-in support for over 170 languages, but not processing which I guess is still a little bit too niche at the moment.
Adding a new language is fairly easy - and I've cheated a little to make it very easy.
Processing has a similar syntax to Java (as it's based on Java), so I've just copied the Java syntax highlighting file with the option to tweak if I want to change in future.
The syntax highlighting is defined within xml files in the modes directory.
On Linux this is usually /usr/share/jedit/modes
On Windows this is c:\Program Files\jEdit\modes
As I was just using the java one I copied java.xml to processing.xml
Then add an entry to the catalog file "catalog"
Load the catalog file (eg. /usr/share/jedit/modes/catalog) into your favourite text editor [that'll be jEdit then] and add the following entry at an appropriate point; the file is in alphabetical order, although I don't think the actual position matters it makes it easier to find.
<MODE NAME="processing"FILE="processing.xml" FILE_NAME_GLOB="*.pde" />
The FILE_NAME_GLOB says to apply this rule to any files ending .pde (which is used by processing files) treat them as processing files and use the mode as described in processing.xml.
In my case this reloaded straight away, but if not then you can force a reload using
Utilities -> Troubleshooting -> Reload Edit Modes
In future it may be worth tweaking the processing.xml file to ensure any differences between Java and processing are highlighted properly, but the standard file appears to be working fine at the moment.
Since writing this I've found a "official" version on the processing.org site. Essentially it's the same as mine, but with some further changes to the processing.xml file to improve the syntax highlighting. If you've already applied the changes specified above you can just copy the processing.xml file in place of the one suggested above.