martes, 5 de abril de 2011

Syntax highlighting for Alloy language with gedit

Something simple but useful. How to highlight Alloy code with gedit? Gedit is my favorite text editor for Linux. Alloy is a modeling languages based on lightweight formal methods.

First we must find the location of GtkSourceView:

$ locate gtksourceview

In my case I run Ubuntu Linux 10.04 LTS and gedit 2.30.3 and I tested the highlightingwith the default GtkSourceView, that is 2.0. I based my XML specification of the highlighting in the Java highlighting.

Finally just copy (with sudo) file alloy.lang (this is the last version) to folder /usr/share/gtksourceview-2.0/language-specs/ (in this case).

It also highlights some reserved words of extension DynAlloy, such as assume, pre, post, call and program. Don't forget to comment any mistake.

A sample screenshot. Thanks.