bioSyntax support for ImageJ 1.x macro language

imagej
macro
syntax-highlighting

#1

Hey; I’m a dev for bioSyntax and I’m looking to make syntax highlighting definitions for ImageJ macro language.

Are there any additional language definitions which are not included in in the Reference Guide?


Syntax highlighting for ImageJ1 macros
#2

Dear @ababaian,

as far as I know, there is no proper definition apart from the reference guide. And even with the reference guide, I am not entirely sure if it is complete. In doubt, you’d have to look at the implementation and or ask for help here (that’s why I have split your question into a new topic).

It might be worth to take a look at @Kota’s implementation for Notepad++:

Best,
Stefan


#3

I think the best would be to convert the source code in GitHub for the latest listing.

source: https://github.com/imagej/imagej1/blob/master/ij/macro/Functions.java

edit: I replaced the above URL. Correct source is ij.macro.Functions, not Constants.

The IJ macro below will print all macro functions based on the website index, which I have been using for listing macro functions.

str = File.openUrlAsString("http://rsb.info.nih.gov/ij/developer/macro/functions.html");
//print(str);
lineA = split(str, "\n");
all = ""
for (i=0; i<lineA.length; i++){
    if (startsWith(lineA[i], "<b>")){
        endindex = indexOf(lineA[i], "</b>");
        comm = substring(lineA[i], 3, endindex);
        if (indexOf(comm, "(") > 0)
        {
            firstaftpare = substring(comm, indexOf(comm, "(")+1, indexOf(comm, "(")+2);
            //if (firstaftpare != "\""){
                comm = substring(comm, 0, indexOf(comm, "("));
            //}
        }
        print(comm );
        all += comm + " ";
    }
}
print(all);

#4

@haesleinhuepf just completed the code completion for the ImageJ macro language. It uses https://imagej.net/developer/macro/functions.html but also adds a few things on top.

There is also syntax highlighting for ImageJ macro as part of the SciJava script editor. (This specific highlighter is slated to be moved to imagej/imagej-legacy, but for now is still part of scijava/script-editor.)