imageJ macro lang file for use with GTKsourceview (gedit)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

imageJ macro lang file for use with GTKsourceview (gedit)

Carnë Draug
Hi,

I decide to write the ImageJ macro language specification for use with
GTKSourceview which among other things is used for syntax highlight on
gedit. I hope others users also enjoy it.

on the metadata block
 * auto-comment and uncomment of several lines with both single lines
and block comments
 * identifies .ijm as ImageJ macro files

On syntax highlight it should highlight everything that you could
expect from gedit. Special things, on my opinion are:
 * highlights as error the end of a block comment outside one
 * a bunch of commands that are used in run() (I think all possible
after removing all plugins and macros)
 * a lot of macro functions (hopefully all of them)
 * escaped characters on strings
 * you should be able to turn on the spelling check which would only
check on strings and comments
 * I defined a regex near the start of the file that it's currently
empty. On it you can add all the functions from Plugins you want
(there's a comment explaining how) which then is used to highlight
"Ext.something" functions

There's one problem on it at the moment:
 * to highlight commands of run(), there must be no space between run,
double quotes and the brackets. This is because the regexp for the
commands use a look-behind operator on the prefiix (?<=run\(("|'))
which doesn't support variable length as in (?<=run(\s)*\((\s)*")

To install, simply move the .lang file into the language-specs
directory of gtksourceview (in Debian and Ubuntu, that's in
'/usr/share/gtksourceview-2.0/language-specs/'). The syntax 'ImageJ'
should show up under the Scientific group. (I couldn't send the
e-mail with the attachment so I had to place its contents on pastebin
http://pastebin.com/jZF3XD9e )

I'll submit to the gtksourceview developers hopefully after I get some
feedback on it. I don't know how many people use gedit (or other
software using gtksourceview) to handle ImageJ macros but considering
the ammount of people at the ImageJ conference using Ubuntu, hopefully
a few.

Any opinion will be most welcome and I hope this can be of any use for
the rest of the community. Thanks in advance,

Carnë Draug

PS: I tried to send the e-mail with the .lang file attached but the
NIH mailing list server rejected because of it. It also rejected if I
compress the file and send it a tar.gz. I sent an e-mail to
[hidden email] as it's instructed almost 3 weeks ago and
still got no response. As such, I'm pasting the contents of the file
in pastebin http://pastebin.com/jZF3XD9e (the filename should be
imagej.lang)